Hi, im getting this import error:
ImportError: No module named services_quiz.srv
The srv directory is there and i tried catkin_make plus sourcing thrice. When i call service server, it works fine but after when i call service client, it gives me import error.
This is how my move_bb8_custom_service_client.py looks in the beginning:
#! /usr/bin/env python
from services_quiz.srv import BB8CustomServiceMessage, BB8CustomServiceMessageRequest
rospy.init_node(‘service_client’) # Initialise a ROS node with the name service_client
rospy.wait_for_service(’/move_bb8_in_square_custom’) # Wait for the service client /move_bb8_in_circle_custom to be running
First of all, have you made the service message executable in the srv package with chmod +x message_file ?
If yes, can you try this in catkin_ws?
rm -rf build
yes, service message file is executable and tried catkin_make clean as well as rm -rf build and rebuilding and sourcing the package. Getting same import error.
Are all dependencies for message generation added in CMakeLists.txt and package.xml?
Same problem here
When I use rossservice list | grep BB8CustomServiceMessage, I see services_quiz/BB8CustomServiceMessage
I just got it to work by doing source devel/setup.bash in catkin_ws
i know it’s 5 months late, and idk if this will help anyone… but i was facing the same problem and spent nearly two hours trying to find it as well. I at least triple-confirmed that my CMakeLists.txt, package.xml and python files were 119% correct.
The problem for me was that catkin_make command was giving me this error from the terminal:
i’m quite certain this was due to some other packages in the src directory of the catkin workspace that had compilation errors(from previous exercises). So what i did was delete the problematic packages that gave errors(you can determine this by reading the full error message returned by catkin_make) and run catkin_make afterwards.
when invoking cmake does not fail, try doing rosrun again. It should work