I am getting attribute error

I am in Linux for robotics Unit 3 Advanced Utilities, i was running the code rosrun move_bb8_pkg move_bb8_square.py. i am getting this attribute error

user:~/catkin_ws/src/linux_course_files/move_bb8_pkg/my_scripts$ rosrun move_bb8_pkg move_bb8_square.pyTraceback (most recent call last): File “/home/user/catkin_ws/src/linux_course_files/move_bb8_pkg/my_scripts/move_bb8_square.py”, line 65, in movebb8_object = MoveBB8()
File “/home/user/catkin_ws/src/linux_course_files/move_bb8_pkg/my_scripts/move_bb8_square.py”, line 13, in init
AttributeError: ‘MoveBB8’ object has no attribute ‘shutdownhook’

I checked my file again several times to see if there is a mistake in code, but i copied the code correctly.

Not sure how you missed it, but there should be a method in your move_bb8_square.py file with the following content:

def shutdownhook(self):
  # works better than the rospy.is_shutdown()
  self.ctrl_c = True

Copy that into the file and you should be fine. There’s a similar file in src that you can copy from.

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.