I’ve done exactly as per the instructions (copy pasted all commands), but the teleop gives following error:
Hi @JRTG ,
Try this (in the exact order) and let us know
cd ~
source /opt/ros/noetic/setup.bash
source /opt/ros/galactic/setup.bash
cd ~/ros2_ws
source install/setup.bash
export TURTLEBOT3_MODEL=burger
ros2 run turtlebot3_teleop teleop_keyboard
Thank you for your suggestion.
The ‘source /opt/ros/galactic/setup.bash’ fails as it is a Foxy Rosject (even though it was started from the “C++ in 5 Days Galactic” course).
So I tried by sourcing foxy instead, but it still fails.
I think the "not found: “/home/user/ros2_ws/install/turtlebot3_node/share/turtlebot3_node/local_setup.bash” " might be key but I have no clue how to fix it.
I tried a ‘colcon build’ in the “/home/user/ros2_ws/” directory but that didn’t change anything.
user:~$ cd ~
user:~$ source /opt/ros/noetic/setup.bash
ROS_DISTRO was set to 'foxy' before. Please make sure that the environment does not mix paths from different distributions.
user:~$ source /opt/ros/galactic/setup.bash
bash: /opt/ros/galactic/setup.bash: No such file or directory
user:~$ source /opt/ros/foxy/setup.bash
ROS_DISTRO was set to 'noetic' before. Please make sure that the environment does not mix paths from different distributions.
user:~$ cd ~/ros2_ws
user:~/ros2_ws$ source install/setup.bash
not found: "/home/user/ros2_ws/install/turtlebot3_node/share/turtlebot3_node/local_setup.bash"
user:~/ros2_ws$ export TURTLEBOT3_MODEL=burger
user:~/ros2_ws$ ros2 run turtlebot3_teleop teleop_keyboard
Traceback (most recent call last):
File "/home/user/ros2_ws/install/turtlebot3_teleop/lib/turtlebot3_teleop/teleop_keyboard", line 33, in <module>
sys.exit(load_entry_point('turtlebot3-teleop==2.1.1', 'console_scripts', 'teleop_keyboard')())
File "/home/user/ros2_ws/install/turtlebot3_teleop/lib/python3.8/site-packages/turtlebot3_teleop/script/teleop_keyboard.py", line 148, in main
pub = node.create_publisher(Twist, 'cmd_vel', qos)
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 ROS2 workspace after your ROS 1 workspace.
user:~/ros2_ws$
Hi @JRTG ,
Ok, I just realized you were on ROSDS environment. I thought you were on course environment.
Anyways, try these in order and let us know!
cd ~
source /opt/ros/noetic/setup.bash
source ~/simulation_ws/devel/setup.bash
rosrun turtlebot3_teleop turtlebot3_teleop_key
These lines are already mentioned in the ROSDS rosject notebook.
Regards,
Girish
This works, thank you very much!
@albertoezquerro I think this should be fixed in the instructions.
Regards,
Johan
Hi Important note here
I am doing the ROS2 humble in 5 days (C++) - your solution fixed an issue I had a few days the course project ROSDS has an error and I was unable to source the teleop_key successfully,
here is how it looks in the ROS2 ROSDS with C++ project
source ros2_ws/install/setup.bash
export TURTLEBOT3_MODEL=burger
ros2 run turtlebot3_teleop teleop_keyboard
This should be fixed in the course itself nobody addressed this since your replay in Nov22
, it will make future student’s life easier and they won’t need to look for the problem
Best Regards.