diff --git a/andino_bringup/config/joystick.yaml b/andino_bringup/config/joystick.yaml index 9f7604ea..bbb38564 100644 --- a/andino_bringup/config/joystick.yaml +++ b/andino_bringup/config/joystick.yaml @@ -25,3 +25,4 @@ teleop_node: enable_turbo_button: 5 require_enable_button: true + publish_stamped_twist: true diff --git a/andino_bringup/launch/teleop_joystick.launch.py b/andino_bringup/launch/teleop_joystick.launch.py index 22dfda2c..8b6cb76c 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', + default_value='/cmd_vel_stamped', 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 1139dcec..580f3b1f 100644 --- a/andino_bringup/launch/teleop_keyboard.launch.py +++ b/andino_bringup/launch/teleop_keyboard.launch.py @@ -29,8 +29,10 @@ # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. from launch import LaunchDescription + from launch_ros.actions import Node + def generate_launch_description(): teleop_node = Node( package='teleop_twist_keyboard', @@ -38,6 +40,8 @@ def generate_launch_description(): name='teleop_twist_keyboard_node', output='screen', prefix = 'xterm -e', + parameters=[{'stamped': True}], + remappings=[('/cmd_vel', 'cmd_vel_stamped')], ) return LaunchDescription([ diff --git a/andino_control/launch/andino_control.launch.py b/andino_control/launch/andino_control.launch.py index d4d78f3f..14b39e73 100644 --- a/andino_control/launch/andino_control.launch.py +++ b/andino_control/launch/andino_control.launch.py @@ -55,10 +55,9 @@ def generate_launch_description(): parameters=[{'robot_description': ParameterValue(robot_description, value_type=str)}, controller_params_file], remappings=[ - ('/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'), + ('/diff_controller/cmd_vel', 'cmd_vel_stamped'), + ('/diff_controller/cmd_vel_out', 'cmd_vel_out'), + ('/diff_controller/odom', 'odom'), ], output="both", ) @@ -83,10 +82,18 @@ def generate_launch_description(): ) ) + relay_node = Node( + package="topic_tools", + executable="relay_field", + name="cmd_vel_relay", + arguments=["cmd_vel", "cmd_vel_stamped", "geometry_msgs/TwistStamped", "{header: {stamp: {sec: 0, nanosec: 0}, frame_id: ''}, twist: m}", "--wait-for-start"], + ) + nodes = [ control_node, joint_state_broadcaster_spawner, delay_diff_drive_controller_spawner_after_joint_state_broadcaster_spawner, + relay_node, ] return LaunchDescription(nodes) diff --git a/andino_control/package.xml b/andino_control/package.xml index 799a23aa..7ac68cc9 100644 --- a/andino_control/package.xml +++ b/andino_control/package.xml @@ -18,6 +18,7 @@ diff_drive_controller joint_state_broadcaster ros2controlcli + topic_tools ament_cmake_clang_format