Git Product home page Git Product logo

micro_ros_renesas2estudio_component's Introduction

banner banner

micro-ROS for Renesas e2 studio

micro-ROS HIL tests micro-ROS HIL agent

This package eases the integration of micro-ROS in a Renesas e2 studio. This components targets Renesas RA family, an ARM Cortex-M based MCU series, enabling a full micro-ROS compatibility for developing robotics and IoT applications.


Supported platforms

MCU Family Reference board Transports
RA6M5 RA Series EK-RA6M5 USB-CDC
Serial UART
UDP (FreeRTOS + TCP)
UDP (ThreadX + NetX)
TCP (AWS Secure Sockets)
CAN FD
RA6T2 RA Series MCK-RA6T2 Serial UART
CAN FD

Requirements

  • Renesas e2 studio for Linux1
  • FSP v4.4.0 board packs for Renesas e2 studio: Details.
  • GNU Arm Embedded Toolchain v10.3.1.20210824 (Other compatible toolchain may work).
  • Install rsync: apt -y install rsync
  • Install colcon and dependencies, for example with:
pip3 install colcon-common-extensions catkin_pkg lark-parser empy

1 Currently only support for Linux is available

Getting started

A ready-to-use example of this component can be found in micro-ROS demos for Renesas e2 studio repo.

Using the micro-ROS Agent

It is possible to use a micro-ROS Agent just by using this docker command:

# UDPv4 micro-ROS Agent
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

# TCPv4 micro-ROS Agent
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

# Serial micro-ROS Agent
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

# CAN-FD micro-ROS Agent
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

There are some other options for using the micro-ROS Agent:

Integrating micro-ROS in your project

micro-ROS can be integrated with a Renesas e2 studio project following these steps:

  1. Clone this repository in your Renesas e2 studio project folder.

  2. Go to Project -> Properties -> C/C++ Build -> Settings -> Build Steps Tab and in Pre-build steps add:

cd ../micro_ros_renesas2estudio_component/library_generation && ./library_generation.sh "${cross_toolchain_flags}"
  1. Add micro-ROS include directory.

    Steps

    In Project -> Settings -> C/C++ Build -> Settings -> Tool Settings Tab -> GNU ARM Cross C Compiler -> Includes

    • add "${workspace_loc:/${ProjName}/micro_ros_renesas2estudio_component/libmicroros/include}" in Include paths (-l)
  2. Add the micro-ROS precompiled library.

    Steps

    In Project -> Settings -> C/C++ Build -> Settings -> Tool Settings Tab -> GNU ARM Cross C Linker -> Libraries

    • add "${workspace_loc:/${ProjName}/micro_ros_renesas2estudio_component/libmicroros}" in Library search path (-L)
    • add microros in Libraries (-l)
  3. Add the following source code files to your project, dragging them to source folder.

    • extra_sources/microros_time.c
    • extra_sources/microros_allocators.c
    • extra_sources/microros_allocators.h
    • extra_sources/microros_transports.h
  4. Configure micro-ROS time reference.

    Steps

    Configure g_timer0 as an r_agt

    1. Double click on the configuration.xml file of your project and go to the Stacks tab.

    2. Select New Stack -> Driver -> Timers -> Timer, Low-Power (r_agt).

    3. Modify the clock period on the component properties (Module g_timer0 Timer, Low-Power (r_agt) -> General -> Period) to 100

    4. Modify the clock period unit on the component properties (Module g_timer0 Timer, Low-Power (r_agt) -> General -> Period Unit) to Microseconds

    5. Modify the count source on the component properties (Module g_timer0 Timer, Low-Power (r_agt) -> General -> Count Source) to PCLKB

    6. Modify the interrupt callback on the component properties (Module g_timer0 Timer, Low-Power (r_agt) -> Interrupt -> Callback) to micro_ros_timer_cb

    7. Modify the underflow interrupt priority on the component properties (Module g_timer0 Timer, Low-Power (r_agt) -> Interrupt -> Underflow Interrupt Priority) to Priority 12

      image

    8. Save the modifications by clicking on Generate Project Content.

  5. Configure micro-ROS memory requirements.

    Bare Metal

    Configure the stack and heap size:

    1. On the configuration.xml menu, go to the BSP tab.

    2. Go to the RA Common section and set the Main stack size (bytes) and Heap size (bytes) fields to 5000 B:

      image

    3. Save the modifications by clicking on Generate Project Content.

    FreeRTOS

    Create and configure the micro-ROS FreeRTOS task:

    1. On the configuration.xml menu, go to the Stacks tab and create a new thread for micro-ROS.

    2. Click on the created thread, then select New Stack -> RTOS -> FreeRTOS Heap 4.

    3. Configure the micro-ROS thread properties:

      1. Set the name of the thread entry function under Thread -> Symbol to micro_ros_thread.
      2. Set Thread -> Stack size (bytes) to 5000 B.
      3. Set Common -> Memory Allocation -> Support Dynamic Allocation to Enable.
      4. Set Common -> Memory Allocation -> Support Static Allocation to Enable.
      5. Set Common -> Memory Allocation -> Total Heap Size to 65000 B.

      image

    4. On the configuration.xml menu, go to the BSP tab.

    5. Go to the RA Common section and set the Main stack size (bytes) and Heap size (bytes) fields to 5000 B:

      image

      Note: It is required to have some heap outside FreeRTOS heap because newlib will use it

    6. Save the modifications clicking on Generate Project Content.

    7. Check that the file thread_microros_entry.c has been created on the project source directory.

    ThreadX

    Create and configure the micro-ROS ThreadX thread:

    1. On the configuration.xml menu, go to the Stacks tab and create a new thread for micro-ROS.

    2. Configure the micro-ROS thread properties:

      1. Set the name of the thread entry function under Thread -> Symbol to micro_ros_thread.
      2. Set and the thread stack size Thread -> Stack size (bytes) to 5000 B.
      3. Increase thread timer resolution Common -> Timer -> Timer Ticks Per Second to 1000 ticks per second.

      image

    3. On the configuration.xml menu, go to the BSP tab.

    4. Go to the RA Common section and set the Main stack size (bytes) and Heap size (bytes) fields to 5000 B:

      image

    5. Save the modifications by clicking on Generate Project Content.

    6. Check that the file thread_microros_entry.c has been created on the project source directory.

  6. Configure the micro-ROS transports: Details.

  7. Add micro-ROS code in your codebase.

  8. Build and run your project.

Adding custom packages to the micro-ROS build

In order to include a custom package in the micro-ROS build, just copy the package folder into library_generation/extra_packages folder. The build system will automatically detect the package and build it along with the micro-ROS library.

Note that a library rebuild is needed to include the package, this can be achieved by deleting the libmicroros generated folder and building your project afterwards.

License

This repository is open-sourced under the Apache-2.0 license. See the LICENSE file for details.

For a list of other open-source components included in this repository, see the file 3rd-party-licenses.txt.

Known Issues / Limitations

There are no known limitations.

micro_ros_renesas2estudio_component's People

Contributors

acuadros95 avatar mamerlan avatar mergify[bot] avatar pablogs9 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

micro_ros_renesas2estudio_component's Issues

Error using this package(FreeRTOS with UDP)

Hi, I tried to use this package follow "Integrating micro-ROS in your project" . I used micro-ROS FreeRTOS with UDP transports. When I Debug. It show error in consloe:
Screenshot from 2022-01-05 13-44-16

Could someone help me solve this problem?

Issues with MicroROS demo on Renesas JP177 + Turtlebot Demo

Hi,
I am facing some issues with the turtlebot demo using Renesas JP177 board and Turtlebot demo's.
I am following the provided PDF documentation to build turtlebot3 using micro ros agent with JP177. I am constantly getting the following error. I tried on both windows and Ubuntu with FSP 3.3, 4.4 and 4.5 versions.

The following are the issues and errors i get. The issues are also mentione in detail on the Reneasa Engineering Community Issue : LINK

Screenshot 2023-08-03 230818 png-640x480

Screenshot 2023-08-03 122058 png-640x480

Screenshot from 2023-08-03 07-43-35 png-640x480
Screenshot from 2023-08-02 00-18-45 png-1182x388

ros publishers not being recompiling correctly

Issue template

  • Hardware description: custom based on R7FA6M5AG
  • RTOS: bare-metal
  • Installation type: uart transport, e2studio
  • Version or commit hash: humble

Steps to reproduce the issue

run a normal publisher:
image

Change a publisher such that the code syntax is wrong
image
Then recompile and it will run still run the old pub0 code without any error.

Change the name to pub1 and it will continue to show up as pub0
image

Expected behavior

Any changes to topic names etc represented in code would actually get compiled

Actual behavior

Changes to the publishers are not represented after some syntax error even after this error has been corrected

Additional information

Question:
Is there a way to have nested topics in microros i.e.

test/pub1
test/pub2
etc

Rather than just:
pub1
pub2

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.