Maze project, shows error in get_odom

updated code for shows error in get_odom

In the course “Python 3 for Robotics” chapter 6 maze, I updated the code for the class, which contains the new rotate() method.

VSCode indicates an error in get_odom as shown in below screenshot.

minimal example failing

Running the following minimal example

  • can print output from rc.get_front_laser()
  • gets stuck at rc.rotate(10)

from robot_control_class import RobotControl
rc = RobotControl()
dist_front = rc.get_front_laser()

terminal output

After about 30s I hit Ctrl+C and get following terminal output:

Traceback (most recent call last): File “”, line 72, in
File “/home/user/catkin_ws/src/robot_control/”, line 195, in rotate
(position, rotation) = self.get_odom()
File “/home/user/catkin_ws/src/robot_control/”, line 175, in get_odom
File “/opt/ros/noetic/lib/python3/dist-packages/tf/”, line 74, in waitForTransform
can_transform, error_msg = self._buffer.can_transform(strip_leading_slash(target_frame), strip_leading_slash(source_f
rame), time, timeout, return_debug_tuple=True)
File “/opt/ros/noetic/lib/python3/dist-packages/tf2_ros/”, line 123, in can_transform
File “/opt/ros/noetic/lib/python3/dist-packages/rospy/”, line 103, in sleep
File “/opt/ros/noetic/lib/python3/dist-packages/rospy/”, line 165, in sleep
raise rospy.exceptions.ROSInterruptException(“ROS shutdown request”)
rospy.exceptions.ROSInterruptException: ROS shutdown request

did I miss something?

Is there a updated version of ?

cc: @albertoezquerro

Any hint how to proceed?

I would love to guide Donatello out of the maze :blush:

Hello @fadri.pestalozzi,

when you hit the keyboard interrupt key (this is, when you hit Ctrl +C ) to a running Python program it will raise a KeyboardInterrupt exception by default. The error messages that you see are not error messages of the program itself but error messages that Python produces because it does not know what to do with the KeyboardInterrupt exception it raised. You can, if you want, just ignore these error messages since they appear only after you close the program. However, if you want to be able to close the program without these error messages showing then you must handle the KeyboardInterrupt exception.

To do so you can put your code inside a try , except block like shown here:

    rc = RobotControl()
        rc = RobotControl()
        dist_front = rc.get_front_laser()

    except rospy.ROSInterruptException:

Hope this helps.


Thanks Roberto, this solved my issue :blush: