#!/bin/bash

rm ../config/master.cfg
ln ../config/stereo_bw_master.cfg ../config/master.cfg



PREFIX=$1
IM_DIR_NAME="${PREFIX}$(date +%Y%m%d)"

IM_DIR_PATH="./images/"
#IM_DIR_PATH="/media/disk-3/"


IM_PATH=$IM_DIR_PATH$IM_DIR_NAME

export IM_PATH

mkdir -p $IM_PATH

#add a route for multicast traffic and set the TTL
 export LCM_DEFAULT_URL=udpm://239.255.76.67:7667?ttl=1
 sudo route add -net 239.255.0.0/16 dev eth0

#run lcm-spy to configure local environment variables
lcm-spy


#run camunits
#/home/ginglis/Desktop/camunits-0.2.1/camview/camview --chain bw_chain.xml&
#/home/ginglis/Desktop/camunits-0.2.1/camview/camview --chain color_chain.xml&


#make the directory for the color images
echo "making new image directory: ${IM_PATH}/color"
mkdir -p $IM_PATH/color

#make the directory for the bw images
echo "making new image directory: ${IM_PATH}/bw"
mkdir -p $IM_PATH/bw

#run the driver, 
./prosilica -k sensor.color --publish true -d ${IM_PATH}/color  --strftime cIMG-%Y%m%d-%H%M%S-%i-%f.tif -l &

./prosilica -k sensor.mono --publish true -d ${IM_PATH}/bw  --strftime IMG-%Y%m%d-%H%M%S-%i-%f.tif -l &



