RTS client installation - norlab-ulaval/Norlab_wiki GitHub Wiki
The client used to controll the Robotic Total Station (RTS) is a raspberry pi zero 2W with a Waveshare SX126X LoRa Hat for communication and a Waveshare LC29H (DA) GPS Hat for time synchronization (PPS). OS installed is PI OS Bookworm Lite (Ubuntu 22) in 32-bit (it's important to use ARM32 since the SDK is meant for that architecture).
LoRa Module Setup
- On Windows OS install the LoRa Module Driver from CP210x USB to UART Bridge VCP Drivers.
- Decompress the ZIP file > right-click on silabser.inf > Install.
- Download the software RF_settings
- Remove the M1 Jumper (11) on the LoRa module
- Plug the LoRa module in your USB port
- Launch RF Settings Software > Select COM port > Open > Get
- Use the following settings > Set Params > Close
- Unplug the LoRa module and put back the M1 jumper
GPS Module Setup
Since the LoRa module already uses the main UART (serial port 0) we need to enable a mini-UART (serial port 1) to connect the GPS pins for GND, 5V, RX and TX pins. To do so we need to follow this blog on how to scrape and solder the GPIO 23 and 24 to re wire them to GPIO 32/33 for RX and TX as follow.
In the end the wyring of both LoRa and GPS modules should look like this:
Pi Zero 2 W LC29H GPS HAT LoRa HAT
+-----------+ +------------+ +------------+
| | | | | |
| GPIO23 TX | <-------------- | GPS RX | | |
| GPIO24 RX | --------------> | GPS TX | | |
| GPIO18 PPS| <-------------- | PPS OUT | | |
| GND | ---------------- | GND | --------------- | GND |
| 3.3V/5V | ---------------- | VCC | --------------- | VCC |
| GPIO14 TX | ----------------------------------------------> | RX |
| GPIO15 RX | <---------------------------------------------- | TX |
+-----------+ +------------+ +------------+
Notes:
- GPS HAT UART1 wired to GPIO23/24 โ mini UART (/dev/serial1)
- PPS from GPS connected to GPIO18 for time sync
- LoRa HAT uses UART0 (GPIO14/15) โ no conflict
Pi Zero Boot
sudo nano /boot/firmware/config.txt
At the end of the file in the section all copy paste the following:
[all]
dtoverlay=dwc2,dr_mode=host
dtoverlay=pitft28-capacitive,rotate=90,speed=3200000,fps=20
dtoverlay=disable-bt
enable_uart=1
dtoverlay=uart1,txd1_pin=32,rxd1_pin=33
dtoverlay=pps-gpio,gpiopin=18
Installation
Install requirements:
sudo apt update
sudo apt upgrade
sudo apt install nmcli
sudo apt install git -y
sudo apt install cmake -y
sudo apt install python3-pip -y
sudo apt install libusb-1.0-0-dev -y
Verify serial interface status:
sudo raspi-config
โ Interface Options โ Serial
โLogin shell over serial?โ โ No
โEnable serial port hardware?โ โ Yes Then reboot.
Confirm that the usb port is enabled:
lsmod | grep dwc2
If no output:
sudo modprobe dwc2
Plug a total station and use:
lsusb
You should see:
Create udev rule
sudo micro /etc/udev/rules.d/10-trimble.rules
SUBSYSTEM=="usb", ATTR{idProduct}=="0101", ATTR{idVendor}=="099e", MODE="0666", GROUP="users", SYMLINK+="theodolyte"
sudo udevadm control --reload-rules
sudo udevadm trigger
ls -l /dev/theodolyte
Create SSH key for GitHub
ssh-keygen -t ed25519 -C [email protected] -q -N ""
eval $(ssh-agent -s)
ssh-add ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub
git config --global user.email [email protected]
git config --global user.name Norlab Team
Then add this ssh key in Git Hub norlab account.
Serial
cd ~ && mkdir -p repos && cd repos/
git clone [email protected]:norlab-ulaval/cpp_serial.git
cd cpp_serial/
cmake -S . -B build
cmake --build build -j
sudo cmake --install build --prefix /usr/local
Theodolite SDK and Theodolite Client
cd ~/repos
git clone [email protected]:norlab-ulaval/theodolite_interface.git
git clone [email protected]:norlab-ulaval/theodolite_client.git
cd theodolite_interface
./build.sh
cd ../theodolite_client
mkdir build & cd build
cmake ..
make
Open the bashrc and copy the LIBRARY_PATH (WIP to fix)
micro ~/.bashrc
export LD_LIBRARY_PATH=/usr/local/lib/theodolite_interface:/home/robot/repos/theodolite_interface/lib:$LD_LIBRARY_PATH
Service
sudo micro /etc/systemd/system/theodolite.service
Copy Paste the following file:
[Unit]
Description=Theodolite Client Service
After=network.target
[Service]
Type=simple
WorkingDirectory=/home/robot/repos/theodolite_client/build/
ExecStart=/bin/bash -c 'source /home/robot/.bashrc && /home/robot/repos/theodolite_client/build/theodolite_client 1 1 0 1 1'
Restart=always
StartLimitIntervalSec=1
StartLimitBurst=0
User=root
Environment=LD_LIBRARY_PATH=/usr/local/lib/theodolite_interface:/home/robot/repos/theodolite_interface/lib:$LD_LIBRARY_PATH
[Install]
WantedBy=multi-user.target
sudo systemctl daemon-reload
sudo systemctl restart theodolite.service
sudo systemctl status theodolite.service
PPS time sync
Install and test pps:
sudo apt update
sudo apt install chrony pps-tools
sudo ppstest /dev/pps0
You should see timestamps pooping in.
Configure chrony:
sudo micro /etc/chrony/chrony.conf
refclock PPS /dev/pps0 refid PPS
sudo systemctl restart chrony
chronyc sources -v
chronyc tracking
You should see PPS as Reference ID after waiting a few minutes.
sudo systemctl enable chrony
sudo systemctl is-active chrony
Compare with the robotic platform time:
watch -n 0.1 date -u +"%H:%M:%S.%N"
Install and configure gpsd:
sudo apt update
sudo apt install gpsd gpsd-clients
cgps -s
Test to GPS to verify that NMEA messages are getting in.