# micro-ROS teensy support?

**URL:** <https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852>\
**Category:** Embedded\
**Created:** [October 17, 2020, 11:17am UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852 "2020-10-17T11:17:21Z")\
**Posts on this page:** 19\
**Page:** 2

<div class="post-metadata">

**Author:** ![peterpolidoro](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/peterpolidoro/32/2897_2.png) [@peterpolidoro](https://discourse.openrobotics.org/u/peterpolidoro)\
**Post date:** [November 9, 2020, 3:23pm UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/21 "2020-11-09T15:23:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![rom01](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/rom01/32/8422_2.png) [@rom01](https://discourse.openrobotics.org/u/rom01)\
**Post date:** [November 16, 2020, 5:45am UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/22 "2020-11-16T05:45:57Z")

</div>

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

```auto
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.

---

<div class="post-metadata">

**Author:** ![pablogs](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/pablogs/32/7568_2.png) [@pablogs](https://discourse.openrobotics.org/u/pablogs)\
**Post date:** [November 16, 2020, 6:42am UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/23 "2020-11-16T06:42:50Z")

</div>

> [@rom01](#):
>
> In case anybody wants to use this lib with platformio, it appears that adding the following line (for Teensy 4.1)
> 
> ```auto
> 
> ```

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

---

<div class="post-metadata">

**Author:** ![rom01](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/rom01/32/8422_2.png) [@rom01](https://discourse.openrobotics.org/u/rom01)\
**Post date:** [November 16, 2020, 7:09am UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/24 "2020-11-16T07:09:31Z")

</div>

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`):

```auto
[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.

---

<div class="post-metadata">

**Author:** ![pablogs](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/pablogs/32/7568_2.png) [@pablogs](https://discourse.openrobotics.org/u/pablogs)\
**Post date:** [November 16, 2020, 7:16am UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/25 "2020-11-16T07:16:04Z")

</div>

The issue that the Agent has this weeking is solved check [here](https://github.com/micro-ROS/micro_ros_setup/issues/228) and [here](https://github.com/micro-ROS/micro_ros_setup/issues/227).

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

---

<div class="post-metadata">

**Author:** ![rom01](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/rom01/32/8422_2.png) [@rom01](https://discourse.openrobotics.org/u/rom01)\
**Post date:** [November 16, 2020, 7:18am UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/26 "2020-11-16T07:18:15Z")

</div>

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()`.

---

<div class="post-metadata">

**Author:** ![rom01](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/rom01/32/8422_2.png) [@rom01](https://discourse.openrobotics.org/u/rom01)\
**Post date:** [November 16, 2020, 7:52am UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/27 "2020-11-16T07:52:17Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![pablogs](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/pablogs/32/7568_2.png) [@pablogs](https://discourse.openrobotics.org/u/pablogs)\
**Post date:** [November 16, 2020, 8:24am UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/28 "2020-11-16T08:24:16Z")

</div>

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

Thoughts @FraFin @jamoralp?

---

<div class="post-metadata">

**Author:** ![FraFin](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/frafin/32/7614_2.png) [@FraFin](https://discourse.openrobotics.org/u/FraFin)\
**Post date:** [November 17, 2020, 6:33am UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/29 "2020-11-17T06:33:29Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![manzurmurshid](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/manzurmurshid/32/14520_2.png) [@manzurmurshid](https://discourse.openrobotics.org/u/manzurmurshid)\
**Post date:** [July 7, 2021, 3:22pm UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/31 "2021-07-07T15:22:23Z")

</div>

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](https://manzurmurshid.medium.com/how-to-connect-teensy-3-2-with-micro-ros-and-ros2-foxy-6c8f99c9b66a). Hope this helps someone.

---

<div class="post-metadata">

**Author:** ![mamerlan](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/mamerlan/32/11472_2.png) [@mamerlan](https://discourse.openrobotics.org/u/mamerlan)\
**Post date:** [July 8, 2021, 5:37am UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/32 "2021-07-08T05:37:22Z")

</div>

Thanks for this great quality article!

---

<div class="post-metadata">

**Author:** ![grassjelly](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/grassjelly/32/7228_2.png) [@grassjelly](https://discourse.openrobotics.org/u/grassjelly)\
**Post date:** [July 21, 2021, 12:32pm UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/33 "2021-07-21T12:32:27Z")

</div>

Hi guys, I managed to run a simple pub-sub demo using PlatformIO. I documented my progress here [GitHub - linorobot/micro\_ros\_platformio](https://github.com/linorobot/micro_ros_platformio)

---

<div class="post-metadata">

**Author:** ![dheera](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/dheera/32/837_2.png) [@dheera](https://discourse.openrobotics.org/u/dheera)\
**Post date:** [July 21, 2021, 4:35pm UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/34 "2021-07-21T16:35:38Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![mamerlan](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/mamerlan/32/11472_2.png) [@mamerlan](https://discourse.openrobotics.org/u/mamerlan)\
**Post date:** [July 22, 2021, 10:20am UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/35 "2021-07-22T10:20:15Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![higginsr](https://avatars.discourse-cdn.com/v4/letter/h/ac8455/32.png) [@higginsr](https://discourse.openrobotics.org/u/higginsr)\
**Post date:** [August 10, 2021, 4:17pm UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/36 "2021-08-10T16:17:35Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![manzurmurshid](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/manzurmurshid/32/14520_2.png) [@manzurmurshid](https://discourse.openrobotics.org/u/manzurmurshid)\
**Post date:** [August 10, 2021, 5:35pm UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/37 "2021-08-10T17:35:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![higginsr](https://avatars.discourse-cdn.com/v4/letter/h/ac8455/32.png) [@higginsr](https://discourse.openrobotics.org/u/higginsr)\
**Post date:** [August 13, 2021, 8:00pm UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/38 "2021-08-13T20:00:30Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![manzurmurshid](https://sea2.discourse-cdn.com/flex022/user_avatar/discourse.openrobotics.org/manzurmurshid/32/14520_2.png) [@manzurmurshid](https://discourse.openrobotics.org/u/manzurmurshid)\
**Post date:** [August 13, 2021, 8:33pm UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/39 "2021-08-13T20:33:47Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![higginsr](https://avatars.discourse-cdn.com/v4/letter/h/ac8455/32.png) [@higginsr](https://discourse.openrobotics.org/u/higginsr)\
**Post date:** [August 13, 2021, 9:32pm UTC](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852/40 "2021-08-13T21:32:01Z")

</div>

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

[Previous page](https://discourse.openrobotics.org/t/micro-ros-teensy-support/16852.md?page=1)
