Hi,
The rosject environment of the ROS basics c++ course seems to be messed up, the teleop_twist_keyboard does not launch.
I have tried the instruction in the course notebook and the solutions indicated here and here but to no avail.
Might be related to the PYTHONPATH?
ros2 run teleop_twist_keyboard teleop_twist_keyboard
Traceback (most recent call last):
File "/opt/ros/foxy/lib/teleop_twist_keyboard/teleop_twist_keyboard", line 11, in <module>
load_entry_point('teleop-twist-keyboard==2.3.2', 'console_scripts', 'teleop_twist_keyboard')()
File "/opt/ros/foxy/lib/python3.8/site-packages/teleop_twist_keyboard.py", line 138, in main
pub = node.create_publisher(geometry_msgs.msg.Twist, 'cmd_vel', 10)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/node.py", line 1140, in create_publisher
check_for_type_support(msg_type)
File "/opt/ros/foxy/lib/python3.8/site-packages/rclpy/type_support.py", line 20, in check_for_type_support
ts = msg_type.__class__._TYPE_SUPPORT
AttributeError: type object 'type' has no attribute '_TYPE_SUPPORT' This might be a ROS 1 message type but it should be a ROS 2 message type. Make sure to source your ROS 2 workspace after your ROS 1 workspace.
The simulation of Turtlebot3 runs on ROS1, but your programs will run on ROS2. Hence, you will need to launch also the ros1_bridge program to allow communication between them.
while I am clearly starting a ros2 simulation? Maybe I am missing something here, but please clarify the instructions in the notebook.
Yes, you need to have ROS Bridge running in order to communicate with the robot for the teleop movements.
So this is what you do:
First, start (launch) the simulation in a terminal, if you are using a simulation. Otherwise you can skip this step.
Terminal 1: source ROS1, source ROS2, start ROS bridge and leave this terminal running (don’t close).
Terminal 2: start ROS2 version of teleop keyboard, and use this terminal to control the robot.
Hi @girishkumar.kannan,
Thank you for your response.
If do exactly what you ask me to do (I’m running the simulation) I get an “Failed to contact master…” error.
Here’s what I do:
Shell 1:
For anyone else coming across this:
I checked the python course for change and there the note is correct: The simulation is running in ros2, only the real robot needs the rosbridge.
Also the keyboard_teleop node works, if I don’t source anything in a new terminal. As soon as I source the setup in the ros2_ws/install it does not work anymore. So the instructions in the notebook are wrong here.
The setup seems to first source ROS1 noetic and then ROS2 foxy (I assume for the rosbridge for the real robot) and that seems to mess with the keyboard_teleop node.