micro-ROS teensy support?

The Teensy also has a CAN FD bus, which could be another nice option for more deterministic communication between devices. The wiring would be pretty minimal and the peer-to-peer nature seems like it would fit well with publish/subscribe data transfer.

In case anybody wants to use this lib with platformio, it appears that adding the following line (for Teensy 4.1)

build_flags = -L ./lib/microros_ros_arduino-0.0.2/imxrt1062/fpv5-d16-hard/ -l libmicroros

to platformio.ini fixes the linker issues, without having to modify the platform.txt file needed when compiling with the Arduino IDE.

Hello @rom1 could you share some instructions for using micro-ROS with PlatformIO?

Iā€™m still testing it right now, but so far it does compile and upload correctly. All thatā€™s needed is to create a new PlatformIO project, placing the micro_ros_arduino folder inside the lib/ folder thatā€™s generated when you create a new project. After that, you need to modify the platform.txt file to add the build_flags, itā€™ll end up looking something like this (in my case, the micro_ros_arduino is named microros):

[env:teensy41]
platform = teensy
board = teensy41
framework = arduino
build_flags = -L ./lib/microros/imxrt1062/fpv5-d16-hard/ -l libmicroros

You might need to add #include <Arduino.h> to some files, since platformio does not include it by default. Iā€™ve been trying to test it but havenā€™t been able to compile the micro_ros_agent to do so.

1 Like

The issue that the Agent has this weeking is solved check here and here.

Let me know if you have any other problem build the agent and please give us feedback about the PlatformIO + micro-ROS behavior.

Oh, thanks, that was exactly the issue that I was getting. Iā€™ll get back to you after I test this. On an unrelated note, does micro-ROS support UART? I modified the teensy_transports.c just to test with the normal arduino Serial.write() and Serial.read().

Update: the example publisher works well when compiled with PlatformIO and using uart.

1 Like

Cool, maybe we can do some kind of tutorial in order to show this PlatformIO initial test to the community.

Thoughts @FraFin @jamoralp?

Sounds good @pablogs. Nice work @rom01! Thanks for sharing it!

1 Like

In case of anyone interested to know how to connect and use micro-ros with teensy, I have published a tutorial article in this link. how-to-connect-teensy-3-2-with-micro-ros-and-ros2-foxy. Hope this helps someone.

2 Likes

Thanks for this great quality article!

1 Like

Hi guys, I managed to run a simple pub-sub demo using PlatformIO. I documented my progress here GitHub - linorobot/micro_ros_platformio

1 Like

Is there any potential way to create a ROS 2 node on a microcontroller without the Micro-ROS agent? I was thinking about whether it would be possible to create a simple pub/sub (constrained even to a single type like String is fine!) with a ESP32 microcontroller that is not reliant on an agent living somewhere else, as that breaks decentralization.

Hello, the brokerless P2P does not entirely fit your needs because it only communicates micro-ROS nodes, and in this P2P mode there is no interaction between micro-ROS and ROS 2.

With no agent, one idea could be to write a RMW with a lightweight RTPS compatible middleware, for example embeddedRTPS. We think that it is possible to port embeddedRTPS to the ESP32 LwIP layer and will look into it.

Manzur, I followed your excellent article but still havenā€™t been successful at getting things to work. Everything seems to work up until I try to list the topics. The publish topic from the teensy does not show up, and consequently I canā€™t access the data.
I put some checks in the teensy code to see where it is not working, but everything seems to be working on the teensy end including the publish data. No errors detected. (I have an LCD display where I can see some data.)
I am using Ubuntu 20.04, Arduino 1.8.13, ros2 foxy, and a USB connection to the teensy.
Any help you could provide would be appreciated.

@higginsr Can you make sure to run the micro-ROS agent program first and then connect the teensy to the computer. Thanks

I have started the agent on the main processor, and get the familiar ā€œserial port not foundā€ message, as the teensy is powered off. I then power on the teensy, and it seems to connect, as I get all the messages that you show in the tutorial. From the changes I made to the code on the teensy to display info on the LCD, it appears that the teensy goes through the setup code and starts the publish, ( the mes.data counts up the way it should). I still donā€™t get anything when I try to list the topic. I looked at the USB data lines and there is a burst of data about every 25 microseconds, which seems more than I would expect. Since it is bidirectional data, I am not sure if it is transmit or receive. I am going to try to check that next.

The only thing I am doing differently than the tutorial is I am not running ros2 in a docker.

I am not an expert in ros2 or micro-ros, but can you try sourcing the right ros2 path in your environment. And also running ros2 natively is not an issue but even better.

Not sure what you mean by sourcing the ā€˜rightā€™ ros2 path. I just tried running it under docker, and got the same results.