0
$\begingroup$

Rosanswers logo

HI All,

I have a legacy ROS system to work with...ie someone else put it together originally.

it runs kinetic on Ubuntu 16.04.

The system is kicked off at boot, and you can stop and start nodes using what I think are systemd commands... e.g. service realsense2 start service realsense2 stop

Since the files associated with those services indicate that they have been autogenerated (but not by what application), and robot_upstart packages are installed in ROS, I think that robot_upstart was used to configure this.

robot_upstart looks like a handy package, however the online documentation does not indicate how to modify the configuration of the service, and does not clearly state how to remove a service. Or at least I am not understanding it!

Is anyone here familiar with how to modify the launch configuration of the robot_upstart configured service?

I suspect that this is one of those things that is really simple once you know some piece of information -- and I'd really appreciate that tip from someone who knows!

Thanks for your help.


Originally posted by Unproductive on ROS Answers with karma: 41 on 2021-01-19

Post score: 2

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

robot_upstart can indeed be a helpful package, but due to the issues you encountered I've tended toward making my own systemd service files which gives me full control of how the services are crafted and brought up.

Anyway, to address your question:

To remove a service previously installed with robot_upstart :

$ rosrun robot_upstart uninstall NAME_OF_SERVICE

How to modify the launch file that is tied to that service depends on whether the service was initially created with the 'symbolic' flag, in which case you can modify the launch file at the package level (i.e. in your workspace). If you didn't use the symbolic flag, then the launch file was copied when robot_upstart created the service. This lives in /etc/ros/$ROS_DISTRO/NAME_OF_SERVICE.d/

And just for completeness sake, the service files that robot_upstart creates live in /etc/systemd/system/multi-user.target.wants/NAME_OF_SERVICE.service and /lib/systemd/system/NAME_OF_SERVICE.service. The commands you can run to start/stop the service are in /usr/sbin/ with the name NAME_OF_SERVICE-{start/stop}

I'm not sure how you want to "modify the configuration of the service" but I interpret that as a combination of modifying the launch file that's brought up and the service file(s) that bring up the launch file. I've never used robot_upstart to make modifications of the service itself, but instead have manually edited the *.service files to do what I want, i.e. bring the service up after networking, adding delays between services, etc.


Originally posted by maxsvetlik with karma: 161 on 2021-01-20

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by dave on 2021-10-18:
Hi there, You mention "adding delays between services". Do you mean by that, for example, to delay the starting of a launch file? Do you know how to do this with robot_upstart? Or does this require manual change of the *.service file?

Comment by maxsvetlik on 2021-11-01:
It may be possible to accomplish delays like that with robot_upstart but I haven't found a way. To accomplish the delays between services / launch files, I always edited the service files directly to choreograph the execution I wanted. This is most directly accomplished with the following snippets in the .service file.

[Service]
ExecStartPre=/bin/sleep 2

Which will sleep for 2 seconds before attempting to start the service. This can also be useful to use in conjunction with

[Unit]
Requires=ros_core.service
After=robot_base_drivers.service

for instance, which says to only start the service after robot_base_drivers is started, and that the ros_core service must be alive.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.