To launch all together you have simply to include all the launch files into a single launch file. (Take a look to this ).
Regarding the rosbag check this answer, the xml syntax for rosbag record -a
is: <node pkg="rosbag" type="record" name="recorder" output="screen" args="-a"/>
(in "args" you can put all the arguments for that command)
So the whole launch file to launch all you need is:
<launch>
<include file="$(find turtlebot_gazebo)/launch/turtlebot_world.launch"/>
<include file="$(find turtlebot_gazebo)/launch/gmapping_demo.launch"/>
<include file="$(find turtlebot_rviz_launchers)/launch/view_robot.launch"/>
<include file="$(find turtlebot_teleop)/launch/keyboard_t.launch"/>
<!--
The rosbag will be saved in the ~./ros folder
-->
<node pkg="rosbag" type="record" name="recorder" output="screen" args="-a"/>
</launch>
Now you can launch it from the terminal as a normal launch file.
Originally posted by Caba with karma: 113 on 2016-07-08
This answer was ACCEPTED on the original site
Post score: 6
Original comments
Comment by Morefoam on 2016-07-08:
This was a more helpful answer than I expected! Thanks for the links as well as the xml example! :)
Comment by Morefoam on 2016-07-08:
One more question: I need to somehow link my launch file to somewhere so that I don't have to be in the launch directory to launch it. I believe I learned how to do this in the tutorials, but as I'm searching through them again I don't see it. I'm gonna keep looking, but help would be appreciated.
Comment by Caba on 2016-07-08:
You can launch it from whatever folder you are in, just type:
roslaunch <name_package> file.launch
If you use roslaunch file.launch
you have to be in the launch folder of the package.
I am not completely understing your question, is this what you mean?
Comment by Morefoam on 2016-07-08:
I figured it out. Thanks for the help. I have another question, though. Is there a way to make the bag file save to a specified folder? How do I change "" to make it save to a specified location?
Comment by Caba on 2016-07-09:
<arg name="FOLDER" default="/home/nicola/test/"/> <node pkg="rosbag" type="record" name="recorder" output="screen" args="-a -o $(arg FOLDER)"/>
Comment by Caba on 2016-07-09:
The "arg" stuff is like creating a variable. When you launch the file you can pass the name of the folder as parameter (roslaunch name_package launnch_file FOLDER:=new_folder) otherwise it will use the one specified in the default tag. See here for more opts