[Bug] actions_quiz_msg.action error

This is an error report.


Screenshot of the error


Error details

So I am trying to do the quiz for Understanding ROS 2 Actions and I keep getting an error with 'Import Move' as seen in the screen shot. I am not sure what is going on but Im pretty sure I have my code correct in terms of having it be read correctly.

I can tell you right away that the people who can help you with this will not want pictures of the code. They’ll request it in this format:

image

paste your code within this:

image

Here is my code in the correct format where you can properly copy it and look through it. :slight_smile:

action_quiz_msg
This is the setup.py

# scrubbed

action_quiz_msg
This is the package.xml

# scrubbed

action_quiz_msg
This is the CMAKE

#scrubbed

Now this is for the action_quiz [NOT THE MSG]
setup.py

# scrubbbed

action_quiz
package.xml

# scrubbed

action_quiz
action_server.py

# scrubbed

When you see this kind of error in Python, it means the interpreter cannot locate the code you are trying to import.

For this specific case, it could be two things:

  • the directory structure of actions_quiz_msg is not correct. Please note that actions_quiz_msg should be a separate package, and should not be nested in actions_quiz.
  • actions_quiz_msg has not been properly built or sourced.

Please proceed as follows:

  • Ensure that actions_quiz_msg has been created as a separate package and has the right structure. Also check the actions_quiz package.
  • Have you compiled the packages successfully? If not, you should do:
    cd ~/ros2_ws
    rm -rf build/ install/ log/
    colcon build --packages-select actions_quiz_msg actions_quiz
    source install/setup.bash
    
    • If there’s any compilation issues, please ensure you have modified the setup files correctly.
  • Did you source the terminal before trying to launch the package?
    • In the same terminal where you are launching the package, run the following before launching it:
      cd ~/ros2_ws
      source install/setup.bash
      

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