#We remove the bag before recording to avoid potential conflicts
rm recordings/trajectory_recording$yamlname.bag
#The roslaunch file takes several useful parameters. We can lower speed if we see that the processor isn't working at real time. The suffix allows us to record different bags every loop. The bag file has to be previously filtered. We disable rviz as we don't need to see anything.
#The following ifs distinguish between the 3 types of yaml files
if[[${yamlname:0:1}=='G']]
then
#We use rosbag info to extract the final timestamp of the bag. The csv generator below has problems with the trajectory message if we save more than one message, so this is done to save only the very last one.
tend=$(rosbag info -y-k end recordings/trajectory_recording$yamlname.bag)