Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
Signed-off-by: Oguz Ozturk <[email protected]>
  • Loading branch information
oguzkaganozt committed Dec 1, 2024
1 parent 59a3853 commit 48e7a34
Show file tree
Hide file tree
Showing 33 changed files with 1,374,837 additions and 671 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-docker-manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ jobs:
- name: Combine multi arch images for 'Autoware'
uses: ./.github/actions/combine-multi-arch-images
with:
package-name: autoware
package-name: demo_packages
17 changes: 17 additions & 0 deletions docker/etc/common.param.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/**:
ros__parameters:
max_vel: 10.0

# constraints param for normal driving
normal:
min_acc: -1.0 # min deceleration [m/ss]
max_acc: 1.0 # max acceleration [m/ss]
min_jerk: -1.0 # min jerk [m/sss]
max_jerk: 1.0 # max jerk [m/sss]

# constraints to be observed
limit:
min_acc: -2.5 # min deceleration limit [m/ss]
max_acc: 1.0 # max acceleration limit [m/ss]
min_jerk: -1.5 # min jerk limit [m/sss]
max_jerk: 1.5 # max jerk limit [m/sss]
337 changes: 337 additions & 0 deletions docker/etc/local.yaml

Large diffs are not rendered by default.

337 changes: 337 additions & 0 deletions docker/etc/static_obstacle_avoidance.param.yaml.fail

Large diffs are not rendered by default.

337 changes: 337 additions & 0 deletions docker/etc/static_obstacle_avoidance.param.yaml.pass

Large diffs are not rendered by default.

132 changes: 84 additions & 48 deletions docker/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,16 +96,12 @@ set_architecture() {
move_files_to_simulator_home() {
cp -a "${WORKSPACE_ROOT}/docker/etc/map" $SIMULATOR_HOME
cp -a "${WORKSPACE_ROOT}/docker/etc/simulation" $SIMULATOR_HOME
cp -a "${WORKSPACE_ROOT}/docker/etc/static_obstacle_avoidance.param.yaml.pass" $SIMULATOR_HOME
cp -a "${WORKSPACE_ROOT}/docker/etc/static_obstacle_avoidance.param.yaml.fail" $SIMULATOR_HOME
cp -a "${WORKSPACE_ROOT}/docker/etc/common.param.yaml" $SIMULATOR_HOME
chmod -R a+rw $SIMULATOR_HOME/map $SIMULATOR_HOME/simulation
}

cleanup() {
echo -e "${BLUE}Cleaning up containers...${NC}"
docker ps -q --filter "name=planning-control" | xargs -r docker kill
docker ps -q --filter "name=web-visualizer" | xargs -r docker kill
docker ps -q --filter "name=simulator" | xargs -r docker kill
}

test_docker_remote_context() {
if ! timeout 5 docker --context remote-machine ps; then
echo -e "${RED}Failed to connect to remote Docker context${NC}"
Expand Down Expand Up @@ -189,7 +185,78 @@ configure_remote_host() {
echo "$remote_host" >> "$hosts_file"
}

run_visualizer() {
if [ "$1" = "web" ]; then
visualizer_container="web-visualizer"
else
visualizer_container="local-visualizer"
xhost +
fi
# Run visualizer
echo -e "\n${NC}Starting ${visualizer_container}...${NC}"
docker compose -f "${SCRIPT_DIR}/simulation.docker-compose.yaml" --env-file "${SCRIPT_DIR}/etc/simulator.env" up ${visualizer_container} --remove-orphans --no-recreate -d

# Wait for web visualizer to start
echo -e "${NC}Waiting for ${visualizer_container} to start...${NC}"
for i in {1..3}; do
printf "\r[%-3s] %d%%" "$(printf '#%.0s' $(seq 1 $i))" $((i*100/3))
sleep 1
done

if [ "$1" = "web" ]; then
echo -e "\n${GREEN}${visualizer_container} is ready!${NC}"
echo -e "${GREEN}Access the visualizer at ${GREEN}https://${NGROK_URL}/vnc.html${NC}"
echo -e "${NC}----------------------------------------${NC}"
else
echo -e "\n${GREEN}${visualizer_container} is ready!${NC}"
echo -e "${NC}----------------------------------------${NC}"
fi
}

run_simulation() {
if [ "$1" = "fail" ]; then
export SIM_TIME=32
export PLANNING_CONTROL_NAME=planning-control-fail
else
export SIM_TIME=60
export PLANNING_CONTROL_NAME=planning-control-pass
fi

# Run simulation
echo -e "${BLUE}Running ${1} simulation...${NC}"
docker compose -f "${SCRIPT_DIR}/simulation.docker-compose.yaml" --env-file "${SCRIPT_DIR}/etc/simulator.env" up ${PLANNING_CONTROL_NAME} --remove-orphans -d

# Wait for planning-control to start
echo -e "${NC}Waiting for planning-control to start...${NC}"
for i in {1..60}; do
printf "\r[%-60s] %d%%" "$(printf '#%.0s' $(seq 1 $i))" $((i*100/60))
sleep 1
done
echo -e "\n${GREEN}Planning-control is ready!${NC}"
echo -e "${NC}----------------------------------------${NC}"

# Wait for simulator to start
echo -e "${NC}Waiting for simulator to start...${NC}"
for i in {1..4}; do
printf "\r[%-4s] %d%%" "$(printf '#%.0s' $(seq 1 $i))" $((i*100/4))
sleep 1
done
echo -e "\n${NC}Starting simulator...${NC}"
docker compose -f "${SCRIPT_DIR}/simulation.docker-compose.yaml" --env-file "${SCRIPT_DIR}/etc/simulator.env" up simulator --remove-orphans
# echo -e "\n${GREEN}Simulator is ready!${NC}"
echo -e "${NC}----------------------------------------${NC}"
}

cleanup() {
echo -e "${BLUE}Cleaning up containers...${NC}"
if [ "$1" = "all" ]; then
docker ps -q --filter "name=visualizer" | xargs -r docker rm -f || true
fi
docker ps -q --filter "name=planning-control" | xargs -r docker rm -f || true
docker ps -q --filter "name=simulator" | xargs -r docker rm -f || true
}

run() {
trap cleanup SIGINT SIGTERM

if [ -n "$remote_host" ]; then
Expand All @@ -214,51 +281,20 @@ run_simulation() {
echo "SIMULATOR_HOME: ${SIMULATOR_HOME}"

# Kill all running containers
cleanup

# Run simulation
echo -e "\n${NC}Starting planning-control...${NC}"
docker compose -f "${SCRIPT_DIR}/simulation.docker-compose.yaml" --env-file "${SCRIPT_DIR}/etc/simulator.env" up planning-control --remove-orphans -d

# Wait for planning-control to start
echo -e "${NC}Waiting for planning-control to start...${NC}"
for i in {1..60}; do
printf "\r[%-60s] %d%%" "$(printf '#%.0s' $(seq 1 $i))" $((i*100/60))
sleep 1
done
echo -e "\n${GREEN}Planning-control is ready!${NC}"
echo -e "${NC}----------------------------------------${NC}"

# Run web visualizer
echo -e "\n${NC}Starting web visualizer...${NC}"
docker compose -f "${SCRIPT_DIR}/simulation.docker-compose.yaml" --env-file "${SCRIPT_DIR}/etc/simulator.env" up web-visualizer --remove-orphans -d

# Wait for web visualizer to start
echo -e "${NC}Waiting for web visualizer to start...${NC}"
for i in {1..4}; do
printf "\r[%-4s] %d%%" "$(printf '#%.0s' $(seq 1 $i))" $((i*100/4))
sleep 1
done
echo -e "\n${GREEN}Web visualizer is ready!${NC}"
echo -e "${GREEN}Access the visualizer at ${GREEN}https://${NGROK_URL}/vnc.html${NC}"
echo -e "${NC}----------------------------------------${NC}"

# Wait for simulator to start
echo -e "${NC}Waiting for simulator to start...${NC}"
for i in {1..8}; do
printf "\r[%-8s] %d%%" "$(printf '#%.0s' $(seq 1 $i))" $((i*100/8))
sleep 1
cleanup all

# Infinite loop
while true; do
run_visualizer local
run_simulation fail
cleanup
run_simulation pass
cleanup
done
echo -e "\n${NC}Starting simulator...${NC}"
docker compose -f "${SCRIPT_DIR}/simulation.docker-compose.yaml" --env-file "${SCRIPT_DIR}/etc/simulator.env" up simulator --remove-orphans
echo -e "\n${GREEN}Simulator is ready!${NC}"
echo -e "${NC}----------------------------------------${NC}"

docker compose -f "${SCRIPT_DIR}/simulation.docker-compose.yaml" --env-file "${SCRIPT_DIR}/etc/simulator.env" wait planning-control web-visualizer simulator
}

source "${SCRIPT_DIR}/etc/simulator.env"
parse_arguments "$@"
check_remote_arguments
set_architecture
run_simulation
run
Loading

0 comments on commit 48e7a34

Please sign in to comment.