Skip to content

Commit

Permalink
various fixes to allow running main process by hand
Browse files Browse the repository at this point in the history
  • Loading branch information
merlinran committed Jan 4, 2022
1 parent 92bd1e1 commit 936838d
Show file tree
Hide file tree
Showing 17 changed files with 18 additions and 10 deletions.
7 changes: 3 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down Expand Up @@ -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
4 changes: 2 additions & 2 deletions SIMULATION.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Empty file modified bringup/bringup.sh
100644 → 100755
Empty file.
Empty file modified bringup/docker_host_bringup.sh
100644 → 100755
Empty file.
Empty file modified bringup/setup.sh
100644 → 100755
Empty file.
Empty file modified camera/command.sh
100644 → 100755
Empty file.
Empty file modified camera/command2.sh
100644 → 100755
Empty file.
Empty file modified camera/command4k.sh
100644 → 100755
Empty file.
Empty file modified camera/setup_nvidia.sh
100644 → 100755
Empty file.
Empty file modified camera/test_13mp.sh
100644 → 100755
Empty file.
Empty file modified camera/video_command4k.sh
100644 → 100755
Empty file.
Empty file modified camera/video_command_13mp.sh
100644 → 100755
Empty file.
2 changes: 2 additions & 0 deletions vehicle/autolaunch_vehicle.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/sh

echo $PWD
echo Sleep 5...
sleep 5
Expand Down
4 changes: 2 additions & 2 deletions vehicle/autolaunch_vehicle_sim.sh
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
4 changes: 3 additions & 1 deletion vehicle/raspberry_pi_setup.sh
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
#!/bin/sh

sudo apt update
sudo apt install libatlas-base-dev
sudo apt install libatlas-base-dev
5 changes: 4 additions & 1 deletion vehicle/start_main.sh
Original file line number Diff line number Diff line change
@@ -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 $@
2 changes: 2 additions & 0 deletions vehicle/start_motors.sh
Original file line number Diff line number Diff line change
@@ -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'
Expand Down

0 comments on commit 936838d

Please sign in to comment.