I followed the whole instruction of lesson “6.4 Custom Service Messages” but when I did catkin_make I didn’t see this line: Generating Python code from SRV my_custom_srv_msg_pkg/MyCustomServiceMessage
But I see the created service among the rossrv list: my_custom_srv_msg_pkg/MyCustomServiceMessage
Furthermore, when I create Service Server that uses this type of message and try to run it with this command:
rosrun my_custom_srv_msg_pkg testCustemService.py
I will receive this error:
Traceback (most recent call last):
File “/home/user/catkin_ws/src/my_custom_srv_msg_pkg/scripts/testCustemService.py”, line 4, in
from my_custom_srv_msg_pkg.srv import MyCustomServiceMessage, MyCustomServiceMessageResponse # you import the service message python classes
ModuleNotFoundError: No module named ‘my_custom_srv_msg_pkg’
Hi @shili, you can try forcing the custom service package recompilation by deleting the /build
and /devel
directories. You can also ensure you are compiling the custom message package by using the -DCATKIN_WHITELIST_PACKAGES
flag.
Then, make sure you source the workspace in the terminal you are running the server that uses your custom service:
cd ~/catkin_ws && rm -rf build/ devel/
catkin_make -DCATKIN_WHITELIST_PACKAGES="your_package_name"
source devel/setup.bash
1 Like
Thanks a lot @rodrigo55, the problem is solved by recompilation.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.