From 02b4b9ea2dd7bc0afed3ca2b242c1ea0c6d86ede Mon Sep 17 00:00:00 2001 From: Franco Cipollone Date: Mon, 12 Feb 2024 20:07:26 -0500 Subject: [PATCH 1/2] Matches convention with cmd_vel and odom topics. Signed-off-by: Franco Cipollone --- README.md | 31 ++++++++++++++++--- andino_bringup/launch/andino_robot.launch.py | 9 ------ .../launch/teleop_joystick.launch.py | 2 +- .../launch/teleop_keyboard.launch.py | 1 - andino_bringup/package.xml | 1 - andino_control/README.md | 4 +-- andino_control/config/andino_controllers.yaml | 1 + .../launch/andino_control.launch.py | 7 ++++- 8 files changed, 36 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index 8f20609b..76c5ff1a 100644 --- a/README.md +++ b/README.md @@ -123,17 +123,38 @@ By default sensors like the camera and the lidar are initialized. This can be di - include_rplidar: `true` as default. - include_camera: `true` as default. -After the robot is launched, use `ROS 2 CLI` for inspecting environment. E.g: By doing `ros2 topic list` the available topics can be displayed. +After the robot is launched, use `ROS 2 CLI` for inspecting environment. +For example, by doing `ros2 topic list` the available topics can be displayed: + + /camera_info + /cmd_vel + /image_raw + /odom + /robot_description + /scan + /tf + /tf_static + + _Note: Showing just some of them_ ### Teleoperation Launch files for using the keyboard or a joystick for teleoperating the robot are provided. -[`twist_mux`](http://wiki.ros.org/twist_mux) is used to at the same time accept command velocities from different topics using certain priority for each one of them (See [twist_mux config](andino_bringup/config/twist_mux.yaml)). Available topics are (ordering by priority): +#### Keyboard + +``` +ros2 launch andino_bringup teleop_keyboard.launch.py +``` +This is similarly to just call `ros2 run teleop_twist_keyboard teleop_twist_keyboard` + +#### Joystick -- cmd_vel -- cmd_vel_keyboard -- cmd_vel_joy +Using a joystick for teleoperating is notably better. +You need the joystick configured as explained [here](andino_hardware/README.md#Using-joystick-for-teleoperation). +``` +ros2 launch andino_bringup teleop_joystick.launch.py +``` ### RViz diff --git a/andino_bringup/launch/andino_robot.launch.py b/andino_bringup/launch/andino_robot.launch.py index f04317dd..1c1f1cb7 100644 --- a/andino_bringup/launch/andino_robot.launch.py +++ b/andino_bringup/launch/andino_robot.launch.py @@ -103,14 +103,6 @@ def generate_launch_description(): rplidar_timer = TimerAction(period=3.0, actions=[include_rplidar]) camera_timer = TimerAction(period=3.0, actions=[include_camera]) - twist_mux_params = os.path.join(pkg_andino_bringup,'config','twist_mux.yaml') - twist_mux = Node( - package="twist_mux", - executable="twist_mux", - parameters=[twist_mux_params], - remappings=[('/cmd_vel_out','/diff_controller/cmd_vel_unstamped')] - ) - return LaunchDescription([ include_andino_description, andino_control_timer, @@ -118,5 +110,4 @@ def generate_launch_description(): camera_timer, rplidar_arg, rplidar_timer, - twist_mux, ]) diff --git a/andino_bringup/launch/teleop_joystick.launch.py b/andino_bringup/launch/teleop_joystick.launch.py index 9a099b39..22dfda2c 100644 --- a/andino_bringup/launch/teleop_joystick.launch.py +++ b/andino_bringup/launch/teleop_joystick.launch.py @@ -42,7 +42,7 @@ def generate_launch_description(): cmd_vel_topic_arg = DeclareLaunchArgument( 'cmd_vel_topic', - default_value='/cmd_vel_joy', + default_value='/cmd_vel', description='Indicates the cmd_vel topic.') cmd_vel_topic = LaunchConfiguration('cmd_vel_topic') diff --git a/andino_bringup/launch/teleop_keyboard.launch.py b/andino_bringup/launch/teleop_keyboard.launch.py index cf748b76..1139dcec 100644 --- a/andino_bringup/launch/teleop_keyboard.launch.py +++ b/andino_bringup/launch/teleop_keyboard.launch.py @@ -36,7 +36,6 @@ def generate_launch_description(): package='teleop_twist_keyboard', executable='teleop_twist_keyboard', name='teleop_twist_keyboard_node', - remappings=[('/cmd_vel','/cmd_vel_keyboard')], output='screen', prefix = 'xterm -e', ) diff --git a/andino_bringup/package.xml b/andino_bringup/package.xml index 9bde80db..c3fe9a13 100644 --- a/andino_bringup/package.xml +++ b/andino_bringup/package.xml @@ -17,7 +17,6 @@ rplidar_ros teleop_twist_joy joy_linux - twist_mux v4l2_camera laser_filters rosbag2_storage_mcap diff --git a/andino_control/README.md b/andino_control/README.md index 42b7c0e3..f14d9dc0 100644 --- a/andino_control/README.md +++ b/andino_control/README.md @@ -23,8 +23,8 @@ flowchart TD M(Controller Manager) -..-> |manages lifecycle| C M(Controller Manager) -..-> |activates hw component| B - D["/diff_controller/cmd_vel"] -->|subs| A - A -->|pubs| O["/diff_controller/odom"] + D["/cmd_vel"] -->|subs| A + A -->|pubs| O["/odom"] A -->|pubs| T["/tf"] C -->|pubs| J["/joint_states"] diff --git a/andino_control/config/andino_controllers.yaml b/andino_control/config/andino_controllers.yaml index 41c42a47..35ca3406 100644 --- a/andino_control/config/andino_controllers.yaml +++ b/andino_control/config/andino_controllers.yaml @@ -10,6 +10,7 @@ controller_manager: diff_controller: ros__parameters: + # See https://github.com/ros-controls/ros2_controllers/blob/humble/diff_drive_controller/src/diff_drive_controller_parameter.yaml publish_rate: 50.0 left_wheel_names: ['left_wheel_joint'] right_wheel_names: ['right_wheel_joint'] diff --git a/andino_control/launch/andino_control.launch.py b/andino_control/launch/andino_control.launch.py index b3c66c7a..2cff2710 100644 --- a/andino_control/launch/andino_control.launch.py +++ b/andino_control/launch/andino_control.launch.py @@ -54,7 +54,12 @@ def generate_launch_description(): executable="ros2_control_node", parameters=[{'robot_description': ParameterValue(robot_description, value_type=str)}, controller_params_file], - + remappings=[ + ('/diff_controller/cmd_vel', '/cmd_vel'), # Used use_stamped_vel param is true + ('/diff_controller/cmd_vel_unstamped', '/cmd_vel'), # Used if use_stamped_vel param is false + ('/diff_controller/cmd_vel_out', '/cmd_vel_out'), # Used if publish_limited_velocity param is true + ('/diff_controller/odom', '/odom'), + ], output="both", ) From d8777a87c7d2c5d1ae1824648760fbe72a3d6d68 Mon Sep 17 00:00:00 2001 From: Franco Cipollone Date: Tue, 13 Feb 2024 09:31:11 -0300 Subject: [PATCH 2/2] Addresses Javi's comments Signed-off-by: Franco Cipollone --- README.md | 2 +- andino_control/launch/andino_control.launch.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 76c5ff1a..68c0bcff 100644 --- a/README.md +++ b/README.md @@ -146,7 +146,7 @@ Launch files for using the keyboard or a joystick for teleoperating the robot ar ``` ros2 launch andino_bringup teleop_keyboard.launch.py ``` -This is similarly to just call `ros2 run teleop_twist_keyboard teleop_twist_keyboard` +This is similarly to just executing `ros2 run teleop_twist_keyboard teleop_twist_keyboard`. #### Joystick diff --git a/andino_control/launch/andino_control.launch.py b/andino_control/launch/andino_control.launch.py index 2cff2710..d4d78f3f 100644 --- a/andino_control/launch/andino_control.launch.py +++ b/andino_control/launch/andino_control.launch.py @@ -55,7 +55,7 @@ def generate_launch_description(): parameters=[{'robot_description': ParameterValue(robot_description, value_type=str)}, controller_params_file], remappings=[ - ('/diff_controller/cmd_vel', '/cmd_vel'), # Used use_stamped_vel param is true + ('/diff_controller/cmd_vel', '/cmd_vel'), # Used if use_stamped_vel param is true ('/diff_controller/cmd_vel_unstamped', '/cmd_vel'), # Used if use_stamped_vel param is false ('/diff_controller/cmd_vel_out', '/cmd_vel_out'), # Used if publish_limited_velocity param is true ('/diff_controller/odom', '/odom'),