Robotics StackExchange | Archived questions

How can I run a ROS service when my app starts?

I have a C# application and I need to add a record and play function for the bag files. I was done creating the service client for these two functions. I can get the list of bag files on my local directory and was also able to play a selected bag file as well. However, I need to manually start the service on a terminal, because without doing so, I get an error that my service "/bag_server" is not available at ROS master.

running service for bag List:

ubuntu@test:~/rosbag/src$ rosrun service_pkg baglist.py
[INFO] [WallTime: 1570761469.491990] rosbag list provider started...

running service for rosbag playback

ubuntu@test:~/rosbag/src$ rosrun service_pkg baglist.py
[INFO] [WallTime: 1570761469.491990] rosbag playback started...

We also had an sdk where ROS is configured. I am quite thinking of adding a configuration on sdk but I am unsure where to start to. Any help would be highly appreciated.

Asked by ros.beginner on 2019-10-11 01:14:42 UTC

Comments

Answers

You should try to do that with a launch file. There you can automatically start multiple nodes and do some things (like play rosbag) in a certain order. Via the cmd roslaunch you start that launch-file which automatically starts the master.

Asked by occonni on 2019-10-11 03:02:00 UTC

Comments

Hi, thanks for your response. So after creating a launch file, I need to call this launch file through roslaunch for this to run?

Asked by ros.beginner on 2019-10-11 03:43:30 UTC