ROS2 Basics Real Robot Project part1: problems running keyboard teleop

Hi i was doing the ROS2 Basics Real Robot Project part1 as instructed in the course. However when i wanted to run the keyboard teleop program i ran into some issues. The command given to run were:
1)source ros2_ws/install/setup.bash
2)export TURTLEBOT3_MODEL=burger
3)ros2 run turtlebot3_teleop teleop_keyboard

However this were the issues:
1)ROS_DISTRO was set to ‘foxy’ before. Please make sure that the environment does not mix paths from different distributions.
ROS_DISTRO was set to ‘noetic’ before. Please make sure that the environment does not mix paths from different distributions.
not found: “/home/user/ros2_ws/install/turtlebot3_node/share/turtlebot3_node/local_setup.bash”

3)Traceback (most recent call last):
File “/home/user/ros2_ws/install/turtlebot3_teleop/lib/turtlebot3_teleop/teleop_keyboard”, line 33, in
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 ROS 2 workspace after your ROS 1 workspace.

I hope someone could be of any help. Thank you in advance!

Hi,

What you need to do is to source first ROS noetic and then ROS foxy, before running the ros1_brige on the same terminal:

source /opt/ros/noetic/setup.bash
source /opt/ros/foxy/setup.bash
ros2 run ros1_bidge dynamic_bridge --bridge-all-topics

And then you can try running the turtlebot teleop.

We also have implemented the first version of a joystick, which is running the teleop with ROS2 at startup, so you can also try that. Let me know if you have problems with it.

1 Like

Hi, thank you so much for replying. I have done the following starting from the begining.

terminal 1)I have started the simulation:
source /opt/ros/noetic/setup.bash
source ~/simulation_ws/devel/setup.bash
roslaunch realrobotlab main.launch

terminal 2)started ros bridge
source /opt/ros/noetic/setup.bash
source /opt/ros/foxy/setup.bash
ros2 run ros1_bridge dynamic_bridge --bridge-all-topics

terminal 3)run the teleop keyboard
source ros2_ws/install/setup.bash
export TURTLEBOT3_MODEL=burger
ros2 run turtlebot3_teleop teleop_keyboard

However when executing number 3 I still have the same issues. Is there anything wrong in the way I am doing it. when running the 3rd command of terminal 3, I seem to have this error not found: “/home/user/ros2_ws/install/turtlebot3_node/share/turtlebot3_node/local_setup.bash”

I can seem to find this source file in the ros2_ws under turtlebot3_node.

Sorry for any inconvenience. I’m really new here so I am a little lost.

1 Like

turtlebot3 is not in the ros2_ws like the instructions notebook says, so maybe the rosject has been changed but the instructions have not been updated. The turtlebot3_teleop code all seems to be in the simulation_ws, not the ros2_ws.

I’m also having the same problem. I tried running the turtlebot3_teleop from simulation_ws but that also didn’t work. I need help to operate the keyboard.

Hi,

One thing you can do is to launch teleop from ROS1. Then, once you’ve moved the robot in the simulation in a convenient location, you can use your programs in ROS2. In a new terminal:

source /opt/ros/noetic/setup.bash
source simulation_ws/devel/setup.bash
roslaunch turtlebot3_teleop turtlebot3_teleop_key.launch

This worked. Thanks @roalgoal.

I hope the maintainers update that part of the notebook.