Unit 11 Step 4 ImportError: No module named exam_action_rec_odom.msg

Hello! I’d like to ask for your possible assistance in debugging my program. Right now, it produces one ImportError message. Since the package seems to be “default”, I can’t figure out why the programs produce it. Here is the message.

In Unit 11 Step 4:

rosrun my_sphero_main sphero_main.py (in Webshell#1) produces

ImportError: No module named exam_action_rec_odom.msg message

The error message disappears after commenting it out. However, this causes the program to get stuck on this message

[INFO] [1592124733.843028, 0.000000]: Waiting for Service Server

The module is not used anywhere in the previous steps. Does anyone know why this happens? Do I need to edit my CMakeLists.txt or package.xml?

Thank you for your time in advance.

Hi @is0486kr,

The problem is that you are trying to copy the default code as-is. It won’t work because they are there as pointers, not as a solution (otherwise there is no work to be done :stuck_out_tongue_winking_eye:).

In order to get things going, you need to create your own packages and custom messages and carefully adjust CMakeList.txt and package.xml accordingly.

If you want to copy anything from the code, you need to copy carefully and adjust names where necessary. In any case, you should avoid copying CMakeList.txt and package.xml.

PS: You don’t even have to use the exact code or logic suggested - just bring together all you have learnt in the previous units to solve this problem and create a solution that works.

Hi sir,

Although the program doesn’t produce any error messages anymore, the robot keeps hitting the maze…
I honestly have no ideas why this happens because my action file seems to be working (I’m using the one from my_sphero_actions) because it does produce these messages.

/rec_odom_as/cancel
/rec_odom_as/feedback
/rec_odom_as/goal
/rec_odom_as/result
/rec_odom_as/status

The robot still doesn’t work even after putting every python file into the main file…It has crash direction server and everything…
Please help me :pray:

Hi @is0486kr,

It’s expected that the robot will crash. The work here is to detect the crash and then move the robot in another direction (because the crash means no way in that direction). You keep doing this until the robot finds the opening! Yes, it’s trial and error and the robot will suffer a little :wink:.

Try to understand the objective of the project. Then you can do it your own way or at least modify the sample code to your taste.

@simon.steinmann91 has a very novel solution for this. Simon, can you give some hints here?

My novel solution was for the turtlebot maze if I remember correctly. I did the sphero escape myself as well, but it essentially stops when detecting a crash, moving back a little bit, turning a little bit, and then moving forward again.

@is0486kr Try to understand how the code works. Add print() lines into the code, to check the functionality of the code while executing. Find out what does what, and where the problem might lie. This is how you truly learn :slight_smile:

1 Like