#!/bin/bash

# example: ./create_figures.sh  aces  mcl2
dataset=$1
method=$2

set -e # exit on error
set -o pipefail


source script_variables.sh


for algo_output in ${dataset}_chunks/${method}/???_go; do
	chunk_id=`basename ${algo_output} _go`

	chunk=${dataset}_chunks/${chunk_id}
	scans_used=${dataset}_chunks/${method}/${chunk_id}_sm.log
	
	echo "Creating PNGs"
	 ${fts_log2pdf} \
				-in ${log_slam} \
				-file_sb ${algo_output}  \
				-file_sm ${chunk} \
				-output_png 1  -out "${algo_output}-%03d.png" \
				-path_draw 0 -laser_countour_draw 1 -laser_countour_width 0.1 \
				-distance_xy 1 -dimension 500 -draw_caption 0 -laser_pose_draw 0



	echo "Creating PDF"
	${fts_log2pdf} \
			-in ${log_slam} \
			-file_sb ${algo_output}  \
			-file_sm ${chunk} \
			-out ${algo_output}.pdf	 \
			-path_draw 0 -laser_countour_draw 1 -laser_countour_width 0.1 \
			-distance_xy 1 -dimension 500 -draw_caption 1 -laser_pose_draw 0

	${log2pdf} -in ${scans_used}
	convert ${scans_used}.pdf -rotate '-90>' -resize "200"  ${scans_used}.png
done

# echo ${fts_log2pdf} \
# 		-in ${log_slam} \
# 		-file_sb ${algo_output}  \
# 		-file_sm ${chunk} \
# 		-out ${algo_output}.pdf	 \
# 		-path_draw 0 -laser_countour_draw 0 -distance_xy 1




