For more context(not sure if these are relevant):
input: ~/ros2_ws$ ros2 pkg create --build-type ament_python publisher_pkg --dependencies rcply std_msgs geometry_msgs
output: [WARNING]: Unknown license ‘TODO: License declaration’. This has been set in the package.xml, but no LICENSE file has been created.
It is recommended to use one of the ament license identitifers:
Apache-2.0
BSL-1.0
BSD-2.0
BSD-2-Clause
BSD-3-Clause
GPL-3.0-only
LGPL-3.0-only
MIT
MIT-0
input: ~/ros2_ws$ colcon build --packages-select publisher_pkg
output: *Starting >>> publisher_pkg
— stderr: publisher_pkg
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning: setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
You are working on Subscriber and posting a Publisher output.
Anyways, your publisher program also has a problem.
Assuming you have copy-pasted the contents of launch file correctly and the program for simple_publisher, there are only two possible reasons you get this error.
You did not compile your program correctly using colcon build ... or you forgot to source your install folder.
It might be because of the SetuptoolsDeprecationWarning
If it is the second case then you must downgrade setuptools:
Issue the following command on terminal:
pip install setuptools==58.2.0
Once installed, rebuild your ROS2 package with colcon build .... Don’t forget to source install folder before launching the program / package.
My apologies, it was supposed to be a publisher in the title in place of subscriber. And coming back to the problem, I did compile the program correctly. The issue was with the simple_publisher.py file which was not created in the right folder. Once I put it where it belongs everything was fine.