From ad04227eaeed9940477289087dcd9fd70a39ae13 Mon Sep 17 00:00:00 2001 From: Ilia O Date: Tue, 8 Aug 2023 05:45:04 +0000 Subject: [PATCH] Kaia.ai tweaks --- .gitattributes | 4 + .github/ISSUE_TEMPLATE/general-issue.md | 2 +- .github/workflows/arduino-lint-action.yml | 10 + .github/workflows/ci.yml | 83 -------- .github/workflows/library_generation.yml | 45 ---- .gitmodules | 3 + README.md | 192 ++++++------------ .../extra_packages/kaia_msgs | 1 + library.properties | 16 +- src/micro_ros_arduino.h | 25 +++ src/micro_ros_kaia.h | 6 + 11 files changed, 122 insertions(+), 265 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/arduino-lint-action.yml delete mode 100755 .github/workflows/ci.yml delete mode 100755 .github/workflows/library_generation.yml create mode 100644 .gitmodules create mode 160000 extras/library_generation/extra_packages/kaia_msgs create mode 100644 src/micro_ros_kaia.h diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..9f257d6e2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,4 @@ +*.sh text eol=lf +*.meta text eol=lf +*.cmake text eol=lf +*.repos text eol=lf diff --git a/.github/ISSUE_TEMPLATE/general-issue.md b/.github/ISSUE_TEMPLATE/general-issue.md index 3ac587d18..5085bf319 100755 --- a/.github/ISSUE_TEMPLATE/general-issue.md +++ b/.github/ISSUE_TEMPLATE/general-issue.md @@ -12,7 +12,7 @@ assignees: '' - Hardware description: - RTOS: - Installation type: -- Version or commit hash: +- Version or commit hash: #### Steps to reproduce the issue diff --git a/.github/workflows/arduino-lint-action.yml b/.github/workflows/arduino-lint-action.yml new file mode 100644 index 000000000..0e285da2e --- /dev/null +++ b/.github/workflows/arduino-lint-action.yml @@ -0,0 +1,10 @@ +on: [push, pull_request] +jobs: + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: arduino/arduino-lint-action@v1 + with: + library-manager: update + compliance: strict diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100755 index 25b76fd20..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,83 +0,0 @@ -name: CI - -on: - pull_request: - branches: - - '**' - -jobs: - - micro_ros_arduino: - runs-on: ubuntu-20.04 - container: ubuntu:20.04 - - steps: - - uses: actions/checkout@v2 - with: - path: checkout/ - - - name: Build - run: | - apt update - apt install -y git curl lib32z1 wget libfontconfig libxft2 xz-utils rsync python-is-python3 python3-pip - pip3 install pyserial - curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh -s 0.31.0 - mkdir -p /github/home/Arduino/libraries/micro_ros_arduino/ - cp -R checkout/* /github/home/Arduino/libraries/micro_ros_arduino/ - echo '''board_manager: - additional_urls: - - https://raw.githubusercontent.com/ROBOTIS-GIT/OpenCR/master/arduino/opencr_release/package_opencr_index.json - - https://github.com/espressif/arduino-esp32/releases/download/2.0.2/package_esp32_index.json - - https://www.pjrc.com/teensy/package_teensy_index.json - - https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json''' > arduino-cli.yaml - curl -fsSL https://raw.githubusercontent.com/ROBOTIS-GIT/OpenCR/master/arduino/opencr_release/package_opencr_index.json -o /github/home/.arduino15/package_opencr_index.json - curl -fsSL https://github.com/espressif/arduino-esp32/releases/download/2.0.2/package_esp32_index.json -o /github/home/.arduino15/package_esp32_index.json - curl -fsSL https://www.pjrc.com/teensy/package_teensy_index.json -o /github/home/.arduino15/package_teensy_index.json - curl -fsSL https://files.seeedstudio.com/arduino/package_seeeduino_boards_index.json -o /github/home/.arduino15/package_seeeduino_boards_index.json - export PATH=$PATH:/github/workspace/bin:/__w/micro_ros_arduino/micro_ros_arduino/bin - arduino-cli core install OpenCR:OpenCR -v - arduino-cli core install arduino:samd -v - arduino-cli core install arduino:sam -v - arduino-cli core install arduino:mbed -v - arduino-cli core install esp32:esp32 -v - arduino-cli core install teensy:avr@1.58.0 -v - arduino-cli core install Seeeduino:samd -v - # - # PATCHING TEENSY AND SAM - cat checkout/extras/patching_boards/platform_teensy.txt > /github/home/.arduino15/packages/teensy/hardware/avr/1.58.0/platform.txt - # remove when https://github.com/arduino/ArduinoCore-sam/pull/115 merged - cat checkout/extras/patching_boards/platform_arduinocore_sam.txt > /github/home/.arduino15/packages/arduino/hardware/sam/1.6.12/platform.txt - # - # BUILDING EXAPLE FOR EACH PLATFORM - arduino-cli core update-index - arduino-cli lib update-index - arduino-cli lib install WiFiNINA - arduino-cli lib install "STM32duino X-NUCLEO-IKS01A3" - arduino-cli lib install "Seeed Arduino rpcWiFi" # Dependent libraries(e.g. "Seeed Arduino rpcUnified") will be installed together. See https://wiki.seeedstudio.com/Wio-Terminal-Network-Overview/#needed-libraries-for-wi-fi for more details. - # Build all demos - arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_addtwoints_service -v - arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_reconnection_example -v - arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_subscriber -v - arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_subscriber_twist -v - arduino-cli compile --fqbn OpenCR:OpenCR:OpenCR /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_tf_publisher -v - arduino-cli compile --fqbn teensy:avr:teensy41 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_time_sync -v - arduino-cli compile --fqbn teensy:avr:teensy41 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_types_handling -v - # Build one demo for each platform - arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_decibels -v - arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_IMU_ML -v - arduino-cli compile --fqbn arduino:mbed:nanorp2040connect /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v - arduino-cli compile --fqbn teensy:avr:teensy31 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - arduino-cli compile --fqbn teensy:avr:teensy35 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - arduino-cli compile --fqbn teensy:avr:teensy36 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - arduino-cli compile --fqbn teensy:avr:teensy41 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - arduino-cli compile --fqbn teensy:avr:teensy40 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - arduino-cli compile --fqbn arduino:samd:arduino_zero_native /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - arduino-cli compile --fqbn arduino:sam:arduino_due_x /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - # arduino-cli compile --fqbn arduino:mbed:envie_m4 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - arduino-cli compile --fqbn arduino:mbed:envie_m7 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - arduino-cli compile --fqbn arduino:mbed:envie_m7 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v - arduino-cli compile --fqbn esp32:esp32:esp32 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher -v - arduino-cli compile --fqbn esp32:esp32:esp32 /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v - arduino-cli compile --fqbn Seeeduino:samd:seeed_wio_terminal /github/home/Arduino/libraries/micro_ros_arduino/examples/micro-ros_publisher_wifi -v diff --git a/.github/workflows/library_generation.yml b/.github/workflows/library_generation.yml deleted file mode 100755 index a84d617ea..000000000 --- a/.github/workflows/library_generation.yml +++ /dev/null @@ -1,45 +0,0 @@ -name: Library generator -on: - workflow_dispatch: - inputs: - name: - description: "Manual trigger" - schedule: - - cron: '0 6 * * *' - -jobs: - micro_ros_arduino_generate: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - include: - - distro: foxy - branch: foxy - - distro: rolling - branch: main - - distro: galactic - branch: galactic - steps: - - uses: actions/checkout@v2 - with: - ref: ${{ matrix.branch }} - - name: Get date - id: date - run: echo "::set-output name=date::$(date +'%d-%m-%Y %H:%M')" - - name: Update libraries - run: | - docker run --rm -v $(pwd):/project --env MICROROS_LIBRARY_FOLDER=extras microros/micro_ros_static_library_builder:${{ matrix.distro }} - sudo chown -R $(whoami) . - sudo chmod -R 777 . - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 - with: - commit-message: micro-ROS ${{ matrix.distro }} Library auto-update ${{ steps.date.outputs.date }} - title: micro-ROS Library auto-update ${{ steps.date.outputs.date }} - body: This PR is autogenerated and updates the micro-ROS Arduino library. Close and reopen to trigger CI. - branch: autoupdate_micro_ros_arduino_${{ matrix.branch }} - delete-branch: true - reviewers: pablogs9 - base: ${{ matrix.branch }} - diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 000000000..a3c57801c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "extras/library_generation/extra_packages/kaia_msgs"] + path = extras/library_generation/extra_packages/kaia_msgs + url = https://github.com/kaiaai/kaia_msgs/ diff --git a/README.md b/README.md index 1030109d3..f2dd18dbb 100755 --- a/README.md +++ b/README.md @@ -1,138 +1,74 @@ -![banner](.images/banner-dark-theme.png#gh-dark-mode-only) -![banner](.images/banner-light-theme.png#gh-light-mode-only) - -# micro-ROS for Arduino - -This is a micro-ROS library for baremetal projects based on Arduino IDE or Arduino CLI. - -As the build process for ROS 2 and micro-ROS is based on custom meta-build system tools and [CMake](https://cmake.org/), this library is provided as a precompiled library. However, users can rebuild their own precompiled libraries in order to modify the micro-ROS configuration or [RMW parameters](https://micro.ros.org/docs/tutorials/advanced/microxrcedds_rmw_configuration/) by customizing the respective [.meta file](https://github.com/micro-ROS/micro_ros_arduino/tree/main/extras/library_generation). - -- [micro-ROS for Arduino](#micro-ros-for-arduino) - - [Supported boards](#supported-boards) - - [How to use the precompiled library](#how-to-use-the-precompiled-library) - - [Arduino IDE](#arduino-ide) - - [PlatformIO](#platformio) - - [How to build the precompiled library](#how-to-build-the-precompiled-library) - - [Patch Arduino board for support precompiled libraries](#patch-arduino-board-for-support-precompiled-libraries) - - [Patch Teensyduino](#patch-teensyduino) - - [Patch SAM](#patch-sam) - - [Purpose of the Project](#purpose-of-the-project) - - [License](#license) - - [Known Issues/Limitations](#known-issueslimitations) - -## Supported boards - -Supported boards are: - -| Board | Min version | State | Details | .meta file | -| ----------------------------------------------------------------------------------------------------------- | ----------- | ---------- | ---------------------------------------------------------------------------------------------------- | ------------------------ | -| [Arduino Portenta H7 M7 Core](https://store.arduino.cc/portenta-h7) | v1.8.5 | Supported | Official Arduino support | `colcon.meta` | -| [Arduino Nano RP2040 Connect](https://docs.arduino.cc/hardware/nano-rp2040-connect) | v1.8.5 | Supported | Official Arduino support | `colcon_verylowmem.meta` | -| [OpenCR](https://emanual.robotis.com/docs/en/parts/controller/opencr10/) | v1.4.16 | Supported | [Based on custom board](https://emanual.robotis.com/docs/en/parts/controller/opencr10/#arduino-ide) | `colcon.meta` | -| [Teensy 4.0](https://www.pjrc.com/store/teensy40.html) | v1.8.5 | Not tested | [Based on Teensyduino (1.58.x)](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon.meta` | -| [Teensy 4.1](https://www.pjrc.com/store/teensy41.html) | v1.8.5 | Supported | [Based on Teensyduino (1.58.x)](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon.meta` | -| [Teensy 3.2/3.1](https://www.pjrc.com/store/teensy32.html) | v1.8.5 | Supported | [Based on Teensyduino (1.58.x)](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon_lowmem.meta` | -| [Teensy 3.5](https://www.pjrc.com/store/teensy35.html) | v1.8.5 | Not tested | [Based on Teensyduino (1.58.x)](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon_lowmem.meta` | -| [Teensy 3.6](https://www.pjrc.com/store/teensy36.html) | v1.8.5 | Supported | [Based on Teensyduino (1.58.x)](https://www.pjrc.com/arduino-ide-2-0-0-teensy-support/) | `colcon_lowmem.meta` | -| [ESP32 Dev Module](https://docs.espressif.com/projects/arduino-esp32/en/latest/boards/ESP32-DevKitC-1.html) | v1.8.5 | Supported | [Arduino core for the ESP32 (v2.0.2)](https://github.com/espressif/arduino-esp32/releases/tag/2.0.2) | `colcon.meta` | - -Community contributed boards are: - -| Board | Min version | Contributor | Details | .meta file | -| ---------------------------------------------------------------------------------------- | ----------- | ---------------------------------------------- | ------- | ------------------------ | -| [Arduino Due](https://store.arduino.cc/arduino-due) | - | [@lukicdarkoo](https://github.com/lukicdarkoo) | | `colcon_verylowmem.meta` | -| [Arduino Zero](https://store.arduino.cc/arduino-zero) | - | [@lukicdarkoo](https://github.com/lukicdarkoo) | | `colcon_verylowmem.meta` | -| [Kakute F7](http://www.holybro.com/product/kakute-f7-aio-v1-5/) | - | [@amfern](https://github.com/amfern) | | `colcon.meta` | -| [STM32-E407](https://www.olimex.com/Products/ARM/ST/STM32-E407/resources/STM32-E407.pdf) | - | [@dominikn](https://github.com/dominikn) | | `colcon.meta` | -| [Wio Terminal](https://wiki.seeedstudio.com/Wio-Terminal-Getting-Started/) | - | [@maehara-keisuke](https://github.com/maehara-keisuke) | | `colcon.meta` | - -You can find the available precompiled ROS 2 types for messages and services in [available_ros2_types](available_ros2_types). - -## How to use the precompiled library - -### Arduino IDE - -Go to [link to release section](https://github.com/micro-ROS/micro_ros_arduino/releases) and download the last release of micro-ROS library for Arduino. - -Include it in your project using `Sketch -> Include library -> Add .ZIP Library...` - -You can test micro-ROS examples located in this repo examples folder. - -Remember that is possible to use a micro-ROS Agent just with this docker command: - -```bash -# Serial micro-ROS Agent -docker run -it --rm -v /dev:/dev --privileged --net=host microros/micro-ros-agent:rolling serial --dev [YOUR BOARD PORT] -v6 +# Micro-ROS Arduino library for [Kaia.ai](https://kaia.ai) robots platform + +This is a fork of [Micro-ROS Arduino library](https://github.com/micro-ROS/micro_ros_arduino) +adapted to [Kaia.ai](https://kaia.ai/)-based robots. Specifically, this adapted fork + +- successfully builds on Windows PC when using `git clone` to download the library +- adds [kaia_msgs](https://github.com/kaiaai/kaia_msgs/) ROS2 package +- moves WiFi.begin() outside of the Micro-ROS library for cleaner and convenient code development +- tweaks colcon.meta to optimize library features, performance and memory usage +- sets up the library for inclusion into the Arduino Library Manager + +## Install a library release by .ZIP download +- Navigate to the [release section](https://github.com/kaiaai/micro_ros_arduino_kaia/releases) +and download the latest `micro_ros_arduino_kaia_prebuilt.zip` release +- Launch your Arduino IDE, open the Sketch -> Include library -> Add .ZIP Library... menu and +select the downloaded `kaia_arduino_lib_prebuilt.zip` file +- In your Arduino IDE, configure Tools -> Board as "ESP32 Dev Module" and leave the board settings at their defaults + +## Install library using git +Alternatively, you can `git clone` this library as follows. This method may be useful if you need to edit library files or check out different versions of the library. +- confirm the location of your Arduino sketches by opening File -> Preferences in +your Windows Arduino IDE and noting the path "Sketchbook location" path, for example `C:\Users\YOUR-USER-NAME\Documents\Arduino` +- append `\libraries` to the sketchbook location path to get the path to your Arduino libraries, +e.g. `C:\Users\YOUR-USER-NAME\Documents\Arduino\libraries` +- make sure you have installed [Git for Windows](https://gitforwindows.org/) or a similar Windows Git tool +- run commands below in a Windows shell to clone this library to your Windows PC ``` -### PlatformIO - -PlatformIO support for this repository has been deprecated in favor of its own build system: [micro_ros_platformio](https://github.com/micro-ROS/micro_ros_platformio) - -## How to build the precompiled library - -If you need to add custom packages or types, or customize any internal parameter of the micro-ROS stack, you will need to recompile this library from source code: - -```bash -docker pull microros/micro_ros_static_library_builder:rolling -docker run -it --rm -v $(pwd):/project --env MICROROS_LIBRARY_FOLDER=extras microros/micro_ros_static_library_builder:rolling +cmd.exe +cd %HOMEPATH%\Documents\Arduino\libraries +git clone -b rolling --depth 1 --recurse-submodules https://github.com/kaiaai/micro_ros_arduino_kaia micro_ros_kaia ``` -Optionally a specific single target can be built using the `-p ` argument like this: +Now you can include this library into your sketch using `#include `. -```bash -docker run -it --rm -v $(pwd):/project --env MICROROS_LIBRARY_FOLDER=extras microros/micro_ros_static_library_builder:rolling -p +## API tweaks +Now you can handle connecting to WiFi as you see fit, instead of Micro-ROS doing this for you. For example: ``` - -Available targets `LIBRARY_TARGETS` are available on the [top of the extras/library_generation/library_generation.sh file](https://github.com/micro-ROS/micro_ros_arduino/blob/main/extras/library_generation/library_generation.sh#L13-L24) - -Folders added to `extras/library_generation/extra_packages` and entries added to `extras/library_generation/extra_packages/extra_packages.repos` will be taken into account by this build system. -This should be used for example when adding custom messages types or custom micro-ROS packages. - -You can [configure many parameters](https://micro.ros.org/docs/tutorials/advanced/microxrcedds_rmw_configuration/) of the library by editing the respective `.meta` file in the `extras/library_generation/` directory. - -## Patch Arduino board for support precompiled libraries -### Patch Teensyduino - -Go inside your Arduino + Teensyduino installation and replace `platform.txt`: - -```bash -export TEENSYDUINO_VERSION=[Your Teensyduino library version, e.g: 1.58.0] -export ARDUINO_PATH=[Your Arduino + Teensyduino path] -cd $ARDUINO_PATH/hardware/avr/$TEENSYDUINO_VERSION/ -curl https://raw.githubusercontent.com/micro-ROS/micro_ros_arduino/main/extras/patching_boards/platform_teensy.txt > platform.txt + WiFi.begin(ssid, passw); + Serial.print("Connecting to WiFi "); + + unsigned long startMillis = millis(); + while (WiFi.status() != WL_CONNECTED) { + if (millis() - startMillis >= 10000) { + Serial.println(" timed out"); + return; + } + Serial.print('.'); // Don't use F('.'), it crashes ESP32 + delay(500); + } + + Serial.println(F(" connected")); + Serial.print(F("IP ")); + Serial.println(WiFi.localIP()); + + set_microros_wifi_transports("192.168.1.57", 8888); // Micro-ROS setup ``` -The patch applies the changes detailed on the first two sections of this post: [Solution for adding support for pre-compiled Libraries](https://forum.pjrc.com/threads/63256-Solution-for-adding-support-for-pre-compiled-Libraries) -### Patch SAM +## Kaia.ai Arduino ESP32 firmware +Download the Kaia.ai firmware project code from the [Kaia.ai Arduino firmware repo](https://github.com/kaiaai/kaia_arduino_fw), +open the downloaded kaia_esp32.ino project file in your Arduino IDE and click the build button. +The project should build successfully. At this point, feel free to burn your ESP32 module with the compiled code and/or modify the firmware to your liking. -Go inside your Arduino installation and replace `platform.txt`: - -```bash -export ARDUINO_PATH=[Your Arduino path] -cd $ARDUINO_PATH/hardware/sam/1.6.12/ -curl https://raw.githubusercontent.com/micro-ROS/micro_ros_arduino/main/extras/patching_boards/platform_arduinocore_sam.txt > platform.txt +## Extend, modify and rebuild [Micro-ROS Arduino library for Kaia.ai](https://kaia.ai/) +In some cases, tayloring [Kaia.ai](https://kaia.ai/) software to your particular robot may require tweaking the Kaia.ai library code in addition to the Kaia.ai firmware - for example to add new types of Micro-ROS messages. Follow these steps to [extend and/or adapt](https://micro.ros.org/docs/tutorials/advanced/create_new_type/) and rebuild the Kaia.ai Arduino library on Windows for your particular robot design. +- Install Docker for your PC platform, e.g. [Docker for Windows](https://docs.docker.com/desktop/install/windows-install/) and make sure the Docker agent is running +- Install the [Micro-ROS Arduino library for Kaia.ai](https://github.com/kaiaai/micro_ros_arduino_kaia/) using the instructions above. Let's assume you are using Arduino IDE for Windows and your Arduino libraries are stored under `C:\Users\YOUR-USER-NAME\Documents\Arduino\libraries`. +- Open a Windows command shell and run these commands to rebuild the library using the [Micro-ROS library builder](https://github.com/micro-ROS/micro_ros_arduino): +``` +cmd.exe +cd %HOMEPATH%\Documents\Arduino\libraries +git clone -b rolling --depth 1 --recurse-submodules https://github.com/kaiaai/micro_ros_arduino_kaia micro_ros_kaia +docker run -it --rm -v .\micro_ros_kaia:/project --env MICROROS_LIBRARY_FOLDER=extras microros/micro_ros_static_library_builder:rolling -p esp32 ``` - -## Purpose of the Project - -This software is not ready for production use. It has neither been developed nor -tested for a specific use case. However, the license conditions of the -applicable Open Source licenses allow you to adapt the software to your needs. -Before using it in a safety relevant setting, make sure that the software -fulfills your requirements and adjust it according to any applicable safety -standards, e.g., ISO 26262. - -## License - -This repository is open-sourced under the Apache-2.0 license. See the [LICENSE](LICENSE) file for details. - -For a list of other open-source components included in this repository, -see the file [3rd-party-licenses.txt](3rd-party-licenses.txt). - -## Known Issues/Limitations - -- When using provided precompiled libraries, users should take into account the already configured static memory pools in middleware layers. [More info here](https://micro.ros.org/docs/tutorials/advanced/microxrcedds_rmw_configuration/). -- micro-ROS transports should be refactored in order to provide a pluggable mechanisms. Only USB serial transports are provided. -- Teensyduino support files have to be patched in order to use precompiled libraries. -- To solve Python errors on ESP32 compilation: `apt install python-is-python3 && pip3 install pyserial` diff --git a/extras/library_generation/extra_packages/kaia_msgs b/extras/library_generation/extra_packages/kaia_msgs new file mode 160000 index 000000000..a45119783 --- /dev/null +++ b/extras/library_generation/extra_packages/kaia_msgs @@ -0,0 +1 @@ +Subproject commit a4511978352557e4625cddf6677cd2c6d2e6ee51 diff --git a/library.properties b/library.properties index 13013da10..dd88863a2 100755 --- a/library.properties +++ b/library.properties @@ -1,10 +1,10 @@ -name=micro_ros_arduino -version=2.0.6-rolling -author=micro-ROS -maintainer=Pablo Garrido -sentence=micro-ROS Arduino library -paragraph=micro-ROS Arduino library -url=https://github.com/micro-ROS/micro_ros_arduino +name=micro_ros_kaia +version=2.0.7-rolling +author=micro-ROS, Kaia.ai +maintainer=Ilia O. +sentence=micro-ROS Arduino library for Kaia.ai robots +paragraph=Forked from https://github.com/micro-ROS/micro_ros_arduino/ +url=https://github.com/kaiaai/micro_ros_arduino_kaia/ precompiled=true -category=Other +category=Communication architectures=stm32,OpenCR,Teensyduino,samd,sam,mbed,esp32,mbed_portenta diff --git a/src/micro_ros_arduino.h b/src/micro_ros_arduino.h index 618d672ad..be3d7664a 100755 --- a/src/micro_ros_arduino.h +++ b/src/micro_ros_arduino.h @@ -121,6 +121,15 @@ struct micro_ros_agent_locator { static inline void set_microros_wifi_transports(char * ssid, char * pass, char * agent_ip, uint agent_port){ + #if defined(BOARD_WITH_ESP_AT) + ESP_AT_SERIAL_PORT.begin(ESP_AT_BAUDRATE); + while (!ESP_AT_SERIAL_PORT) { + } + WiFi.init(ESP_AT_SERIAL_PORT, ESP_AT_RESET_PIN); + while (WiFi.status() == WL_NO_MODULE) { + } + #endif + WiFi.begin(ssid, pass); while (WiFi.status() != WL_CONNECTED) { @@ -141,6 +150,22 @@ static inline void set_microros_wifi_transports(char * ssid, char * pass, char * ); } +static inline void set_microros_wifi_transports(char * agent_ip, uint agent_port){ + + static struct micro_ros_agent_locator locator; + locator.address.fromString(agent_ip); + locator.port = agent_port; + + rmw_uros_set_custom_transport( + false, + (void *) &locator, + arduino_wifi_transport_open, + arduino_wifi_transport_close, + arduino_wifi_transport_write, + arduino_wifi_transport_read + ); +} + #endif #endif // MICRO_ROS_ARDUINO diff --git a/src/micro_ros_kaia.h b/src/micro_ros_kaia.h new file mode 100644 index 000000000..9381c8d95 --- /dev/null +++ b/src/micro_ros_kaia.h @@ -0,0 +1,6 @@ +#ifndef MICRO_ROS_KAIA +#define MICRO_ROS_KAIA + +#include + +#endif