|
1 | | -To be done |
| 1 | +<br/> |
| 2 | +<a> |
| 3 | + <p align="center"> |
| 4 | + <img width="40%" src=".images/microros_logo.png"> |
| 5 | + <img width="14%" src=".images/PlatformIO_logo.svg"> |
| 6 | + </p> |
| 7 | +</a> |
| 8 | +<br/> |
| 9 | + |
| 10 | +# micro-ROS for PlatformIO |
| 11 | +This is a micro-ROS library for bare metal projects based on platformIO. |
| 12 | + |
| 13 | +The build process for ROS 2 and micro-ROS is based on custom meta-build system tools and [CMake](https://cmake.org/). |
| 14 | +PlatformIO will handle the full build process, including dependencies, compilation and linkage. |
| 15 | + |
| 16 | +- [micro-ROS for PlatformIO](#micro-ros-for-platformio) |
| 17 | + - [Supported boards](#supported-boards) |
| 18 | + - [Requirements](#requirements) |
| 19 | + - [How to add to your project](#how-to-add-to-your-project) |
| 20 | + - [Library configuration](#library-configuration) |
| 21 | + - [ROS 2 distribution](#ros-2-distribution) |
| 22 | + - [Transport configuration](#transport-configuration) |
| 23 | + - [Extra packages](#extra-packages) |
| 24 | + - [Other configuration](#other-configuration) |
| 25 | + - [Custom targets](#custom-targets) |
| 26 | + - [Using the micro-ROS Agent](#using-the-micro-ros-agent) |
| 27 | + - [Examples](#examples) |
| 28 | + - [Purpose of the Project](#purpose-of-the-project) |
| 29 | + - [License](#license) |
| 30 | + - [Known Issues/Limitations](#known-issueslimitations) |
| 31 | + |
| 32 | +## Supported boards |
| 33 | +Supported boards are: |
| 34 | + |
| 35 | +| Board | Platform | Framework | Transports | Default meta file | |
| 36 | +| -------------------------------------------- | ------------- | ----------- | -------------------------------- | ------------------------ | |
| 37 | +| `portenta_h7_m7` | `ststm32` | `arduino` | `serial` <br/> `wifi` | `colcon.meta` | |
| 38 | +| `teensy41` | `teensy` | `arduino` | `serial` <br/> `native_ethernet` | `colcon.meta` | |
| 39 | +| `teensy40` | `teensy` | `arduino` | `serial` | `colcon.meta` | |
| 40 | +| `teensy36` <br/> `teensy35` <br/> `teensy31` | `teensy` | `arduino` | `serial` | `colcon_lowmem.meta` | |
| 41 | +| `due` | `atmelsam` | `arduino` | `serial` | `colcon_verylowmem.meta` | |
| 42 | +| `zero` | `atmelsam` | `arduino` | `serial` | `colcon_verylowmem.meta` | |
| 43 | +| `olimex_e407` | `ststm32` | `arduino` | `serial` | `colcon.meta` | |
| 44 | +| `esp32dev` | `espressif32` | `arduino` | `serial` <br/> `wifi` | `colcon.meta` | |
| 45 | +| `nanorp2040connect` | `raspberrypi` | `arduino` | `serial` <br/> `wifi_nina` | `colcon_verylowmem.meta` | |
| 46 | + |
| 47 | +The community is encouraged to open pull request with custom use cases. |
| 48 | + |
| 49 | +## Requirements |
| 50 | + |
| 51 | +- PlatformIO [local installation](https://docs.platformio.org/en/stable/core/installation.html) or [PlatformIO IDE for VSCode](https://platformio.org/install/ide?install=vscode) |
| 52 | +- PlatformIO needs `git`, `cmake` and `pip3` to handle micro-ROS internal dependencies: |
| 53 | + |
| 54 | + ```bash |
| 55 | + apt install -y git cmake python3-pip |
| 56 | + ``` |
| 57 | + |
| 58 | +## How to add to your project |
| 59 | + |
| 60 | +The library can be included as a regular git library dependence on your `platform.ini` file: |
| 61 | + |
| 62 | +```ini |
| 63 | +... |
| 64 | +lib_deps = |
| 65 | + https://github.com/micro-ROS/micro_ros_platformio |
| 66 | +``` |
| 67 | + |
| 68 | +Now to proceed with the PlatformIO workflow: |
| 69 | + |
| 70 | +```bash |
| 71 | +pio lib install # Install dependencies |
| 72 | +pio run # Build the firmware |
| 73 | +pio run --target upload # Flash the firmware |
| 74 | +``` |
| 75 | + |
| 76 | +After the library is compiled for first time the build process will be skipped, to trigger a library build and apply [library modifications](#library-configuration) on your next platformIO build: |
| 77 | + |
| 78 | +```bash |
| 79 | +# TODO(acuadros95): add clean step |
| 80 | +pio run clean ... # Clean library |
| 81 | +``` |
| 82 | + |
| 83 | +## Library configuration |
| 84 | +This section details the different configuration parameters available on the project `platform.ini` file. |
| 85 | +A explanation for adding custom targets is also present |
| 86 | + |
| 87 | + |
| 88 | +### ROS 2 distribution |
| 89 | +The target ROS 2 distribution can be configured with the `board_microros_distro = <distribution>`, supported values are: |
| 90 | + - `galactic` *(default value)* |
| 91 | + |
| 92 | +### Transport configuration |
| 93 | +The transport can be configured with the `board_microros_transport = <transport>`, supported values are: |
| 94 | + - `serial` *(default value)* |
| 95 | + - `wifi` |
| 96 | + - `wifi_nina` |
| 97 | + - `native_ethernet` |
| 98 | + |
| 99 | +### Extra packages |
| 100 | +Colcon packages can be added to the build process using this two methods: |
| 101 | +- Package directories copied on the `<Project_directory>/extra_packages` folder. |
| 102 | +- Git repositories included on the `<Project_directory>/extra_packages/extra_packages.repos` yaml file. |
| 103 | + |
| 104 | +This should be used for example when adding custom messages types or custom micro-ROS packages. |
| 105 | + |
| 106 | +### Other configuration |
| 107 | +Library packages can be configured with a customized meta file on the project main folder: `microros_user_meta = <file_name.meta>`. |
| 108 | + |
| 109 | +This allows the user to customize the library memory resources or activate optional functionality such as multithreading, including configuration of user [Extra packages](#extra-packages). |
| 110 | + |
| 111 | +- Documentation on available parameters can be found [here](https://micro.ros.org/docs/tutorials/advanced/microxrcedds_rmw_configuration) and [here]([microxrcedds_rmw_configuration](https://micro-xrce-dds.docs.eprosima.com/en/latest/client.html)). |
| 112 | +- Default configurations can be found on the [metas](./metas) folder. |
| 113 | + |
| 114 | + *Note: the [common.meta](./metas/common.meta) file makes general adjustments to the library and shall not be modified by the user.* |
| 115 | + |
| 116 | +## Custom targets |
| 117 | +This library can be easily adapted to different boards, transports or RTOS, to achieve this the user shall provide: |
| 118 | + |
| 119 | +- Custom transport: Custom transport shall follow the signatures shown on [micro_ros_platformio.h](./platform_code/arduino/micro_ros_platformio.h), the [provided sources](./platform_code) can be used as reference along [this documentation](https://micro-xrce-dds.docs.eprosima.com/en/latest/transport.html#custom-transport). |
| 120 | +- `clock_gettime`: [POSIX compliant](https://linux.die.net/man/3/clock_gettime) implementation with a minimum resolution of 1 millisecond. |
| 121 | + This method is used to retrieve the elapsed time on executor spins and reliable communication, an example implementation can be found on [clock_gettime.cpp](./platform_code/arduino/clock_gettime.cpp) |
| 122 | + |
| 123 | +## Using the micro-ROS Agent |
| 124 | +It is possible to use a **micro-ROS Agent** just by using this docker command: |
| 125 | + |
| 126 | +```bash |
| 127 | +# UDPv4 micro-ROS Agent |
| 128 | +docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO udp4 --port 8888 -v6 |
| 129 | + |
| 130 | +# Serial micro-ROS Agent |
| 131 | +docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO serial --dev [YOUR BOARD PORT] -v6 |
| 132 | + |
| 133 | +# TCPv4 micro-ROS Agent |
| 134 | +docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO tcp4 --port 8888 -v6 |
| 135 | + |
| 136 | +# CAN-FD micro-ROS Agent |
| 137 | +docker run -it --rm -v /dev:/dev -v /dev/shm:/dev/shm --privileged --net=host microros/micro-ros-agent:$ROS_DISTRO canfd --dev [YOUR CAN INTERFACE] -v6 |
| 138 | +``` |
| 139 | + |
| 140 | +For the supported transports, only the `serial` and `udp4` versions shall be used, although users can develop |
| 141 | +and use the agent to test their own `tcp4` and `canfd` custom transports. |
| 142 | + |
| 143 | +It is also possible to use custom transports on a `micro-XRCE Agent` instance. More info available [here](https://micro-xrce-dds.docs.eprosima.com/en/latest/agent.html#custom-transport-agent). |
| 144 | + |
| 145 | +## Examples |
| 146 | +The following example projects are available: |
| 147 | +- TODO |
| 148 | + |
| 149 | +## Purpose of the Project |
| 150 | + |
| 151 | +This software is not ready for production use. It has neither been developed nor |
| 152 | +tested for a specific use case. However, the license conditions of the |
| 153 | +applicable Open Source licenses allow you to adapt the software to your needs. |
| 154 | +Before using it in a safety relevant setting, make sure that the software |
| 155 | +fulfills your requirements and adjust it according to any applicable safety |
| 156 | +standards, e.g., ISO 26262. |
| 157 | + |
| 158 | +## License |
| 159 | + |
| 160 | +This repository is open-sourced under the Apache-2.0 license. See the [LICENSE](LICENSE) file for details. |
| 161 | + |
| 162 | +For a list of other open-source components included in this repository, |
| 163 | +see the file [3rd-party-licenses.txt](3rd-party-licenses.txt). |
| 164 | + |
| 165 | +## Known Issues/Limitations |
| 166 | + |
| 167 | +- TODO |
0 commit comments