updated code for robot_control_class.py shows error in get_odom
In the course “Python 3 for Robotics” chapter 6 maze, I updated the code for the robot_control_class.py 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()
print(dist_front)
rc.rotate(10)
rc.stop_robot()
terminal output
After about 30s I hit Ctrl+C and get following terminal output:
Traceback (most recent call last): File “move_maze.py”, line 72, in
rc.rotate(10)
File “/home/user/catkin_ws/src/robot_control/robot_control_class.py”, line 195, in rotate
(position, rotation) = self.get_odom()
File “/home/user/catkin_ws/src/robot_control/robot_control_class.py”, line 175, in get_odom
self.tf_listener.waitForTransform(
File “/opt/ros/noetic/lib/python3/dist-packages/tf/listener.py”, 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/buffer.py”, line 123, in can_transform
r.sleep()
File “/opt/ros/noetic/lib/python3/dist-packages/rospy/timer.py”, line 103, in sleep
sleep(self._remaining(curr_time))
File “/opt/ros/noetic/lib/python3/dist-packages/rospy/timer.py”, 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 robot_control_class.py ?