4. The stack on the robot
From here on the Mac is on the robot’s Wi-Fi (X30*****, password 12345678), or on a cable to the Debug Ethernet port at the tail.
4.1 SSH keys
Every host takes user ysc with password ' (one single quote). Install your key once, so the commands below never ask again:
ssh-copy-id ysc@192.168.1.106
ssh-copy-id ysc@192.168.1.105Go by the address, not the name
Deep Robotics names the navigation host (.106) ysc-perception and the perception host (.105) ysc. hostname -I tells which one a shell is on. The tools of this chapter take the role from that address and refuse what belongs to the other host.
4.2 Copy and unpack
cd ~/x30
scp x30_sources.tar.gz ysc@192.168.1.106:~/
scp x30_sources.tar.gz ysc@192.168.1.105:~/On each host (ssh ysc@192.168.1.106, then the same on .105), into a clean workspace: the one before stays as src.prev, so a package x30_ros no longer has is never built again. One command a line, each copied whole:
mkdir -p ~/x30_ws && cd ~/x30_ws
rm -rf src.prev build devel
[ -d src ] && mv src src.prev
tar -xzf ~/x30_sources.tar.gzThe workspace is ~/x30_ws with src/ (x30_ros and its sources) and Livox-SDK/.
4.3 Dependencies
check_deps.sh reads only what is installed (dpkg, the workspace, /usr/local/lib) and prints one apt install line for what is missing:
bash ~/x30_ws/src/x30_ros/tools/check_deps.shOn the perception host it checks what that host builds, the cameras and the recorder, by its address (--perception for it on any other computer).
The robot borrows the Mac’s internet through SSH for the missing packages. The Mac must then be on the robot and online: a cable to the Debug Ethernet port and Wi-Fi to the internet, or the robot’s Wi-Fi and a phone on USB tethering. On the Mac, kept open (a SOCKS proxy back to it):
ssh -R 1080 ysc@192.168.1.106In that session, on the robot:
PX=socks5h://127.0.0.1:1080
P="-o Acquire::http::Proxy=$PX"
P="$P -o Acquire::https::Proxy=$PX"
sudo apt $P update
sudo apt $P install -y <the packages check_deps.sh printed>Where SSH forwarding is refused, the robot names the files it needs and the Mac fetches them. On the robot:
sudo apt-get install --print-uris -qq <packages> |
cut -d"'" -f2 > ~/urls.txtOn the Mac, online:
scp ysc@192.168.1.106:~/urls.txt .
mkdir -p debs && cd debs
xargs -n1 curl -fsSLO < ../urls.txt
cd .. && scp -r debs ysc@192.168.1.106:~/Back on the robot:
sudo dpkg -i ~/debs/*.debNo upgrades on the robot
Never apt upgrade there: Deep Robotics’ software is built against the packages it has. A robot that gets internet also starts Ubuntu’s own upgrades, which hold apt’s lock (Could not get lock, unattended-upgr): let them finish or take the internet away, and turn them off once with the two lines below. EXPKEYSIG from apt update is the expired key of ROS’s repository: a warning, the stack’s packages are installed already.
sudo systemctl disable --now apt-daily.timer
sudo systemctl disable --now apt-daily-upgrade.timer4.4 Build
Navigation host (.106), once: the Livox SDK, which FAST-LIO’s Livox driver links.
cd ~/x30_ws/Livox-SDK/build
cmake .. && make -j4
sudo make installThen on each host:
cd ~/x30_ws/src/x30_ros/tools
bash x30_host.sh buildx30_host.sh build is catkin_make as the robot needs it: ROS sourced, Release, no tests, at most one compile job per 2 GB of memory, and on the perception host only the cameras, the recorder and what launches them. Its arguments go to catkin_make (--pkg x30_navigation).
Note
A pip install --user that put a setuptools in ~/.local stops catkin (module 'importlib_metadata' has no attribute 'EntryPoints'): the build leaves ~/.local out (PYTHONNOUSERSITE=1) without touching it. Deep Robotics’ catkin on the perception host includes the workspace’s src/config.cmake (include could not find load file: config.cmake): the build makes an empty one there.
4.5 Deep Robotics’ autonomy off
The navigation host also runs Deep Robotics’ localization, navigation, mapping, URDF publisher and its bridge to the robot. Next to the stack they only take CPU and get in its way (/initialpose, /map, TF, the UDP port of the motion host’s reports). Turn them off, now and at boot, on the navigation host only (the perception host and the motion host refuse it: what Deep Robotics runs there stays):
cd ~/x30_ws/src/x30_ros/tools
bash dr_services.sh off
bash dr_services.sh statusstatus then says udp 43897 ... free.
The sensor drivers (/livox/lidar, /imu/data), the ROS master and the robot server stay. The motion host and the perception host are never touched. dr_services.sh on puts everything back as it was.
4.6 The motion host’s reports
The motion host sends its 200 Hz reports only to the addresses in its network.toml (Deep Robotics’ Application Manual, 4.3.2). Add the navigation host with port 43897 and restart the motion program; otherwise the robot takes commands but reports nothing, and the driver’s state says no reports from 192.168.1.103 yet (network.toml on the motion host?).
4.7 The hosts and their clocks
Deep Robotics’ drivers on the navigation host register under the name ysc-perception. On the perception host, make that name resolve:
echo '192.168.1.106 ysc-perception' |
sudo tee -a /etc/hostsWithout internet the two clocks drift apart; nothing in the stack depends on it, but logs and reports of the two hosts then disagree. Let the navigation host be the perception host’s clock with chrony (allow 192.168.1.0/24 and local stratum 10 on .106, server 192.168.1.106 iburst on .105), or once after each boot on .105:
sudo date -s "$(ssh ysc@192.168.1.106 date -Ins)"