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

Running mulitple nodes from a Bash file

asked 2017-01-26 05:07:08 -0500

ashwath1993 gravatar image

updated 2017-01-26 05:08:17 -0500

I have single C++ code which gets the node name from the arguments passed to the main function. This is so that I can use the same code to run multiple nodes.
Is there a way to run multiple nodes in a single script file? Where the name of node is assigned when the main is executed?

rosrun machine sensors sens1 1

This needs to be run for different inputs on different terminals. I tried using a single .sh file, but until the first node exits, the next one isn't started. Is there a way to bypass this issue such that I can run multiple nodes using a single script on multiple terminals?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2017-01-26 05:34:58 -0500

gvdhoorn gravatar image

I think you'll want to look at roslaunch.

See Clearpath Robotics - ROS Tutorials - Launch Files for a starter tutorial.

PS: have you done the ROS tutorials on the wiki?

edit flag offensive delete link more

Comments

I have seen roslaunch from the tutorials. But in my case, I am entering the node name at runtime, can i adapt that to roslaunch?

ashwath1993 gravatar image ashwath1993  ( 2017-01-26 07:58:39 -0500 )edit

Thank you, I created a launch file with parameters to run the nodes as suggested in the starter tutorial!

ashwath1993 gravatar image ashwath1993  ( 2017-02-01 07:51:35 -0500 )edit

Question Tools

1 follower

Stats

Asked: 2017-01-26 05:07:08 -0500

Seen: 1,213 times

Last updated: Jan 26 '17