SwiftBot - Expanded is a compact library written in C++ with a Java wrapper, focused on ease of use and performance, and includes slight upgrades and extensions to the original SwiftBot platform provided by the BUL CS Department.
The library was written with support for both old and new components in mind. An exhaustive list of supported components includes:
- SSD1306 OLED Display
- HMC5883 and MPU6050 Sensor Fusion for Yaw Calculations
- HC-SR04 Ultrasonic Sensor
- IMX219 Raspberry Pi Camera
- SN2318 Underlight LED Array
- Dual H-Bridge Motors
- GPIO-Controlled Buttons & LEDs
The focus of the project was on the camera module and overall usability of the bot.
The introduction of the OLED and a zero-copy mmap pipeline for video streaming enables a combination of improved UX and the ability to hook video footage to OpenCV processing on the Java layer.
The extension also features a 3D-printed mount for various components, as shown in the image above.
The project was compiled on the Raspberry Pi OS.
The Java artefacts rely on the native libswiftbotextended.so that lives under cpp/. Follow the steps below to compile the shared library and package the Java wrapper so the native binary is embedded automatically.
-
Install the native prerequisites (examples for Raspberry Pi OS / Debian):
sudo apt update sudo apt install build-essential cmake libgpiod-dev libcamera-dev libavcodec-dev libavformat-dev ffmpeg
Ensure
ffmpegis discoverable onPATH; the CMake build fails if it is missing. -
Configure and build the shared library:
cd cpp cmake -S . -B build -DCMAKE_BUILD_TYPE=Release cmake --build build --target swiftbotextended
The compiled library is written to
cpp/build/libswiftbotextended.so.
Optional:
cmake --install buildcan be used if you want to install the library system-wide.
-
Verify the Maven property in
java/swiftbot-expanded/pom.xmlpoints at the shared library you just built:<swiftbot.native.path>${project.basedir}/../../cpp/build/libswiftbotextended.so</swiftbot.native.path>
Adjust this path only if you keep the
.soin a different location. -
Compile and package the Java module (from repository root or directly inside
java/swiftbot-expanded):cd java/swiftbot-expanded mvn clean packageDuring
process-resources, Maven copieslibswiftbotextended.sointotarget/classes/natives/linux-x86_64/so the resulting JAR contains the native payload. -
Run the bundled demo. When the
.sohas already been copied intotarget/classes/natives/...(after the previous step), the demo runs without extra flags:mvn exec:java
Pass
-Dswiftbot.native.path=/absolute/path/to/libswiftbotextended.soonly if you want to override the bundled copy with a different build.mvn exec:java -Dswiftbot.native.path=/absolute/path/to/libswiftbotextended.so
The packaged JAR can now be redistributed; it extracts the native library when SwiftBotNative.load() runs, so students only interact with the Java façade.
Copyright © 2025 BisocM
This project is licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at:
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
While active development on SwiftBot - Expanded has concluded, the source code remains open for educational and community-driven extensions.
If you wish to contribute improvements or fixes, you may do so via the standard GitHub forking workflow:
-
Fork this repository to your own GitHub account.
-
Clone your fork locally:
git clone https://github.com/<your-username>/SwiftBot-Expanded.git
-
Create a new branch for your changes:
git checkout -b feature/your-feature-name
-
Commit and push your modifications:
git commit -m "Describe your change" git push origin feature/your-feature-name -
Open a Pull Request to the main repository, explaining your proposed modifications clearly.
A special thank you to the Brunel University London Computer Science Department team, as well as the Trilobot team at Pimoroni, for bringing the SwiftBot to life.