From 53b0f83fca1424da3d9584dd6d27267fd11e014f Mon Sep 17 00:00:00 2001 From: Idril Geer <igeer@iri.upc.edu> Date: Mon, 14 Feb 2022 10:10:57 +0100 Subject: [PATCH] commented the csv generator bash script --- bag/generate_trajectory_csv2.bash | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bag/generate_trajectory_csv2.bash b/bag/generate_trajectory_csv2.bash index 8679bcb..947c410 100644 --- a/bag/generate_trajectory_csv2.bash +++ b/bag/generate_trajectory_csv2.bash @@ -12,25 +12,35 @@ fi # Starting with G ==> groundtruth, we extract the trajectory # Starting with E ==> experiment, we extract the poses # Starting with T ==> experiment in 3D, we extract the poses + +# this array lists the timespans in which the KeyFrames will be created. For each timespan the three experiments will be executed timespanarray=("0.1" "0.2" "0.3" "0.5" "0.7" "1.0" "2.0" "5.0" "10.0") for time_span in "${timespanarray[@]}" do for yamlfile in $(find ../yaml/trajectory_analysys -maxdepth 1 -type f -printf "%f\n") do echo "working on $yamlfile" + #We manipulate the filename to format it as we want it yamlname=${yamlfile%.*} yamlname=$yamlname\-${time_span/./_} + #We use sed to make the necessary replacements in the yaml files algorithmically sed -i "s/.*min_time.*/ min_time: $time_span/" ../yaml/trajectory_analysys/parameters/test_laser_processor.yaml sed -i "s/.*profiling_file.*/ profiling_file: \"~\/profiling\/wolf_demo_profiling_$yamlname.txt\"/" ../yaml/trajectory_analysys/$yamlfile + #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. roslaunch wolf_demo_imu2d imu2d_analysys.launch bag:=$BAG\_filtered_notf test:=$yamlfile speed:=0.05 suffix:=$yamlname rviz:=false + #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) tend=${tend%.*} rosbag filter recordings/trajectory_recording$yamlname.bag recordings/trajectory_recording$yamlname\_tmp.bag "topic == '/wolf_ros_node/trajectory' and t.to_sec() >= $tend" + #The messages are saved to CSV and then transposed to work well with matlab rm CSV/$yamlname.csv rostopic echo -b recordings/trajectory_recording$yamlname\_tmp.bag /wolf_ros_node/trajectory -p > CSV/$yamlname.csv rm recordings/trajectory_recording$yamlname\_tmp.bag -- GitLab