ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
2

robot_upstart -- deleting or replacing a service

asked 2021-01-19 19:57:03 -0500

Unproductive gravatar image

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.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2021-01-20 09:39:39 -0500

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.

edit flag offensive delete link more

Comments

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?

dave gravatar image dave  ( 2021-10-18 08:45:01 -0500 )edit

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.

maxsvetlik gravatar image maxsvetlik  ( 2021-11-01 00:22:59 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2021-01-19 19:57:03 -0500

Seen: 1,401 times

Last updated: Jan 20 '21