For a bit of context, I am using Ubuntu 20.04 with ROS2 Foxy. I followed this tutorial : https://docs.ros.org/en/foxy/Tutorials/Beginner-Client-Libraries/Writing-A-Simple-Py-Service-And-Client.html
To recap everything I have done :
- open new terminal :
source /opt/ros/foxy/setup.bash
mkdir -p dev_ws/src
cd dev_ws/src
ros2 pkg create --build-type ament_python py_srvcli --dependencies rclpy example_interfaces
python py_srvcli --dependencies rclpy example_interfaces
going to create a new package
package name: py_srvcli
destination directory: /home/user/Stage_ros/test/dev_ws/src
package format: 3
version: 0.0.0
description: TODO: Package description
maintainer: ['user <[email protected]>']
licenses: ['TODO: License declaration']
build type: ament_python
dependencies: ['rclpy', 'example_interfaces']
creating folder ./py_srvcli
creating ./py_srvcli/package.xml
creating source folder
creating folder ./py_srvcli/py_srvcli
creating ./py_srvcli/setup.py
creating ./py_srvcli/setup.cfg
creating folder ./py_srvcli/resource
creating ./py_srvcli/resource/py_srvcli
creating ./py_srvcli/py_srvcli/__init__.py
creating folder ./py_srvcli/test
creating ./py_srvcli/test/test_copyright.py
creating ./py_srvcli/test/test_flake8.py
creating ./py_srvcli/test/test_pep257.py
cd .. (now i am in /dev_ws) :
rosdep install -i --from-path src --rosdistro foxy -y
#All required rosdeps installed successfully
colcon build --packages-select py_srvcli
Starting >>> py_srvcli
--- stderr: py_srvcli
listing git files failed - pretending there aren't any
---
Finished <<< py_srvcli [2.44s]
Summary: 1 package finished [2.89s]
1 package had stderr output: py_srvcli
My question is why is there an error with git meanwile I never used git anywhere in this tutorial ?
Furthemore, i then sourced the install directory :
. install/setup.bash
and ran :
ros2 run py_srvcli service
which then told me no executables found ... Am I missing something ?
EDIT : I have already added the entry points, here is my setup.py as it might help
from setuptools import setup
package_name = 'py_srvcli'
setup(
name=package_name,
version='0.0.0',
packages=[package_name],
data_files=[
('share/ament_index/resource_index/packages',
['resource/' + package_name]),
('share/' + package_name, ['package.xml']),
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='user',
maintainer_email='[email protected]',
description='TODO: Package description',
license='TODO: License declaration',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'service = py_srvcli.service_member_function:main',
'client = py_srvcli.client_member_function:main',
],
},
)
and finally, here is the tree from the dev_ws
Originally posted by Bastian2909 on ROS Answers with karma: 68 on 2022-06-27
Post score: 0
Original comments
Comment by harshal on 2022-06-27:
Few questions, none to answer your git query:
Have you created the service node as per the tutorial(2)?
If yes, have you added an entry point for the script (2.2)?
If yes, does the node run when instead of "ros2 run py_srvcli service" you type in "service" in the cli?
Comment by Bastian2909 on 2022-06-27:
Hello, first of all thank you for taking the time to read my question, I created the node folowing the tutorial and yes, I had already added the entry points (I added it in the edit of my post). However i'm not sure about what you mean by typing service in the cli ?
Comment by harshal on 2022-06-27:
I understand that you get "No executable found" when you enter "ros2 run py_srvcli service" in terminal.
What happens when you enter "service" in terminal?...so, type service and press enter.
Comment by Bastian2909 on 2022-06-27:
My appologies I didn't know this was a command. I types "service" and nothing happened, not even an error message. The terminal is still running the command but won't display anything so i had to use ctrl-C to stop it.
Comment by harshal on 2022-06-27:
No worries, and no, "service" is not the command that we refer to here. It is the name of the executable that you created (I am facing similar issue here. If you run "service", and then in a separate terminal run "ros2 service list", you should see the name of the service that you created. If yes, you could use the above workaround till you find better guidance in this regard.
Comment by gvdhoorn on 2022-06-27:
Please see colcon/colcon-core#518.
I believe that's the same issue reported.
Comment by Bastian2909 on 2022-06-29:
Thank you, that was exactly what i needed !