Skip to content
Snippets Groups Projects
Commit 53b0f83f authored by Idril-Tadzio Geer Cousté's avatar Idril-Tadzio Geer Cousté
Browse files

commented the csv generator bash script

parent bacff651
No related branches found
No related tags found
No related merge requests found
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment