A robot as fast as the famous pod racer driven by Anakin Skywalker with the powerful engines from Radon Ulzer. :-)
Several kind of exclusive applications are available:
- Calib - Application used for motor speed calibration.
- Convoy Leader - A line follower, providing information to the DroidControlShip in a convoy leader role.
- Line Follower - Just a line follower, using a PID controller.
- Remote Control - The robot is remote controlled by e.g. the DroidControlShip in a convoy follower role.
- Sensor Fusion - The robot provides odometry and inertial data to the DroidControlShip, which calculates the sensor fusion based location information.
- The robot
- The simulation
- The target
- The Applications
- Documentation
- Used Libraries
- Issues, Ideas And Bugs
- License
- Contribution
The main target of the firmware is the Pololu Zumo32U4 robot (see https://www.pololu.com/category/129/zumo-robots-and-accessories) from Pololu.
The simulation is based on the open source robot simulator Webots. The application and the services are equal to the target firmware. Only the HAL is different in the simulation.
- Website: https://cyberbotics.com/#cyberbotics
- Github: https://github.com/cyberbotics/webots
- Compatible webots versions:
- v2023a
- v2023b
- Install Webots.
- Setup for external controllers:
- Set environment variable
WEBOTS_HOME
to installation directory of Webots. - Add to path:
- Linux:
${WEBOTS_HOME}/lib/controller
- Windows:
%WEBOTS_HOME%\lib\controller
- Linux:
- Set environment variable
- Install the native compiler toolchain:
- Linux: Install the gcc toolchain, depended on your distribution.
- Windows
- Install the MSYS2 toolchain.
- Open MSYS2 shell.
- Update package database:
pacman -Sy pacman
- Install GCC:
pacman -Sy mingw-w64-ucrt-x86_64-gcc
- Update package database:
- Ensure a current (>=3.9) Python3 version is installed on your machine.
To adapt the HAL to the simulation, some sourcecode files from Webots are necessary. Currently there is no Webots library in the platformio registry available. Therefore a local library is created during the build. Ensure that that Webots is already installed, before you try to build it!
The library creation is handled in the ./scripts/create_webots_library.py
script and runs automatically after building for the WebotsSim environment.
- Start VSCode.
- PlatformIO project tasks --> <APP-NAME> --> General --> Build
Example for LineFollowerSim application:
For the simulation use only the applications with "Sim" as postfix, e.g. LineFollowerSim.
The preparation is shown with the line follower application as example. It expects that the LineFollowerSim is already built.
- Start the Webots simulation.
- File --> Open World
- Select
./webots/worlds/LineFollowerTrack.wbt
. - The loaded world should now look like this:
- The simulation waits now for the external controller, like the RadonUlzer.
There are 3 ways how to run now the application. Choose according to your needs.
This can be choosen in case the simulation waits just for one robot.
PlatformIO project tasks --> <APP-NAME> --> General --> Upload
Example for LineFollowerSim application:
Choose this one in case the simulation waits for more than one robot. Adapt the robot name in the platformio.ini.
See (Single Simulation and Multiple Local Extern Robot Controllers)[https://cyberbotics.com/doc/guide/running-extern-robot-controllers?tab-os=windows#single-simulation-and-multiple-local-extern-robot-controllers] for details.
PlatformIO project tasks --> <APP-NAME> --> Custom --> WebotsLauncher
Example for LineFollowerSim application:
- Open a command line (shell) and change to the folder with the built executable in
.pio/build/LineFollowerSim
. This folder contains all necessary shared libraries as well. - Start the executable.
- Click in the simulation on the display to focus the simulation.
- Now the keyboard keys a, b and c can be used to control the robot according to the implemented application logic.
The communication with the DroidControlShip goes via a Webots serial connection, which is disabled by default.
Use the -c flag to enable it with default channels (see webots_robot_serial_rx_channel and webots_robot_serial_tx_channel in platformio.ini). Note, this will disable the standard logging, because the serial communication uses the SerialMuxProt procotol for data interchange.
$ program.exe -c
For simplicity a Platformio project task was added, which enables the Webots serial connection as well.
- PlatformIO project tasks --> <APP-NAME> --> General --> Build
- For the target use only the applications with "Target" as postfix, e.g. LineFollowerTarget.
- Start the bootloader by triggering twice the reset button. The yellow led will start blinking for 10s. Note, after 10s the target will leave the bootloader!
- PlatformIO project tasks --> <APP-NAME> --> General --> Upload
- Ready.
Example for the LineFollowerTarget application:
Application | Description | Standalone | DroidControlShop Required | Webots World |
---|---|---|---|---|
Calib | Application used for motor speed calibration. | Yes | No | ./webots/worlds/LargeTrack.wbt ./webots/worlds/LineFollowerTrack.wbt |
ConvoyLeader | A line follower, providing information to the DroidControlShip in a convoy leader role. | No | Yes | ./webots/worlds/zumo_with_com_system/PlatoonTrack.wbt |
ConvoyFollower | Convoy follower, providing information to the DroidControlShip to drive to its target. | No | Yes | ./webots/worlds/zumo_with_com_system/PlatoonTrack.wbt |
LineFollower | Just a line follower, using a PID controller with differential drive and odometry. | Yes | No | ./webots/worlds/ETrack.wbt ./webots/worlds/LargeTrack.wbt ./webots/worlds/LineFollowerTrack.wbt |
LineFollowerSimple | Just a simple line follower, using a PID controller. | Yes | No | ./webots/worlds/ETrack.wbt ./webots/worlds/LargeTrack.wbt ./webots/worlds/LineFollowerTrack.wbt |
RemoteControl | The robot is remote controlled by e.g. the DroidControlShip in a convoy follower role. | No | Yes | ./webots/world/zumo_with_com_system/* |
SensorFusion | The robot provides odometry and inertial data to the DroidControlShip, which calculates the sensor fusion based location information. | No | Yes | ./webots/worlds/zumo_with_com_system/LineFollowerTrack.wbt |
Test | Only for testing purposes on native environment. | Yes | No | N/A |
Library | Description | License |
---|---|---|
ArduinoNative | The Arduino for native environment. | MIT |
SerialMuxProt | Multiplexing Communication Protocol | MIT |
ZumoHALATmega32u4 | C++ HAL for ATmega32u4 on the Pololu Zumo32u4 | MIT |
ZumoHALInterfaces | Abstract C++ HAL interfaces | MIT |
ZumoHALWebots | C++ HAL for Webots simulation of the Pololu Zumo32u4 | MIT |
If you have further ideas or you found some bugs, great! Create a issue or if you are able and willing to fix it by yourself, clone the repository and create a pull request.
The whole source code is published under the MIT license. Consider the different licenses of the used third party libraries too!
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, shall be licensed as above, without any additional terms or conditions.