From 587177a56eb5768231a2c9f6c986b6cfc04a9c80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Ellensohn?= Date: Mon, 5 Jun 2023 13:46:53 +0200 Subject: [PATCH] update: might be fixing weird issues with controller not working? --- ...mini.launch.py => full_bot_mini.launch.py} | 2 +- launch/min_bot_mini.launch.py | 109 ++++++++++++++++++ launch/odrive_diffbot.launch.py | 76 ++++++++++++ 3 files changed, 186 insertions(+), 1 deletion(-) rename launch/{joy_bot_mini.launch.py => full_bot_mini.launch.py} (98%) create mode 100644 launch/min_bot_mini.launch.py create mode 100644 launch/odrive_diffbot.launch.py diff --git a/launch/joy_bot_mini.launch.py b/launch/full_bot_mini.launch.py similarity index 98% rename from launch/joy_bot_mini.launch.py rename to launch/full_bot_mini.launch.py index 8d74dac..92f6781 100644 --- a/launch/joy_bot_mini.launch.py +++ b/launch/full_bot_mini.launch.py @@ -39,7 +39,7 @@ def generate_launch_description(): robot_controllers = PathJoinSubstitution( [ - FindPackageShare("odrive_demo_bringup"), + FindPackageShare("bot_mini_bringup"), "config", "diffbot_controllers.yaml", ] diff --git a/launch/min_bot_mini.launch.py b/launch/min_bot_mini.launch.py new file mode 100644 index 0000000..f8a8245 --- /dev/null +++ b/launch/min_bot_mini.launch.py @@ -0,0 +1,109 @@ +# Copyright 2022 Factor Robotics +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import os +from launch import LaunchDescription +from launch.substitutions import Command, FindExecutable, PathJoinSubstitution +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare +from ament_index_python.packages import get_package_share_directory +from launch_ros.actions import LifecycleNode + + +def generate_launch_description(): + robot_description_content = Command( + [ + PathJoinSubstitution([FindExecutable(name="xacro")]), + " ", + PathJoinSubstitution( + [ + FindPackageShare("bot_mini_description"), + "urdf", + "odrive_diffbot.urdf.xacro" + ] + ), + ] + ) + robot_description = {"robot_description": robot_description_content} + + robot_controllers = PathJoinSubstitution( + [ + FindPackageShare("bot_mini_bringup"), + "config", + "diffbot_controllers.yaml", + ] + ) + + control_node = Node( + package="controller_manager", + executable="ros2_control_node", + parameters=[robot_description, robot_controllers], + output="both", + ) + + robot_state_pub_node = Node( + package="robot_state_publisher", + executable="robot_state_publisher", + output="both", + parameters=[robot_description], + ) + + joint_state_broadcaster_spawner = Node( + package="controller_manager", + executable="spawner", + arguments=["joint_state_broadcaster", "-c", "/controller_manager"], + ) + + robot_controller_spawner = Node( + package="controller_manager", + executable="spawner", + arguments=["diffbot_base_controller", "-c", "/controller_manager"], + ) + + joystick_spawner = Node( + package="joy", + executable="joy_node" + ) + + teleop_spawner = Node( + package="rmp220_teleop", + executable="rmp220_teleop" + ) + + cam_node = Node( + package="ros2_cam_openCV", + executable="cam_node" + ) + + lidar_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10.yaml') + lidar_node = LifecycleNode( + package='lslidar_driver', + executable='lslidar_driver_node', + name='lslidar_driver_node', + output='screen', + emulate_tty=True, + namespace='', + parameters=[lidar_dir], + ) + + return LaunchDescription([ + control_node, + robot_state_pub_node, + joint_state_broadcaster_spawner, + robot_controller_spawner, + joystick_spawner, + teleop_spawner, + #cam_node, + #lidar_node + ]) \ No newline at end of file diff --git a/launch/odrive_diffbot.launch.py b/launch/odrive_diffbot.launch.py new file mode 100644 index 0000000..95331ba --- /dev/null +++ b/launch/odrive_diffbot.launch.py @@ -0,0 +1,76 @@ +# Copyright 2022 Factor Robotics +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from launch import LaunchDescription +from launch.substitutions import Command, FindExecutable, PathJoinSubstitution +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare + + +def generate_launch_description(): + robot_description_content = Command( + [ + PathJoinSubstitution([FindExecutable(name="xacro")]), + " ", + PathJoinSubstitution( + [ + FindPackageShare("odrive_demo_description"), + "urdf", + "odrive_diffbot.urdf.xacro" + ] + ), + ] + ) + robot_description = {"robot_description": robot_description_content} + + robot_controllers = PathJoinSubstitution( + [ + FindPackageShare("odrive_demo_bringup"), + "config", + "diffbot_controllers.yaml", + ] + ) + + control_node = Node( + package="controller_manager", + executable="ros2_control_node", + parameters=[robot_description, robot_controllers], + output="both", + ) + + robot_state_pub_node = Node( + package="robot_state_publisher", + executable="robot_state_publisher", + output="both", + parameters=[robot_description], + ) + + joint_state_broadcaster_spawner = Node( + package="controller_manager", + executable="spawner", + arguments=["joint_state_broadcaster", "-c", "/controller_manager"], + ) + + robot_controller_spawner = Node( + package="controller_manager", + executable="spawner", + arguments=["diffbot_base_controller", "-c", "/controller_manager"], + ) + + return LaunchDescription([ + control_node, + robot_state_pub_node, + joint_state_broadcaster_spawner, + robot_controller_spawner, + ])