0
$\begingroup$

Rosanswers logo

Hi,

I would like to be able to run a bash script using ros2 run <my package> <my shell script>. I have added the shell script (estop_nogui.sh) to the setup.py of the package (it's a Python package) as follows:

entry_points={
    'console_scripts': [
        'spot_ros2 = spot_driver.spot_ros2:main',
        'spot_commander = spot_driver.spot_commander:main',
        'estop_gui = spot_driver.estop_gui:main',
    ],
},
scripts = [
    'scripts/estop_nogui.sh',
],

This results in the file installed at install/spot_driver/lib/spot_driver/. It's an executable file but ros2 run can't find it. What else do I need to do for this?

Thanks!

-Jenny


Originally posted by jbarry on ROS Answers with karma: 280 on 2023-01-05

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Turns out I had two problems:

  1. I had built in the wrong directory. Once I built in the correct directory ros2 run was able to find the script.

  2. Once ros2 run did find it I get an "Exec format error" because I was missing #! /bin/bash at the top of the script.

With these two fixes, this is working!


Originally posted by jbarry with karma: 280 on 2023-01-05

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$