Code to deploy on AlphaBots to test the STTR swarm control algorithms.
Initial work performed by RI for STTR Phase 2E.
- 4 × AlphaBot2-Pi
- 8 × Decawave MDEK1001 (UWB sensor)
- 4 × SparkFun ICM-20948 (IMU)
- 4 × CP2112 (I2C–USB Converter)
- 4 x Mount for UWB, IMU, and I2C-USB converter
- 8 x Spacer for ball casters
Note: Spacers may need to be adjusted by +-1mm due to AlphaBot2-Pi tolerance
- Download the Decawave Software Package.
- Flash the UWB sensors using J-Flash Lite.
- Use the Decawave Android app to configure sensors as anchors or tags. The maximum anchors allowed in the software is 4.
📖 Full guide: Precise Real-Time Indoor Localization with Raspberry Pi and UWB
- Login to the GUI for the RPI OS and configure the AlphaBots to the same Wi-Fi. Note their ip addresses.
- Compile: make swarm_child.cpp and swarm_controller
- Run
./swarm_child '{"nodename":"child_XX"}on all robots, where XX is from 01-03. - Run
sudo python3 position_udp_main.pyon all robots (requires restarting once on first run after reboot) - Run
./swarm_controlleron a computer on the same network as the AlphaBots. - Run the
control_demo.shscript.
Note: For more ideal initial trajectories, all robots should be setup starting at 0 degrees (facing +x-direction)
- ssh_keyboard_drive.py: Control robot with WASD
- imu.py: Reads orientation data using IMU
- uwb.py: Reads x,y position data using UWB sensors
- position_udp_main.py: Main driver code
- On running position_upd_main.py for the first time on RPI boot, you'll notice it starts spinning after receiving a position command. After stopping the script and restarting, this problem with the IMU will not appear again until another reboot.
- UWB sensors may occasionally go down and require a restart (unplug/replug)
- Velocity is fixed during movement.
- Optimal performance degrades rapidly due to short battery life.
- Re-incorporate Madgwick filter and EKF back into positioning code.
- Consider increasing robot velocity.
- Implement fine-grained convergence to target position.
First install the dependency packages:
sudo apt update
sudo apt install -y libopenblas-dev
This repo uses CMakePresets for its build configurations.
See the available presets by running the following in the root folder of the project:
cmake --list-presets
cmake --build --list-presets
Example configuration and build for the linux-debug preset:
cmake --preset linux-debug
cmake --build --preset linux-debug -j4 --target swarm_child swarm_controller copy_agent
Example configuration and build for the rpi-debug preset:
See the section below for installing the RPI cross-compiler first before building for RPI.
cmake --preset rpi-debug
cmake --build --preset rpi-debug -j4 --target swarm_child swarm_controller copy_agent
The compiled binaries will be in the build/<rpi/linux>-<debug/release> folder.
The Raspberry PI on the AlphaBot uses version 2.36 of GLIBC, so the latest version of the toolchain we can use is version 12.
localuser@raspberrypi:~ $ ldd --version
ldd (Debian GLIBC 2.36-9+rpt2+deb12u7) 2.36
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
The toolchain can be found here: https://developer.arm.com/downloads/-/arm-gnu-toolchain-downloads
Arm GNU Toolchain Version 12.2.Rel1 x86_64 Linux hosted cross toolchains AArch32 GNU/Linux target with hard float (arm-none-linux-gnueabihf)
Change folders to the /opt folder to use as the root install directory for toolchains:
cd /opt
Download the toolchain:
sudo wget https://developer.arm.com/-/media/Files/downloads/gnu/12.2.rel1/binrel/arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz
Extract:
sudo tar xvf arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz
Remove the compressed file, which we no longer need:
sudo rm arm-gnu-toolchain-12.2.rel1-x86_64-arm-none-linux-gnueabihf.tar.xz


