-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
117 lines (101 loc) · 3.75 KB
/
Copy pathjustfile
File metadata and controls
117 lines (101 loc) · 3.75 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
set dotenv-load # to read ROBOT_NAMESPACE from .env file
[private]
alias husarnet := connect-husarnet
[private]
alias flash := flash-firmware
[private]
alias rosbot := start-rosbot
[private]
alias sim := start-simulation
[private]
default:
@just --list --unsorted
[private]
pre-commit:
#!/bin/bash
if ! command -v pre-commit &> /dev/null; then
pip install pre-commit
pre-commit install
fi
pre-commit run -a
_install-rsync:
#!/bin/bash
if ! command -v rsync &> /dev/null || ! command -v sshpass &> /dev/null || ! command -v inotifywait &> /dev/null; then
if [ "$EUID" -ne 0 ]; then
echo -e "\e[1;33mPlease run as root to install dependencies\e[0m"
exit
fi
sudo apt-get install -y rsync sshpass inotify-tools
fi
_install-yq:
#!/bin/bash
if ! command -v /usr/bin/yq &> /dev/null; then
if [ "$EUID" -ne 0 ]; then
echo -e "\e[1;33mPlease run as root to install dependencies\e[0m"
exit
fi
YQ_VERSION=v4.35.1
ARCH=$(arch)
if [ "$ARCH" = "x86_64" ]; then
YQ_ARCH="amd64"
elif [ "$ARCH" = "aarch64" ]; then
YQ_ARCH="arm64"
else
YQ_ARCH="$ARCH"
fi
curl -L https://github.com/mikefarah/yq/releases/download/${YQ_VERSION}/yq_linux_${YQ_ARCH} -o /usr/bin/yq
chmod +x /usr/bin/yq
echo "yq installed successfully!"
fi
# connect to Husarnet VPN network
connect-husarnet joincode hostname:
#!/bin/bash
if [ "$EUID" -ne 0 ]; then
echo "Please run as root"
exit
fi
if ! command -v husarnet > /dev/null; then
echo "Husarnet is not installed. Installing now..."
curl https://install.husarnet.com/install.sh | sudo bash
fi
husarnet join {{joincode}} {{hostname}}
# flash the proper firmware for STM32 microcontroller in ROSbot 2R / 2 PRO
flash-firmware: _install-yq
#!/bin/bash
echo "Stopping all running containers"
docker ps -q | xargs -r docker stop
echo "Flashing the firmware for STM32 microcontroller in ROSbot"
docker run --rm -it --privileged \
$(yq .services.rosbot.image docker/compose.yaml) \
ros2 run rosbot_utils flash_firmware
# start ROSbot 2R / 2 PRO autonomy containers
start-rosbot:
#!/bin/bash
if grep -q "Intel(R) Atom(TM) x5-Z8350" /proc/cpuinfo && [[ "${CONTROLLER}" == "mppi" ]]; then
echo -e "\e[1;33mMPPI controller is currently not compatible with ROSbot 2 PRO. Please use DWB or RPP controller\e[0m"
exit
fi
mkdir -m 775 -p maps
docker compose -f docker/compose.yaml down
docker compose -f docker/compose.yaml pull
docker compose -f docker/compose.yaml up
# start Gazebo simulator with autonomy
start-simulation:
#!/bin/bash
xhost +local:docker
docker compose -f docker/compose.sim.yaml down
docker compose -f docker/compose.sim.yaml pull
docker compose -f docker/compose.sim.yaml up
# restart the Nav2 container
restart-navigation:
#!/bin/bash
docker compose -f docker/compose.yaml down rosbot_navigation
docker compose -f docker/compose.yaml up -d rosbot_navigation
# copy repo content to remote host with 'rsync' and watch for changes
sync hostname="${ROBOT_NAMESPACE}" password="husarion": _install-rsync
#!/bin/bash
mkdir -m 775 -p maps
sshpass -p "{{password}}" rsync -vRr --exclude='.git/' --exclude='maps/' --exclude='.docs' --delete ./ husarion@{{hostname}}:/home/husarion/${PWD##*/}
while inotifywait -r -e modify,create,delete,move ./ --exclude='.git/' --exclude='maps/' --exclude='.docs' ; do
sshpass -p "{{password}}" rsync -vRr --exclude='.git/' --exclude='maps/' --exclude='.docs' --delete ./ husarion@{{hostname}}:/home/husarion/${PWD##*/}
done