The ToppleBot was designed within the Physical Sciences Department of the Embry-Riddle Aeronautical University. It was the senior design project of Kilian Olen (Principal Investigator), Gabriel Rodriguez (Software and Communications), Erin Bader (Design), and William Baker (Electrical). It is built of the successes of CUBEBAS, a previous senior design project that built off of Rem-RC's Balancing Cube design. The ToppleBot expands the project envelope from just balancing to also including scaling designs, visualization, odometry, and toppling capabilities.
The ToppleBot's onboard software was forked from this repository, authored by Simon M. Werner. He integrateed the Madgwick AHRS algorithm on the ESP32 with the MPU9250 IMU. The software has been additionally configured to include micro-ROS for ESP32. This inclusion allows for the visualization and odometry capabilites to be run by the control station software, which utilizes the capabilities from ROS2 Humble, specifically using the tf2 system for visualization in RViz.
Clone the onboard software repository and navigate into its directory.
git clone --recurse-submodules https://github.com/gabearod2/topplebot.git && cd topplebot
Run the following command to follow your USB connections before connecting the ESP32. Take note of the name of the port you see once you plug in the ESP32.
sudo dmesg --follow
Connect the ESP32 and record the name of the port. Assign privileges to the port with the ESP32 connected to it, using /dev/ttyUSB0
as an example (will most likely be the same for you).
sudo chmod 666 /dev/ttyUSB0
First, we are going to configure the ToppleBot for calibration in the menu when we first build the code. So, first you need to build and flash the project to the ESP32.
docker run -it --rm \ --user espidf \ --volume="/etc/timezone:/etc/timezone:ro" \ -v "$(pwd)":/topplebot \ -v /dev:/dev \ --privileged \ --workdir /topplebot \ microros/esp-idf-microros:latest \ /bin/bash -c "idf.py menuconfig build flash monitor"
Once the menu opens up in the terminal, complete the procedure listed below. Use the Arrow Keys
, ENTER
, Q
, Esc
, and S
for navigating the menu. Once you are running the calibration, follow the directions in the terminal. After the calibration procedure is complete, exit the serial monitor, using Ctrl-]
.
Now, having the calibration values, plug them into /topplebot/main/main.c
lines 75-88. They should look similar to the following code snippet. If your GPIO pins for the IMU are different, you have to edit them in the main as well.
// Calibration Constants for IMU calibration_t cal = { // magnetometer offset from calibration .mag_offset = {.x = -3.046875, .y = 83.751953, .z = -95.554688}, .mag_scale = {.x = 0.993345, .y = 0.990171, .z = 1.016908}, // accelerometer offsets from calibration .accel_offset = {.x = -0.064261, .y = -0.032425, .z = 0.060752}, .accel_scale_lo = {.x = 0.974870, .y = 0.986224, .z = 1.049794}, .accel_scale_hi = {.x = -1.022966, .y = -1.014928, .z = -0.971446}, // gyroscope bias from calibration, averaged, from 01/18 .gyro_bias_offset = {.x = 1.040601, .y = -2.461674, .z = 1.000426} };
If you do not know the IP address of your control station, use this command on your control station.
ifconfig
You should now have everything you need to run the ToppleBot's onbord software. So, we will build and flash the project again.
docker run -it --rm \ --user espidf \ --volume="/etc/timezone:/etc/timezone:ro" \ -v "$(pwd)":/topplebot \ -v /dev:/dev \ --privileged \ --workdir /topplebot \ microros/esp-idf-microros:latest \ /bin/bash -c "idf.py menuconfig build flash monitor"
Once in the menu, you will have to configure your micro-ROS settings.
You can now disconnect the ESP32 and connect it to an external power source. Micro-ROS has been configured successfully! See more information about calibration here.
After setting up the onboard software, it is time to set up the control station. First, clone the topplebot_station repo.
https://github.com/gabearod2/topplebot_station.git && cd topplebot_station
Before turning the ToppleBot on, you can start running the micro-ROS agent:
docker run -it --rm --net=host microros/micro-ros-agent:humble udp4 --port 8888 -v6
If the ToppleBot is on, you should see the messages coming from the ToppleBot (if it is correctly configured on your Wi-Fi). If you would like to run the visualization, run the following commands in another terminal.
source /opt/ros/humble/setup.bash && colcon build --packages-select viz --symlink-install && source install/setup.bash && ros2 launch viz topplebot_rviz.launch.py
RViz should open and you should see something similar the following:
You can find the CAD here.