turtlebot / turtlebot4_setup

TurtleBot 4 setup tools and configuration files.
Apache License 2.0
18 stars 5 forks source link

Ability to set job name and launch file from argument in install.py #3

Closed jmm-slamcore closed 1 year ago

jmm-slamcore commented 1 year ago

It would be nice to be able to set the job name by passing in a command line argument when running the install.py script. This way you could have multiple services like turtlebot4_oakd or turtlebot4_realsense and enable/disable them depending on how you want the robot to boot up the next time.

To go with the above, it would also be practical to be able to manually specify the launch file to bring up. Both these features are possible with the command mentioned in this repo's readme:

ros2 run robot_upstart install turtlebot4_bringup/launch/standard.launch.py --job turtlebot4

But that seems to be slightly different to running the install.py script that is on the pi directly (as explained in the TurtleBot 4 docs - https://turtlebot.github.io/turtlebot4-user-manual/software/turtlebot4_packages.html#installing)? I haven't used the ros2 command above as I also want to retain the ability to set the rmw and ros domain id that is present in the install.py script.

jmm-slamcore commented 1 year ago

Just realised those arguments are available through the ROS2 command line (using the robot_upstart package directly) as well, for example:

ros2 run robot_upstart install turtlebot4_bringup/launch/standard.launch.py --job turtlebot4_test --ros_domain_id 12 --rmw rmw_fastrtps_cpp --setup /opt/ros/galactic/setup.bash

I imagine most users won't require this but some more documentation around installing/uninstalling jobs might be useful.

I tried uninstalling the test job using the uninstall script from this repo but the script will only uninstall a job called "turtlebot4" and doesn't allow a custom job name to be passed in. I also tried uninstalling using the robot_upstart package directly, which accepts a job name, but getting an error (not directly relevant to this repo/ticket but thought I'd share it anyway)

ubuntu@ubuntu:~$ ros2 run robot_upstart uninstall turtlebot4_test
Traceback (most recent call last):
  File "/opt/ros/galactic/lib/robot_upstart/scripts/uninstall", line 32, in <module>
    exit(main())
  File "/opt/ros/galactic/lib/python3.8/site-packages/robot_upstart/uninstall_script.py", line 47, in main
    j = robot_upstart.Job(name=args.jobname[0], rosdistro=args.rosdistro)
  File "/opt/ros/galactic/lib/python3.8/site-packages/robot_upstart/job.py", line 87, in __init__
    os.environ['CMAKE_PREFIX_PATH'].split(':')[0] + '/../setup.bash'
  File "/usr/lib/python3.8/os.py", line 675, in __getitem__
    raise KeyError(key) from None
KeyError: 'CMAKE_PREFIX_PATH'
roni-kreinin commented 1 year ago

@jmm-slamcore To fix that uninstall error, try export CMAKE_PREFIX_PATH=/opt/ros/galactic/cmake before running that command.

Regarding using different launch files and multiple jobs, I think that using the robot_upstart commands directly as you did is probably the better option. The install.py and uninstall.py scripts are really only meant for the default launch configurations. In the Humble release I am adding a CLI tool to replace a lot of the scripts that are currently used in Galactic, so I can look into adding some additional features for robot_upstart.

jmm-slamcore commented 1 year ago

Sounds good thanks!

I was able to mitigate the error by building robot_upstart from source but will try that next time.

Feel free to close this issue 👍