Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
seigot authored Jan 18, 2024
1 parent a237739 commit 9a658e2
Showing 1 changed file with 85 additions and 0 deletions.
85 changes: 85 additions & 0 deletions aichallenge_2023/main.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
#!/bin/bash

export PATH="$PATH:/root/.local/bin"
export PATH="/usr/local/cuda/bin:$PATH"
export RMW_IMPLEMENTATION=rmw_cyclonedds_cpp
export XDG_RUNTIME_DIR=/tmp/xdg
export ROS_LOCALHOST_ONLY=1

# Launch AWSIM
echo "Launch AWSIM"
sudo ip link set multicast on lo
source /aichallenge/aichallenge_ws/install/setup.bash
/aichallenge/AWSIM/AWSIM.x86_64 &

sleep 20

cd /output

# Launch Autoware
echo "Launch user Autoware code"
source /aichallenge/aichallenge_ws/install/setup.bash
ros2 launch aichallenge_launch aichallenge.launch.xml > autoware.log 2>&1 &
ROSLAUNCH_PID=$!

sleep 10

# Record rosbag
ros2 bag record -a -o rosbag2_autoware &
ROSBAG_RECORD_PID=$!

# Waiting for Service Launch
echo "Waiting for Service Launch"
COUNT=0
until (ros2 service type /debug/service/capture_screen)
do
if [ $COUNT -ge 36 ]; then
echo "timeout count: $COUNT"
break
fi
echo "Waiting for Service Launch"
((COUNT+=1))
sleep 5
done

# Start Recording Rviz2
if ros2 service type /debug/service/capture_screen; then
ros2 service call /debug/service/capture_screen std_srvs/srv/Trigger
fi

# Wait result.js
echo "Wait for result.json"
COUNT=0
until [ -f ~/awsim-logs/result.json ]
do
if [ $COUNT -ge 240 ]; then
echo "timeout count: $COUNT"
break
fi
((COUNT+=1))
sleep 5
done

# Stop Recording Rviz2
if ros2 service type /debug/service/capture_screen; then
ros2 service call /debug/service/capture_screen std_srvs/srv/Trigger
fi

sleep 10

## Save rosbag and log
kill $ROSBAG_RECORD_PID
kill $ROSLAUNCH_PID

sleep 10

## Compress rosbag
tar -czf rosbag2_autoware.tar.gz rosbag2_autoware

sleep 5

echo "Generation of result.json is completed."
cp ~/awsim-logs/result.json /output
cp ~/awsim-logs/verbose_result.json /output
# cp /autoware.log /output
# cp /rosbag2_autoware.tar.gz /output

0 comments on commit 9a658e2

Please sign in to comment.