TurtleBot2 not moving with teleop_twist_joy
Hello,
I am currently working on my TurtleBot2 on Ubuntu 22.04 and ROS2. I have set up everything and am now trying to move TurtleBot 2 with my Stadia Controller. I am using this ros2 launch teleop_twist_joy teleop-launch.py joy_config:='stadia'
command, and it proceeds to show me all needed information I have in my Stadia config but the TurtleBot wont move. I have checked the topic monitor and whenever I use the Controller it seems like it does write something into the /cmd_vel topic and the /joy topic but the TurtleBot wont move. I've also checked the /event/bumper topic in order to exclude that the TurtleBot2 is not connected properly. Can anyone help me out?
teleop_launch.py:
import os
from ament_index_python.packages import get_package_share_directory
import launch
import launch_ros.actions
def generate_launch_description():
joy_config = launch.substitutions.LaunchConfiguration('joy_config')
joy_dev = launch.substitutions.LaunchConfiguration('joy_dev')
config_filepath = launch.substitutions.LaunchConfiguration('config_filepath')
return launch.LaunchDescription([
launch.actions.DeclareLaunchArgument('joy_config', default_value='stadia'),
launch.actions.DeclareLaunchArgument('joy_dev', default_value='/dev/input/js0'),
launch.actions.DeclareLaunchArgument('config_filepath', default_value=[
launch.substitutions.TextSubstitution(text=os.path.join(
get_package_share_directory('teleop_twist_joy'), 'config', '')),
joy_config, launch.substitutions.TextSubstitution(text='.config.yaml')]),
launch_ros.actions.Node(
package='joy', executable='joy_node', name='joy_node',
parameters=[{
'dev': joy_dev,
'deadzone': 0.3,
'autorepeat_rate': 20.0,
}]),
launch_ros.actions.Node(
package='teleop_twist_joy', executable='teleop_node',
name='teleop_twist_joy_node', parameters=[config_filepath]),
])
stadia.config.yaml:
teleop_twist_joy_node:
ros__parameters:
axis_linear: # Left thumb stick vertical
x: 1
scale_linear:
x: 0.7
scale_linear_turbo:
x: 1.5
axis_angular: # Left thumb stick horizontal
yaw: 2
scale_angular:
yaw: 0.4
enable_button: 2 # Left trigger button
enable_turbo_button: 5 # Right trigger button
@gvdhoorn I saw that you have answered alot of questions about similar topics, could you help me out? Thank you in advance !
@ljaniec did you have this problem while working with the TurtleBot2 or do you know how to solve it?
@Djinn Doesn't TB2 use other topic than
/cmd_vel
? It was something withmux
in the name@ljaniec how do I change the topic from /cmd_vel to /cmd_vel_mux? Do I have to change it in the kobuki_node file?
Modify your launchfile with
remappings
, like here:talker_node = Node( package="demo_nodes_cpp", executable="talker", name="my_talker", remappings=[ ("chatter", "my_chatter") ] )
andlistener_node = Node( package="demo_nodes_py", executable="listener", remappings=[ ("chatter", "my_chatter") ] )
@ljaniec so Ive modified my launch file to this :
but the turtlebot still wont move. Ive also tried "cmd_vel_mux", but nothing was written into this topic when I was using the controller and looking at rqt.