Skip to content

Line follower, platooning, sensor fusion with DroidControlSystem and etc.

License

Notifications You must be signed in to change notification settings

BlueAndi/RadonUlzer

Repository files navigation

Radon Ulzer - Firmware for Zumo32U4

License Repo Status Release Build Status

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.

Table of content

The robot

The main target of the firmware is the Pololu Zumo32U4 robot (see https://www.pololu.com/category/129/zumo-robots-and-accessories) from Pololu.

deployment

The simulation

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.

Installation

  1. Install Webots.
  2. Setup for external controllers:
    1. Set environment variable WEBOTS_HOME to installation directory of Webots.
    2. Add to path:
      • Linux: ${WEBOTS_HOME}/lib/controller
      • Windows: %WEBOTS_HOME%\lib\controller
  3. 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
  4. Ensure a current (>=3.9) Python3 version is installed on your machine.

The Webots library

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.

Build

  1. Start VSCode.
  2. PlatformIO project tasks --> <APP-NAME> --> General --> Build
    Example for LineFollowerSim application:
    Example

For the simulation use only the applications with "Sim" as postfix, e.g. LineFollowerSim.

Preparation

The preparation is shown with the line follower application as example. It expects that the LineFollowerSim is already built.

  1. Start the Webots simulation.
  2. File --> Open World
  3. Select ./webots/worlds/LineFollowerTrack.wbt.
  4. The loaded world should now look like this: webots_world
  5. The simulation waits now for the external controller, like the RadonUlzer.

Run

There are 3 ways how to run now the application. Choose according to your needs.

Run without Webots launcher

This can be choosen in case the simulation waits just for one robot.

PlatformIO project tasks --> <APP-NAME> --> General --> Upload

Example for LineFollowerSim application:

Example

Run with Webots launcher

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:

Example

Run via terminal

  1. 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.
  2. Start the executable.

Running the robot on track

  1. Click in the simulation on the display to focus the simulation.
  2. Now the keyboard keys a, b and c can be used to control the robot according to the implemented application logic.

Communicate with the DroidControlShip

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.

Example

The target

Build and flash procedure

  1. PlatformIO project tasks --> <APP-NAME> --> General --> Build
    • For the target use only the applications with "Target" as postfix, e.g. LineFollowerTarget.
  2. 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!
  3. PlatformIO project tasks --> <APP-NAME> --> General --> Upload
  4. Ready.

Example for the LineFollowerTarget application:

Example

The Applications

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

Documentation

Used Libraries

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

Issues, Ideas And Bugs

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.

License

The whole source code is published under the MIT license. Consider the different licenses of the used third party libraries too!

Contribution

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.