0
$\begingroup$

Rosanswers logo

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?


Originally posted by ashwath1993 on ROS Answers with karma: 70 on 2017-01-26

Post score: 0

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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?


Originally posted by gvdhoorn with karma: 86574 on 2017-01-26

This answer was ACCEPTED on the original site

Post score: 1


Original comments

Comment by ashwath1993 on 2017-01-26:
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?

Comment by ashwath1993 on 2017-02-01:
Thank you, I created a launch file with parameters to run the nodes as suggested in the starter tutorial!

$\endgroup$

Your Answer

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