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

How to automate the launching procedure of ROS nodes

asked 2014-05-06 02:05:12 -0500

RB gravatar image

updated 2014-05-06 05:09:44 -0500


I am interested in automating the commands that I have to type in separate new terminals to launch various nodes.

step:1.sudo su /root/fuerte_workspace

step:3.source /root/fuerte_workspace/

Above three steps need to be repeated every time when I launch new terminals(ctrl+alt+t). with following commands

command:1 roscore

command:2 roslaunch move_base.launch

command:3 rosrun rviz rviz

to launch command4, I need to go to /opt/ros/fuerte/stacks/yujin_cmd_vel_mux

command:4 roslaunch cmd_vel_mux standalone.launch

Procedure One: Through shell script I have written a sample directly executable shell script. but it is not working properly and following error occurs in the new terminal when roscore tries to initialize.

Script ERROR.jpg

Procedure Two: Through include tag in one launch file. But I don't know how to incorporate rosrun commands inside a launch file.

edit retag flag offensive close merge delete



step1: why do you need superuser privileges to run ros nodes?

Procópio gravatar image Procópio  ( 2014-05-06 02:27:12 -0500 )edit

1 Answer

Sort by » oldest newest most voted

answered 2014-05-06 02:26:52 -0500

Procópio gravatar image

updated 2014-05-06 03:45:55 -0500

step 2 and 3: you can add the line "source /root/fuerte_workspace/" in your ".bashrc", located in your /home folder, so every time you launch a terminal, that command is executed:

cd ~
gedit .bashrc

than add the line source /root/fuerte_workspace/ in the end of that file, save and open a new terminal to test.

command 1: you do not need to run roscore when using a launch file, it runs it automatically.

command 3: you can add rviz as a node in your launch file, adding this line to it:

<node pkg="rviz" type="rviz" name="rviz" />

command 4: if you have sourced ros path properly, you do not need to go to that specific folder to run command 4.

edit flag offensive delete link more


I am not very comfortable with ubuntu. My bash.bashrc is inside /etc. Can specifically tell where to add that particular line.. As you said rviz can be added as a node How to do that?? Thanks for quick reply..

RB gravatar image RB  ( 2014-05-06 03:08:15 -0500 )edit

In the `.bashrc` in your home (not in /etc). For adding a node to a launch check out almost any roslaunch example.

dornhege gravatar image dornhege  ( 2014-05-06 03:42:37 -0500 )edit

bash: /root/fuerte_workspace/ Permission denied........................................... When I open new terminal..

RB gravatar image RB  ( 2014-05-06 05:02:53 -0500 )edit

you should not have created your fuerte workspace on the /root dir. It is more usual to create it in your home folder (where you get with a cd ~). I recommend moving it or deleting and creating a new one.

Procópio gravatar image Procópio  ( 2014-05-06 05:24:41 -0500 )edit

Ok, that is the last option...But there must be some other way to solve this issue..

RB gravatar image RB  ( 2014-05-06 06:58:27 -0500 )edit

I would HIGHLY recommend that as the FIRST option. A ROS workspace should be in user space, not for root. You're just gonna get in more trouble with that. Unless you have a good reason that you know you'll need to have that as root, don't.

dornhege gravatar image dornhege  ( 2014-05-06 23:28:41 -0500 )edit

Question Tools



Asked: 2014-05-06 02:05:12 -0500

Seen: 878 times

Last updated: May 06 '14