From 936838d33d0de8fd4cf8e94f2801f325235515db Mon Sep 17 00:00:00 2001 From: Merlin Ran Date: Mon, 20 Dec 2021 16:44:48 -0500 Subject: [PATCH] various fixes to allow running main process by hand --- Makefile | 7 +++---- SIMULATION.md | 4 ++-- bringup/bringup.sh | 0 bringup/docker_host_bringup.sh | 0 bringup/setup.sh | 0 camera/command.sh | 0 camera/command2.sh | 0 camera/command4k.sh | 0 camera/setup_nvidia.sh | 0 camera/test_13mp.sh | 0 camera/video_command4k.sh | 0 camera/video_command_13mp.sh | 0 vehicle/autolaunch_vehicle.sh | 2 ++ vehicle/autolaunch_vehicle_sim.sh | 4 ++-- vehicle/raspberry_pi_setup.sh | 4 +++- vehicle/start_main.sh | 5 ++++- vehicle/start_motors.sh | 2 ++ 17 files changed, 18 insertions(+), 10 deletions(-) mode change 100644 => 100755 bringup/bringup.sh mode change 100644 => 100755 bringup/docker_host_bringup.sh mode change 100644 => 100755 bringup/setup.sh mode change 100644 => 100755 camera/command.sh mode change 100644 => 100755 camera/command2.sh mode change 100644 => 100755 camera/command4k.sh mode change 100644 => 100755 camera/setup_nvidia.sh mode change 100644 => 100755 camera/test_13mp.sh mode change 100644 => 100755 camera/video_command4k.sh mode change 100644 => 100755 camera/video_command_13mp.sh mode change 100644 => 100755 vehicle/raspberry_pi_setup.sh diff --git a/Makefile b/Makefile index 810348b..3e90877 100644 --- a/Makefile +++ b/Makefile @@ -10,9 +10,8 @@ list: .PHONY: simulation # Run the vehicle and server containers in simulation mode. Use envvar ACORN_NAMES to set the name of each simulated vehicle. simulation: docker-image @docker-compose -f docker-compose-server.yml up -d && \ - export server_ip=`docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' acorn_server`; \ for name in $(ACORN_NAMES); do \ - NAME=$${name} SERVER_IP=$${server_ip} envsubst < docker-compose-simulation.yml | COMPOSE_IGNORE_ORPHANS=true docker-compose --file /dev/stdin --project-directory . up -d; \ + NAME=$${name} envsubst < docker-compose-simulation.yml | COMPOSE_IGNORE_ORPHANS=true docker-compose --file /dev/stdin --project-directory . up -d; \ done &&\ echo "Please visit http://localhost" @@ -68,8 +67,8 @@ restart-docker-compose: .PHONY: docker-image docker-image: Dockerfile - @find Dockerfile -newermt "`docker images $(LOCAL_IMAGE) --format "{{.CreatedAt}}"`" || \ - docker build -t $(LOCAL_IMAGE) . + image_time=`docker images $(LOCAL_IMAGE) --format "{{.CreatedAt}}"`; \ + test -z `find Dockerfile -newermt "$${image_time}"` || docker build -t $(LOCAL_IMAGE) . Dockerfile: vehicle/requirements.txt server/requirements.txt @docker build -t $(LOCAL_IMAGE) . && touch Dockerfile # Rebuilding image if requirements files have been changed diff --git a/SIMULATION.md b/SIMULATION.md index c25aaf2..a122cd5 100644 --- a/SIMULATION.md +++ b/SIMULATION.md @@ -97,11 +97,11 @@ docker container. Now run: ``` -python3 vehicle/master_process.py --sim +vehicle/start_main.sh --sim ``` or: ``` -python3 vehicle/master_process.py --sim --debug +vehicle/start_main.sh --sim --debug ``` When you are making changes to the vehicle code, often this is how you will want to run things. Instead of restarting the entire simulation environment, you can diff --git a/bringup/bringup.sh b/bringup/bringup.sh old mode 100644 new mode 100755 diff --git a/bringup/docker_host_bringup.sh b/bringup/docker_host_bringup.sh old mode 100644 new mode 100755 diff --git a/bringup/setup.sh b/bringup/setup.sh old mode 100644 new mode 100755 diff --git a/camera/command.sh b/camera/command.sh old mode 100644 new mode 100755 diff --git a/camera/command2.sh b/camera/command2.sh old mode 100644 new mode 100755 diff --git a/camera/command4k.sh b/camera/command4k.sh old mode 100644 new mode 100755 diff --git a/camera/setup_nvidia.sh b/camera/setup_nvidia.sh old mode 100644 new mode 100755 diff --git a/camera/test_13mp.sh b/camera/test_13mp.sh old mode 100644 new mode 100755 diff --git a/camera/video_command4k.sh b/camera/video_command4k.sh old mode 100644 new mode 100755 diff --git a/camera/video_command_13mp.sh b/camera/video_command_13mp.sh old mode 100644 new mode 100755 diff --git a/vehicle/autolaunch_vehicle.sh b/vehicle/autolaunch_vehicle.sh index 13d00fb..3c941e3 100755 --- a/vehicle/autolaunch_vehicle.sh +++ b/vehicle/autolaunch_vehicle.sh @@ -1,3 +1,5 @@ +#!/bin/sh + echo $PWD echo Sleep 5... sleep 5 diff --git a/vehicle/autolaunch_vehicle_sim.sh b/vehicle/autolaunch_vehicle_sim.sh index fcc39e3..2cdcaf9 100755 --- a/vehicle/autolaunch_vehicle_sim.sh +++ b/vehicle/autolaunch_vehicle_sim.sh @@ -1,9 +1,9 @@ +#!/bin/sh + echo $PWD echo Sleep 5... sleep 5 echo Start Sessions... -gateway_ip=`ip route show 0.0.0.0/0 | cut -d\ -f3` -export SERVER_IP=${gateway_ip} tmux new-session -d -s "main" sh /home/pi/vehicle/start_main.sh --sim & tmux new-session -d -s "motors" sh /home/pi/vehicle/start_motors.sh --simulated_hardware & echo Started. Begin infinite loop. diff --git a/vehicle/raspberry_pi_setup.sh b/vehicle/raspberry_pi_setup.sh old mode 100644 new mode 100755 index 4c77810..ca8c1ce --- a/vehicle/raspberry_pi_setup.sh +++ b/vehicle/raspberry_pi_setup.sh @@ -1,2 +1,4 @@ +#!/bin/sh + sudo apt update -sudo apt install libatlas-base-dev \ No newline at end of file +sudo apt install libatlas-base-dev diff --git a/vehicle/start_main.sh b/vehicle/start_main.sh index c73f4ee..94083af 100755 --- a/vehicle/start_main.sh +++ b/vehicle/start_main.sh @@ -1,4 +1,7 @@ +#! /bin/sh + source /home/pi/.bashrc PATH=/home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games tmux pipe-pane -o 'cat >>/home/pi/logs/tmux_output_$(date +"%Y_%m_%d_%I_%M_%p").#S:#I-#P' -python3 /home/pi/vehicle/master_process.py $@ +gateway_ip=`ip route show 0.0.0.0/0 | cut -d\ -f3` +SERVER_IP=${gateway_ip} python3 /home/pi/vehicle/master_process.py $@ diff --git a/vehicle/start_motors.sh b/vehicle/start_motors.sh index 9f106b0..8513319 100755 --- a/vehicle/start_motors.sh +++ b/vehicle/start_motors.sh @@ -1,3 +1,5 @@ +#!/bin/sh + source /home/pi/.bashrc PATH=/home/pi/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/games:/usr/games tmux pipe-pane -o 'cat >>/home/pi/logs/tmux_output_$(date +"%Y_%m_%d_%I_%M_%p").#S:#I-#P'