0
$\begingroup$

Rosanswers logo

Hi,

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

step:1.sudo su

step:2.cd /root/fuerte_workspace

step:3.source /root/fuerte_workspace/setup.sh

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.


Originally posted by RB on ROS Answers with karma: 229 on 2014-05-06

Post score: 1


Original comments

Comment by Procópio on 2014-05-06:
step1: why do you need superuser privileges to run ros nodes?

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

step 2 and 3: you can add the line "source /root/fuerte_workspace/setup.sh" 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/setup.sh 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.


Originally posted by Procópio with karma: 4402 on 2014-05-06

This answer was ACCEPTED on the original site

Post score: 3


Original comments

Comment by RB on 2014-05-06:
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..

Comment by dornhege on 2014-05-06:
In the .bashrc in your home (not in /etc). For adding a node to a launch check out almost any roslaunch example.

Comment by RB on 2014-05-06:
bash: /root/fuerte_workspace/setup.sh: Permission denied........................................... When I open new terminal..

Comment by Procópio on 2014-05-06:
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.

Comment by RB on 2014-05-06:
Ok, that is the last option...But there must be some other way to solve this issue..

Comment by dornhege on 2014-05-06:
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.

$\endgroup$

Your Answer

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