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

How to write a shell script to start everything?

asked 2017-08-08 13:56:09 -0600

rozoalex gravatar image

updated 2021-11-14 09:34:22 -0600

lucasw gravatar image

I am very new to shell script. Is this possible to write a script basically starts for example gazebo, rviz and slam? I tried to execute command by python by you can only execute one at a time, executing next requires exiting the current one.

Thanks!

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
4

answered 2017-08-08 14:04:42 -0600

Blupon gravatar image

updated 2017-08-08 14:09:15 -0600

You can launch several nodes using a unique launch file.

For example, this is a launch file that can launch rtabmap_ros, hector_mapping, rviz and other things.

Notice the parts that start with <node (...) > and end with </node> : those mark the limits between the start of the different nodes.

Check here for an answer to a similar question :-).

edit flag offensive delete link more

Comments

1

Also, check out the tips for larger projects. This is a far better way to go than using shell scripts. They have their place, but launch files are far more powerful in this context.

jayess gravatar image jayess  ( 2017-08-08 14:44:46 -0600 )edit
0

answered 2021-11-11 07:20:04 -0600

AlexandrosNic gravatar image
  1. Create a [shell script].sh file and write there your "roslaunch [package] [launch file] command"
  2. If you want to add multiple launch files then you can separate them with "&" and "sleep x" (where x is the seconds to sleep between the launch files).
  3. Make the [shell script].sh file executable by using chmod u+x
  4. Run the script file with ./[shell script].sh in the terminal
edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2017-08-08 13:56:09 -0600

Seen: 2,538 times

Last updated: Nov 11 '21