#!/bin/bash

pid=0

function finalize(){
    #exec kill '-15' $pid
    exec kill '-9' $pid
    exit
}

trap finalize TERM INT


export CLASSPATH=$CLASSPATH:../class:../class/*:../class/lib/*


export DGP_PATH=../
export ROS_MASTER_URI=http://127.0.0.1:11311
export ROS_IP=127.0.0.1

java org.EZMoBots.GDGP.Gui.Gui $@&

pid=$!
sleep 2
ret=$(ps '-p' $pid '-o' 'comm=')
while [ "$ret" == "java" ]
do
  sleep 2
  ret=$(ps '-p' $pid '-o' 'comm=')
done
