Hardware abstraction layer for the Pololu Zumo robot (see https://www.pololu.com/category/129/zumo-robots-and-accessories) in the Webots simulation.
See details of the Webots library classes in the Webots reference manual.
lib_deps =
BlueAndi/ArduinoNative @ ~0.1.0
BlueAndi/ZumoHALWebots @ ~0.1.1
build_flags =
-I./lib/Webots/include/c
-I./lib/Webots/include/cpp
extra_scripts =
pre:$PROJECT_LIBDEPS_DIR/$PIOENV/ZumoHALWebots/scripts/create_webots_library.py
pre:$PROJECT_LIBDEPS_DIR/$PIOENV/ZumoHALWebots/scripts/copy_sounds.py
post:$PROJECT_LIBDEPS_DIR/$PIOENV/ZumoHALWebots/scripts/copy_webots_shared_libs.py
create_webots_library.py
: Generates the Webots library under the /lib
folder, derived from your local Webots installation.copy_sounds.py
: Copies the sound files used for sound generation.copy_webots_shared_libs.py
: Copies the Webots shared libraries to the local platformio environment specific build folder .pio/build/<environment>
as post-build step. They are required by the exectuable.main.cpp
.See minimal example.
SimTime::step()
shall be called for one single simulation time step.SimTime::step()
shall be called once before the Arduino::setup()
is called.SimTime::step()
shall be called once before the Arduino::loop()
is called periodically.Keyboard::getPressedButtons()
shall be called once before the Arduino::loop()
is called periodically.Arduino::loop()
shall not block (cooperative behaviour).Buzzer::isPlaying()
returns true, the application shall call Buzzer::process()
and delay(1U)
in the loop.
Buzzer::process()
. Without stopping it, the Buzzer::isPlaying()
will always return true.Buzzer::process()
the sound won't stop. The workaround is here to use a delay()
which internally ticks the simulation time.Library | Description | License |
---|---|---|
ArduinoNative | The Arduino for native environment. | MIT |
ArduinoJson | JSON library for Arduino and embedded C++. Simple and efficient. | MIT |
Webots | Webots physical simulation C++ API. | Apache 2.0 |
ZumoHALInterfaces | The Zumo C++ HAL interfaces. | 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.