These are my directories and files organization/names.
DISCLAIMER!!
I am not talking about if the logic of my code is correct, i.e., my wall_following.py is correct. I’m just unable to run it, so I can’t even see if it is right or wrong.
wall_following.py
# scrubbed
Setup.py
from setuptools import setup
import os
from glob import glob
package_name = 'wall_follower'
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']),
(os.path.join('share', package_name), glob('launch/*.launch.py'))
],
install_requires=['setuptools'],
zip_safe=True,
maintainer='user',
maintainer_email='jfgueiross@gmail.com',
description='ROS 2 package for wall following behavior',
license='TODO: License declaration',
tests_require=['pytest'],
entry_points={
'console_scripts': [
'wall_following_node = wall_follower.wall_following:main', # Adjust the executable name and module
],
},
)
start_wall_following_launch.py
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
return LaunchDescription([
Node(
package='wall_follower',
executable='wall_following.py',
output='screen'
)
])
Commands I’m running in order to execute the file:
cd ~/ros2_ws
colcon build --packages-select wall_follower
source ~/ros2_ws/install/setup.bash
ros2 launch wall_follower start_wall_following.launch.py
Also, I made sure to make the script executable:
chmod +x wall_following.py
I also closed the teleop program!
Error Message
[INFO] [launch]: All log files can be found below /home/user/.ros/log/2023-11-17-03-29-15-739309-3_xterm-18744
[INFO] [launch]: Default logging verbosity is set to INFO
Task exception was never retrieved
future: <Task finished name=‘Task-2’coro=<LaunchService._process_one_event() done, defined at /opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py:226> exception=SubstitutionFailure("executable ‘wall_following.py’ not found on the libexec directory ‘/home/user/ros2_ws/install/wall_follower/lib/wall_follower’ ")>
Traceback (most recent call last):
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py”, line 228, in _process_one_event
await self.__process_event(next_event)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_service.py”, line 248, in __process_event
visit_all_entities_and_collect_futures(entity, self.__context))
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py”, line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py”, line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py”, line 45, in visit_all_entities_and_collect_futures
futures_to_return += visit_all_entities_and_collect_futures(sub_entity, context)
[Previous line repeated 1 more time]
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/visit_all_entities_and_collect_futures_impl.py”, line 38, in visit_all_entities_and_collect_futures
sub_entities = entity.visit(context)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/action.py”, line108, in visit
return self.execute(context)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/actions/node.py”, line 431, in execute
ret = super().execute(context)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py”, line 823, in execute
self.__expand_substitutions(context)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py”, line 668, in __expand_substitutions
cmd = [perform_substitutions(context, x) for x in self.__cmd]
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/actions/execute_process.py”, line 668, in
cmd = [perform_substitutions(context, x) for x in self.__cmd]
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py”, line 26, inperform_substitutions
return ‘’.join([context.perform_substitution(sub) for sub in subs])
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/utilities/perform_substitutions_impl.py”, line 26, in
return ‘’.join([context.perform_substitution(sub) for sub in subs])
File “/opt/ros/foxy/lib/python3.8/site-packages/launch/launch_context.py”, line 197, in perform_substitution
return substitution.perform(self)
File “/opt/ros/foxy/lib/python3.8/site-packages/launch_ros/substitutions/executable_in_package.py”, line 84,in perform
raise SubstitutionFailure(
launch.substitutions.substitution_failure.SubstitutionFailure: executable’wall_following.py’ not found on thelibexec directory ‘/home/user/ros2_ws/install/wall_follower/lib/wall_follower’
If anyone could please help, it would be super appreciated.
Thanks!!