Sphero Example code

I am extremely lost with the Sphero project. I have honestly just copy and pasted the code given in the example and end up with this error after trying to run the rec_odom_action_server.py. Does copy and pasting work for everyone else? I am pretty diligent about catkin_make and sourcing so that is definteily not the issure.

It seems to have a hard time finding the file that initiates OdomTopicReader() as an object.

user:~/catkin_ws$ rosrun my_sphero_actions rec_odom_action_server.py
Traceback (most recent call last):
File “/home/user/catkin_ws/src/my_sphero_actions/src/rec_odom_action_server.py”, line 7, in
from my_sphero_actions import OdomTopicReader
ImportError: cannot import name OdomTopicReader

Hi Matthew,

That error says it cannot find the class named OdomTopicReader…Please check the following:

  • Do you have a Python file named my_sphere_actions.py?
  • Is it located in a place where the file containing the code that imports it can access it (typically should be in the same directory)?
  • Do you have conflicting imports? This can also happen in Python if you are trying (not intentionally!) to do a recursive import.