Unverified Commit 31971f1b authored by Juon Kawakami's avatar Juon Kawakami 🥗
Browse files

init

parent 342fea6f
#!/bin/bash
. $(dirname $0)/config.sh
for i in $CLUSTERS; do
SERVER=$(getServerHost $i)
RUNNING_TEAM=""
PRECOMPUTE=""
TURN="-"
eval $(ssh $REMOTE_USER@$SERVER cat $KERNELDIR/boot/$LOCKFILE_NAME 2>/dev/null)
if [ ! -z $RUNNING_TEAM ]; then
if [ "$PRECOMPUTE" == "yes" ]; then
echo " $i: $RUNNING_TEAM precomputing on $RUNNING_MAP"
else
STATDIR=$EVALDIR/$RUNNING_MAP/$RUNNING_TEAM
if [ -f $STATDIR/scores.txt ]; then
TURN=$(fgrep -o " " $STATDIR/scores.txt|wc -l)
fi
echo " $i: $RUNNING_TEAM running on $RUNNING_MAP (turn $TURN)"
fi
else
echo " $i: --- "
fi
done
#!/bin/bash
. $(dirname $0)/config.sh
for HOST in $HOSTS; do
echo "$HOST: "
rsync -rcLv $RSYNC_OPTS $1 $REMOTE_USER@$HOST:$2
done
#!/bin/bash
. $(dirname $0)/config.sh
for HOST in $CLIENT_HOSTS; do
echo "$HOST: "
rsync -rcLv $RSYNC_OPTS $1 $REMOTE_USER@$HOST:$2
done
#!/bin/bash
. $(dirname $0)/config.sh
for HOST in $SERVER_HOSTS; do
rsync -rcLv $RSYNC_OPTS $1 $REMOTE_USER@$HOST:$2
done
#!/bin/bash
. $(dirname $0)/config.sh
$(dirname $0)/"syncClients.sh" $LOCAL_HOMEDIR/$CODEDIR/ $CODEDIR
#/bin/sh "commandToClients.sh" "chmod -R 777 /home/code"
#! /bin/bash
. $(dirname $0)/config.sh
MAP=$1
cd $HOME/$EVALDIR
NUM_PROCESSED=0
for t in $TEAM_SHORTHANDS; do
NAME=${TEAM_NAMES[$t]}
logs=($MAP/*-$NAME-*.7z)
log=${logs[@]}
if [ -f $log ]; then
rsync -ave ssh $log $SOURCEFORGE_USER@frs.sf.net:/home/frs/project/roborescue/logs/$YEAR/$MAP/
if [ "$?" == 0 ]; then
NUM_PROCESSED=$((NUM_PROCESSED+1))
fi
else
echo "Logfile for $NAME not found or not unique: $log"
fi
done
echo "Uploaded $NUM_PROCESSED files"
#!/bin/bash
. $(dirname $0)/config.sh
$(dirname $0)/"syncKernels.sh" $LOCAL_HOMEDIR/$MAPDIR/ $MAPDIR
#! /bin/bash
RECORDS_DIR=~/records-logs
days="Day1 Day2 Semifinal Final"
maps="kobe-test vc1 joao1 berlin1 eindhoven1 mexico1 ny1 kobe1 sydney1 sakaei1 paris1 vc2 berlin2 eindhoven2 istanbul1 sf1 ny2 paris2 kobe2 montreal1 sf2 sydney2 berlin3 kobe3 sakae2 paris3"
for day in $days; do
for map in $maps; do
DAY_NAME=$day
MAP_NAME=$map
CURRENT=$(pwd)
cd $RECORDS_DIR/$DAY_NAME
pwd
for d in */ ;do
echo "-------- $d";
LAST_LOG=$(ls -1 $d$MAP_NAME* | tail -1)
arrIN=(${LAST_LOG//// })
LAST_LOG_NAME=${arrIN[1]}
ls $d$MAP_NAME* | grep -v $LAST_LOG_NAME | xargs -I % sh -c "echo %; rm %";
done
done
done
echo """
from christopher.models import *
Match.objects.all().delete()
print('Delete all match')
""" | /home/rescue/web-viewer/rcrs-web-viewer-server/.venv/bin/python /home/rescue/web-viewer/rcrs-web-viewer-server/manage.py shell
rm /home/rescue/web-viewer/rcrs-web-viewer-server/prepared_logs/*
/home/rescue/web-viewer/rcrs-web-viewer-server/.venv/bin/python /home/rescue/web-viewer/rcrs-web-viewer-server/manage.py prepare 1
#!/bin/bash
if [ ! $# -eq 3 ] ; then
echo "usage: `basename $0` <teamname> <hostname> <dir>"
exit 1
fi
. functions.sh
processArgs $*
TEAM_NAME=$1
HOSTNAME=$2
OUTDIR=$3
makeClasspath $BASEDIR/jars $BASEDIR/lib
java -Xmx512m -cp $CP -Dlog4j.log.dir=$LOGDIR rescuecore2.LaunchComponents sample.LiveLogExtractor -c $BASEDIR/config/viewer.cfg -h $HOSTNAME --viewer.team-name=$TEAM_NAME --viewer.output-dir=$OUTDIR
DIR=`pwd`
BASEDIR="`cd .. && pwd`"
PIDS=
# Wait for a regular expression to appear in a file.
# $1 is the log to check
# $2 is the regex to wait for
# $3 is the optional output frequency. Messages will be output every n sleeps. Default 1.
# $4 is the optional sleep time. Defaults to 1 second.
function waitFor {
SLEEP_TIME=1
FREQUENCY=1
if [ ! -z "$3" ]; then
FREQUENCY=$3
fi
if [ ! -z "$4" ]; then
SLEEP_TIME=$4
fi
F=$FREQUENCY
echo "Waiting for '$1' to exist..."
while [[ ! -e $1 ]]; do
if (( --F == 0 )); then
echo "Still waiting for '$1' to exist..."
F=$FREQUENCY
fi
sleep $SLEEP_TIME
done
echo "Waiting for '$2'..."
while [ -z "`grep \"$2\" \"$1\"`" ]; do
if (( --F == 0 )); then
echo "Still waiting for '$2'..."
F=$FREQUENCY
fi
sleep $SLEEP_TIME
done
}
# Make a classpath argument by looking in a directory of jar files.
# Positional parameters are the directories to look in
function makeClasspath {
RESULT="../."
while [[ ! -z "$1" ]]; do
for NEXT in $1/*.jar; do
RESULT="$RESULT:$NEXT"
done
shift
done
CP=${RESULT#:}
}
# Print the usage statement
function printUsage {
echo "Usage: $0 [scenario] [options]"
echo
echo "[scenario] Scenario directory including the map and config directories. Default: \"../maps/test\""
echo
echo "[options]"
echo "-m --map <mapdir> Set the map directory. Default: \"../maps/map\""
echo "-c --config <configdir> Set the config directory. Default: \"../maps/test/config\""
echo "-t --team <teamname> Set the team name. Default: \"\""
echo "-l --log <logdir> Set the log directory. Default: \"logs/log\""
echo "-s --timestamp Create a log sub-directory including timestamp, team name and map name"
echo "-g --nogui Disable GUI"
echo "-j --jlog Enable Jlog Recorder (startViewerEventLogger)"
echo "-r --jlog-dir <jlog_dir> Set Jlog Recorder log dir. Default: \"logs/jlog\""
echo "[+|-]x Enable/Disable XTerm use. Default: \"Disable\""
}
# Process command-line arguments
function processArgs {
LOGDIR="../logs/log"
RECORDSDIR="../logs/jlog"
MAP="$BASEDIR/maps/test/map"
CONFIGDIR="$BASEDIR/maps/test/config"
TEAM=""
TIMESTAMP_LOGS=""
NOGUI="no"
JLOG_RECORD="no"
XTERM="no"
while [[ ! -z "$1" ]]; do
case "$1" in
-m | --map)
MAP="$2"
shift 2
;;
-c | --config)
CONFIGDIR="$2"
shift 2
;;
-l | --log)
LOGDIR="$2"
shift 2
;;
-j | --jlog)
JLOG_RECORD="yes"
shift
;;
-r | --jlog-dir)
RECORDSDIR="$2"
shift 2
;;
-t | --team)
TEAM="$2"
shift 2
;;
-s | --timestamp)
TIMESTAMP_LOGS="yes"
shift
;;
-g | --nogui)
NOGUI="yes"
shift
;;
-x)
XTERM="no"
shift
;;
+x)
XTERM="yes"
shift
;;
-h | --help)
printUsage
exit 1
;;
*)
echo "Unrecognized option: $1"
printUsage
exit 1
;;
esac
done
# Check if the Map directory exists
if [ -z $MAP ] || [ ! -d $MAP ]; then
echo "Directory does not exist or does not have the \"map\" and \"config\" sub-directories"
exit 1
fi
# Append timestamp, team and map name to the log directory
if [ ! -z "$TIMESTAMP_LOGS" ]; then
TIME="`date +%Y%m%d-%H%M%S`"
# Extract map name
MAPNAME="`basename $MAP`"
if [ "$MAPNAME" == "map" ]; then
MAPNAME="$(basename $(dirname $MAP))"
fi
if [ -z "$TEAM" ]; then
LOGDIR="$LOGDIR/$TIME-$MAPNAME"
else
LOGDIR="$LOGDIR/$TIME-$TEAM-$MAPNAME"
fi
fi
if [ "$(uname -s)" = 'Linux' ]; then
LOGDIR=`readlink -f $LOGDIR`
fi
mkdir -p $LOGDIR
mkdir -p $RECORDSDIR
}
function execute {
title=$1
command=$2
if [[ $XTERM == "yes" ]]; then
xterm -T $title -e "$command 2>&1 | tee $LOGDIR/$title-out.log" &
else
sh -c "$command 2>&1 | tee $LOGDIR/$title-out.log" &
fi
PIDS="$PIDS $!"
}
# Start the kernel
function startKernel {
GUI_OPTION=""
if [[ $NOGUI == "yes" ]]; then
GUI_OPTION="--nogui"
fi
KERNEL_OPTIONS="-c $CONFIGDIR/kernel.cfg --gis.map.dir=$MAP --kernel.logname=$LOGDIR/rescue.log.7z $GUI_OPTION $*"
makeClasspath $BASEDIR/jars $BASEDIR/lib
execute kernel "java -Xmx2048m -cp $CP -Dlog4j.log.dir=$LOGDIR kernel.StartKernel $KERNEL_OPTIONS"
# Wait for the kernel to start
waitFor $LOGDIR/kernel.log "Listening for connections"
}
# Start the simulators
function startSims {
GUI_OPTION=""
if [[ $NOGUI == "yes" ]]; then
GUI_OPTION="--nogui"
fi
makeClasspath $BASEDIR/lib
# Execute the simulators
execute misc "java -Xmx512m -cp $CP:$BASEDIR/jars/rescuecore2.jar:$BASEDIR/jars/standard.jar:$BASEDIR/jars/misc.jar -Dlog4j.log.dir=$LOGDIR rescuecore2.LaunchComponents misc.MiscSimulator -c $CONFIGDIR/misc.cfg $GUI_OPTION $*"
echo "waiting for misc to connect..."
waitFor $LOGDIR/misc-out.log "success"
execute traffic "java -Xmx1024m -cp $CP:$BASEDIR/jars/rescuecore2.jar:$BASEDIR/jars/standard.jar:$BASEDIR/jars/traffic3.jar -Dlog4j.log.dir=$LOGDIR rescuecore2.LaunchComponents traffic3.simulator.TrafficSimulator -c $CONFIGDIR/traffic3.cfg $GUI_OPTION $*"
echo "waiting for traffic to connect..."
waitFor $LOGDIR/traffic-out.log "success"
# execute fire "java -Xmx1024m -cp $CP:$BASEDIR/jars/rescuecore2.jar:$BASEDIR/jars/standard.jar:$BASEDIR/jars/resq-fire.jar -Dlog4j.log.dir=$LOGDIR rescuecore2.LaunchComponents firesimulator.FireSimulatorWrapper -c $CONFIGDIR/resq-fire.cfg $GUI_OPTION $*"
# echo "waiting for fire to connect..."
# waitFor $LOGDIR/fire-out.log "success"
# execute ignition "java -Xmx512m -cp $CP:$BASEDIR/jars/rescuecore2.jar:$BASEDIR/jars/standard.jar:$BASEDIR/jars/ignition.jar -Dlog4j.log.dir=$LOGDIR rescuecore2.LaunchComponents ignition.IgnitionSimulator -c $CONFIGDIR/ignition.cfg $GUI_OPTION $*"
# echo "waiting for ignition to connect..."
# waitFor $LOGDIR/ignition-out.log "success"
execute collapse "java -Xmx512m -cp $CP:$BASEDIR/jars/rescuecore2.jar:$BASEDIR/jars/standard.jar:$BASEDIR/jars/collapse.jar -Dlog4j.log.dir=$LOGDIR rescuecore2.LaunchComponents collapse.CollapseSimulator -c $CONFIGDIR/collapse.cfg $GUI_OPTION $*"
echo "waiting for collapse to connect..."
waitFor $LOGDIR/collapse-out.log "success"
execute clear "java -Xmx512m -cp $CP:$BASEDIR/jars/rescuecore2.jar:$BASEDIR/jars/standard.jar:$BASEDIR/jars/clear.jar -Dlog4j.log.dir=$LOGDIR rescuecore2.LaunchComponents clear.ClearSimulator -c $CONFIGDIR/clear.cfg $GUI_OPTION $*"
echo "waiting for clear to connect..."
waitFor $LOGDIR/clear-out.log "success"
execute civilian "java -Xmx1512m -cp $CP:$BASEDIR/jars/rescuecore2.jar:$BASEDIR/jars/standard.jar:$BASEDIR/jars/sample.jar:$BASEDIR/jars/kernel.jar -Dlog4j.log.dir=$LOGDIR rescuecore2.LaunchComponents sample.SampleCivilian*n -c $CONFIGDIR/civilian.cfg $*"
}
# Start the viewer
function startViewer {
if [[ $NOGUI == "yes" ]]; then
return 0
fi
makeClasspath $BASEDIR/lib
TEAM_NAME_ARG=""
if [ ! -z "$TEAM" ]; then
TEAM_NAME_ARG="\"--viewer.team-name=$TEAM\""
fi
# Execute the viewer
execute viewer "java -Xmx512m -cp $CP:$BASEDIR/jars/rescuecore2.jar:$BASEDIR/jars/standard.jar:$BASEDIR/jars/sample.jar -Dlog4j.log.dir=$LOGDIR rescuecore2.LaunchComponents sample.SampleViewer -c $CONFIGDIR/viewer.cfg $TEAM_NAME_ARG $*"
echo "waiting for viewer to connect..."
waitFor $LOGDIR/viewer-out.log "success"
}
# Start the viewer event logger
function startViewerEventLogger {
if [[ $JLOG_RECORD == "no" ]]; then
return 0
fi
makeClasspath $BASEDIR/lib
TEAM_NAME_ARG=""
if [ ! -z "$TEAM" ]; then
TEAM_NAME_ARG="\"--viewer.team-name=$TEAM\""
fi
# Execute the viewer
execute viewer "java -Xmx512m -cp $CP:$BASEDIR/jars/rescuecore2.jar:$BASEDIR/jars/standard.jar:$BASEDIR/jars/sample.jar -Dlog4j.log.dir=$LOGDIR rescuecore2.LaunchComponents sample.SampleViewerEventLogger -c $CONFIGDIR/viewer.cfg --records.dir=$RECORDSDIR $TEAM_NAME_ARG $*"
}
function abspath {
if [[ -d "$1" ]]
then
pushd "$1" >/dev/null
pwd
popd >/dev/null
elif [[ -e $1 ]]
then
pushd "$(dirname "$1")" >/dev/null
echo "$(pwd)/$(basename "$1")"
popd >/dev/null
else
echo "$1" does not exist! >&2
return 127
fi
}
\ No newline at end of file
#!/bin/bash
. functions.sh
MAP_DIR=$1
if [[ ! -z "$MAP_DIR" ]]; then
MAP_DIR=$(abspath $MAP_DIR)
if [[ -z "$MAP_DIR" ]]; then
exit 1
fi
fi
echo "starting gmlEditor...."
makeClasspath $BASEDIR/jars $BASEDIR/lib
execute gml-editor "java -Xmx512m -cp $CP -Dlog4j.log.dir=$BASEDIR/logs/log maps.gml.editor.GMLEditor $MAP_DIR"
\ No newline at end of file
#!/bin/sh
ps -ef | grep `cd .. && pwd` | awk '{print "kill -9", $2}' | sh >/dev/null 2>&1
\ No newline at end of file
#!/bin/bash
if [ ! $# -eq 2 ] ; then
echo "usage: `basename $0` <rescue.log path> <output dir>"
exit 1
fi
. functions.sh
makeClasspath $BASEDIR/jars $BASEDIR/lib
java -Xmx1024m -cp $CP -Dlog4j.log.dir=$BASEDIR/logs/log rescuecore2.log.LogExtractor -c $BASEDIR/config/logviewer.cfg $1 $2
\ No newline at end of file
#!/bin/bash
if [ ! $# -eq 1 ] ; then
echo "usage: `basename $0` <rescue.log path>"
exit 1
fi
. functions.sh
makeClasspath $BASEDIR/jars $BASEDIR/lib
java -Xmx256m -cp $CP sample.SampleLogViewer -c $BASEDIR/config/logviewer.cfg $1
\ No newline at end of file
#!/bin/bash
## Software
## Node.js
## NPM
## Google Protobuf
##
## Require JS libraries
## browserify
## google-protobuf
##
. ../functions.sh
## Remove existing protobuf stubs
rm -rf python/*
rm -rf js/*
rm -rf nodejs/*
rm -rf json/*
## Generate URN Mapping
makeClasspath ../../jars ../../lib
java -Xmx1512m -cp $CP rescuecore2.standard.misc.URNMapPrinter --python_out=python/URN.py --js_out=nodejs/URN.js --json_out=json/URN.json
## Java
protoc -I=../../modules/rescuecore2/src/rescuecore2/messages/protobuf --java_out=../../modules/rescuecore2/src RCRSProto.proto RCRSLogProto.proto
## Python
protoc -I=../../modules/rescuecore2/src/rescuecore2/messages/protobuf --python_out=python RCRSProto.proto RCRSLogProto.proto
## Node.js
protoc -I=../../modules/rescuecore2/src/rescuecore2/messages/protobuf --js_out=import_style=commonjs:nodejs/ RCRSProto.proto RCRSLogProto.proto
## JavaScript
cp nodejs/URN.js js/URN.js
npm install --save browserify google-protobuf
./node_modules/.bin/browserify nodejs/RCRSLogProto_pb.js -o js/RCRSLogProto_pb.js
./node_modules/.bin/browserify nodejs/RCRSProto_pb.js -o js/RCRSProto_pb.js
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
//AutoGenerated by 'rcrs-server/scripts/platforms/compile.sh'
//Please do not modify it
const URN={
Entity: {
WORLD:0x1101,
ROAD:0x1102,
BLOCKADE:0x1103,
BUILDING:0x1104,
REFUGE:0x1105,
HYDRANT:0x1106,
GAS_STATION:0x1107,
FIRE_STATION:0x1108,
AMBULANCE_CENTRE:0x1109,
POLICE_OFFICE:0x110a,
CIVILIAN:0x110b,
FIRE_BRIGADE:0x110c,
AMBULANCE_TEAM:0x110d,
POLICE_FORCE:0x110e,
},
Property:{
START_TIME:0x1201,
LONGITUDE:0x1202,
LATITUDE:0x1203,
WIND_FORCE:0x1204,
WIND_DIRECTION:0x1205,
X:0x1206,
Y:0x1207,
BLOCKADES:0x1208,
REPAIR_COST:0x1209,
FLOORS:0x120a,
BUILDING_ATTRIBUTES:0x120b,
IGNITION:0x120c,
FIERYNESS:0x120d,
BROKENNESS:0x120e,
BUILDING_CODE:0x120f,
BUILDING_AREA_GROUND:0x1210,
BUILDING_AREA_TOTAL:0x1211,
APEXES:0x1212,
EDGES:0x1213,
POSITION:0x1214,
DIRECTION:0x1215,
POSITION_HISTORY:0x1216,
STAMINA:0x1217,
HP:0x1218,
DAMAGE:0x1219,
BURIEDNESS:0x121a,
TRAVEL_DISTANCE:0x121b,
WATER_QUANTITY:0x121c,
TEMPERATURE:0x121d,
IMPORTANCE:0x121e,
CAPACITY:0x121f,
BED_CAPACITY:0x1220,
OCCUPIED_BEDS:0x1221,
REFILL_CAPACITY:0x1222,
WAITING_LIST_SIZE:0x1223,
},
Command:{
AK_REST:0x1301,
AK_MOVE:0x1302,
AK_LOAD:0x1303,
AK_UNLOAD:0x1304,
AK_SAY:0x1305,
AK_TELL:0x1306,
AK_EXTINGUISH:0x1307,
AK_RESCUE:0x1308,
AK_CLEAR:0x1309,
AK_CLEAR_AREA:0x130a,
AK_SUBSCRIBE:0x130b,
AK_SPEAK:0x130c,
},
ComponentCommand:{
Target:0x1401,
DestinationX:0x1402,
DestinationY:0x1403,
Water:0x1404,
Path:0x1405,
Message:0x1406,
Channel:0x1407,
Channels:0x1408,
},
ControlMSG:{
KG_CONNECT:0x0101,
KG_ACKNOWLEDGE:0x0102,
GK_CONNECT_OK:0x0103,
GK_CONNECT_ERROR:0x0104,
SK_CONNECT:0x0105,
SK_ACKNOWLEDGE:0x0106,
SK_UPDATE:0x0107,
KS_CONNECT_OK:0x0108,
KS_CONNECT_ERROR:0x0109,
KS_UPDATE:0x010a,
KS_COMMANDS:0x010b,
KS_AFTERSHOCKS_INFO:0x010c,
VK_CONNECT:0x010d,
VK_ACKNOWLEDGE:0x010e,
KV_CONNECT_OK:0x010f,
KV_CONNECT_ERROR:0x0110,
KV_TIMESTEP:0x0111,
AK_CONNECT:0x0112,
AK_ACKNOWLEDGE:0x0113,
KA_CONNECT_OK:0x0114,
KA_CONNECT_ERROR:0x0115,
KA_SENSE:0x0116,
SHUTDOWN:0x0117,
ENTITY_ID_REQUEST:0x0118,
ENTITY_ID_RESPONSE:0x0119,
},
ComponentControlMSG:{
RequestID:0x0201,
AgentID:0x0202,
Version:0x0203,
Name:0x0204,
RequestedEntityTypes:0x0205,
SimulatorID:0x0206,
RequestNumber:0x0207,
NumberOfIDs:0x0208,
NewEntityIDs:0x0209,
Reason:0x020a,
Entities:0x020b,
ViewerID:0x020c,
AgentConfig:0x020d,
Time:0x020e,
Updates:0x020f,
Hearing:0x0210,
INTENSITIES:0x0211,
TIMES:0x0212,
ID:0x0213,
Commands:0x0214,
SimulatorConfig:0x0215,
Changes:0x0216,
}
}
URN.MAP=Object.assign({},...Object.keys(URN.Entity).map(p=>({[URN.Entity[p]]:p})),...Object.keys(URN.Property).map(p=>({[URN.Property[p]]:p})),...Object.keys(URN.Command).map(p=>({[URN.Command[p]]:p})),...Object.keys(URN.ComponentCommand).map(p=>({[URN.ComponentCommand[p]]:p})),...Object.keys(URN.ControlMSG).map(p=>({[URN.ControlMSG[p]]:p})),...Object.keys(URN.ComponentControlMSG).map(p=>({[URN.ComponentControlMSG[p]]:p})))
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment