Skip to content

Commit

Permalink
feat: add eval environment (#2)
Browse files Browse the repository at this point in the history
Signed-off-by: Takagi, Isamu <[email protected]>
  • Loading branch information
isamu-takagi authored Mar 18, 2024
1 parent d72c6a5 commit 59cf513
Show file tree
Hide file tree
Showing 23 changed files with 950 additions and 43 deletions.
3 changes: 0 additions & 3 deletions .gitignore

This file was deleted.

11 changes: 11 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,14 @@ repos:
- id: detect-private-key
- id: end-of-file-fixer
- id: mixed-line-ending

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.9.0.2
hooks:
- id: shellcheck

- repo: https://github.com/scop/pre-commit-shfmt
rev: v3.6.0-2
hooks:
- id: shfmt
args: [-w, -s, -i=4]
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
FROM osrf/ros:humble-desktop AS common

RUN apt-get update
RUN apt-get -y install libgl1-mesa-glx libgl1-mesa-dri
RUN apt-get -y install iproute2
RUN apt-get -y install ros-humble-rmw-cyclonedds-cpp

FROM common AS dev

ENV ROS_LOCALHOST_ONLY 1
ENV RCUTILS_COLORIZED_OUTPUT 1

FROM common AS eval

ENV RCUTILS_COLORIZED_OUTPUT 0

#RUN mkdir /ws
#RUN git clone --depth 1 https://github.com/AutomotiveAIChallenge/aichallenge-source-materials /ws/aichallenge2023-racing

# Copy into Container
#COPY AWSIM /ws/AWSIM
#COPY aichallenge_submit.tar.gz /ws
#COPY main.bash /ws

# Organize Files for Execution (Copy user files and map data to the executable folder)
#RUN cp -r /ws/aichallenge2023-racing/aichallenge /aichallenge
#RUN cp -r /ws/AWSIM /aichallenge
#RUN chmod 757 /aichallenge
#RUN rm -rf /aichallenge/autoware/src/aichallenge_submit
#RUN tar zxf /ws/aichallenge_submit.tar.gz -C /aichallenge/autoware/src

# Build
#RUN bash -c ' \
# source /autoware/install/setup.bash; \
# cd /aichallenge/autoware; \
# rosdep update; \
# rosdep install -y -r -i --from-paths src --ignore-src --rosdistro $ROS_DISTRO; \
# colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release'

#ENTRYPOINT []
#CMD ["bash", "/ws/main.bash"]
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,9 @@
# aichallenge-yyyymm
# aichallenge-source-materials

## docker-dev

![dev](./readme/dev.drawio.svg)

## docker-eval

![eval](./readme/eval.drawio.svg)
3 changes: 3 additions & 0 deletions aichallenge/autoware/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/build
/install
/log
9 changes: 9 additions & 0 deletions aichallenge/build_autoware.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/bash

if [[ ${1} == "clean" ]]; then
echo "clean build"
rm -r autoware/build/* autoware/install/*
fi

cd ./autoware || exit
colcon build --symlink-install --cmake-args -DCMAKE_BUILD_TYPE=Release
4 changes: 0 additions & 4 deletions aichallenge/build_autoware.sh

This file was deleted.

5 changes: 0 additions & 5 deletions aichallenge/clean_build.sh

This file was deleted.

5 changes: 2 additions & 3 deletions aichallenge/run_autoware.sh → aichallenge/run_autoware.bash
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/bin/bash

# shellcheck disable=SC1091
source /aichallenge/autoware/install/setup.bash
sudo ip link set multicast on lo

source ./autoware/install/setup.bash
rm -f result.json
ros2 launch aichallenge_system_launch aichallenge_system.launch.xml
6 changes: 0 additions & 6 deletions aichallenge/run_awsim.sh

This file was deleted.

72 changes: 72 additions & 0 deletions aichallenge/run_evaluation.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/bin/bash

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

# shellcheck disable=SC1091
source /aichallenge/autoware/install/setup.bash
sudo ip link set multicast on lo

# Move working directory
cd /output || exit

# Launch the simulator
echo "Launch AWSIM"
bash /aichallenge/simulator/simulator.bash &

# Waiting for the simulator to start up
sleep 3

# Launch Autoware
echo "Launch user Autoware code"
ros2 launch aichallenge_system_launch aichallenge_system.launch.xml >autoware.log 2>&1 &
ROSLAUNCH_PID=$!

# Waiting for Autoware to start up
sleep 3

# Start recording rosbag
rm -r rosbag2_autoware
ros2 bag record -a -o rosbag2_autoware &
ROSBAG_RECORD_PID=$!

# Waiting for screen capture (TODO: This will not wait if there is no service)
# echo "Waiting for screen capture"
# until (ros2 service type /debug/service/capture_screen); do
# sleep 5
# done

# Start recording rviz2
# ros2 service call /debug/service/capture_screen std_srvs/srv/Trigger

# Waiting for the simulator results
# echo "Waiting for the simulator results"
# until [ -f ~/awsim-logs/result.json ]; do
# sleep 5
# done

# Stop recording rviz2
# ros2 service call /debug/service/capture_screen std_srvs/srv/Trigger

# Waiting for the screen capture to finish
sleep 3

## Stop rosbag and Autoware to finish writing logs
kill $ROSBAG_RECORD_PID
kill $ROSLAUNCH_PID

# Waiting for the rosbag and logs
sleep 3

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

## Copy the logs to output directory
echo "Generation of result.json is completed."
cp ~/awsim-logs/result.json /output
cp ~/awsim-logs/verbose_result.json /output
6 changes: 6 additions & 0 deletions aichallenge/run_simulator.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

# shellcheck disable=SC1091
source /aichallenge/autoware/install/setup.bash
sudo ip link set multicast on lo
/aichallenge/simulator/simulator.bash
4 changes: 4 additions & 0 deletions aichallenge/simulator/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Download the simulator and place it in this directory.
*
!.gitignore
!simulator.bash
3 changes: 3 additions & 0 deletions aichallenge/simulator/simulator.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

echo "write the simulator command here"
3 changes: 3 additions & 0 deletions create_submit_file.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

tar zcvf output/aichallenge_submit.tar.gz -C ./aichallenge/autoware/src aichallenge_submit
8 changes: 0 additions & 8 deletions docker-dev/Dockerfile

This file was deleted.

2 changes: 0 additions & 2 deletions docker-dev/build_docker.sh

This file was deleted.

11 changes: 0 additions & 11 deletions docker-dev/run_container.sh

This file was deleted.

19 changes: 19 additions & 0 deletions docker_build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

target=${1}

case "${target}" in
"eval")
opts="--no-cache"
;;
"dev")
opts=""
;;
*)
echo "invalid argument (use 'dev' or 'eval')"
exit 1
;;
esac

# shellcheck disable=SC2086
docker build ${opts} --target "${target}" -t "aichallenge-source-materials-${target}" .
35 changes: 35 additions & 0 deletions docker_run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#!/bin/bash

target=${1}
device=${2}

case "${target}" in
"eval")
volume="output:/output"
;;
"dev")
volume="output:/output aichallenge:/aichallenge"
;;
*)
echo "invalid argument (use 'dev' or 'eval')"
exit 1
;;
esac

case "${device}" in
"cpu")
opts="--device /dev/dri"
;;
"gpu")
opts="--nvidia"
;;
*)
echo "invalid argument (use 'gpu' or 'cpu')"
exit 1
;;
esac

mkdir -p output

# shellcheck disable=SC2086
rocker ${opts} --x11 --user --net host --privileged --volume ${volume} -- "aichallenge-source-materials-${target}"
3 changes: 3 additions & 0 deletions output/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This directory will store the evaluation results.
*
!.gitignore
Loading

0 comments on commit 59cf513

Please sign in to comment.