#!/bin/sh

dir=/media/enrico/Dati/workspace/scoop_demonstrations/wooden_block



for i in ${dir}/*.bag
do

	echo $i
	
	rosrun bag_sync bag_sync & bpid=$! 
	rosbag record /sync_joints /sync_franka /sync_force /cmd_gripper /motor_status -o scoop  /topic __name:=my_bag & pid=$! 
	rosbag play $i 
	
	kill -2 $bpid 	
	kill -2 $pid 
	rosnode kill /my_bag
	mv *.bag ${dir}
done
