ROS Resources: Documentation | Support | Discussion Forum | Service Status | Q&A answers.ros.org

micro-ROS teensy support?

We are using teensy boards (Cortex-M4) in numerous projects with ROS1 and rosserial arduino. As we are transitioning to ROS2, we are wandering how we will upgrade our teensy boards (one easy solution would be to just use ros1 bridge along with rosserial arduino and not change anything). Hence we are contemplating the idea of running mirco-ROS on our teensys. Is there any planned support for these boards or anywhere to start?
It looks like it is possible, with some effort, to run FreeRTOS on them: http://rishifranklin.blogspot.com/2014/03/freertos-on-teensy-31.html
Same for Zephir: https://forum.pjrc.com/threads/50241-(Question)-zephyr-support-for-teensy-3-x?p=236219&viewfull=1#post236219

7 Likes

I would love to see this happen. I think microROS should be the default replacement for ROS Serial / Arduino (that’s just my humble opinion). I think @FraFin might be the person to talk to.

6 Likes

Thanks Katherine!

@doisyg , we are studying your case. You will hear from us soon, but yes, it seems totally possible.

2 Likes

Great! If there is a need for tests on our side, we use Teensy 3.2 boards

2 Likes

@doisyg Thanks for the info! (and @Katherine_Scott for the redirection :slight_smile:)
Here at micro-ROS, we’d love to give support to Teensy boards, and this is coming with surprisingly perfect timing as we are internally developing a line to get Arduino IDE support right now!

It would be interesting for us if you could provide some insight regarding your build system and workflow. We have recently developed a tool for integrating micro-ROS into external platforms, which has already proven to work pretty well in a couple of use-cases and that could come in handy.

1 Like

Good to know that it is getting closer!
We simply use the Arduino IDE with the Teensyduino extension installed https://www.pjrc.com/teensy/teensyduino.html and the ros lib built (rosrun rosserial_arduino make_libraries.py .)
Then we use the .hex firmware generated by the Arduino IDE and we can deploy and flash it using a CLI tool (teensy_loader_cli).
So if micro-ROS could be used with the Arduino IDE, that would be strictly equivalent in our workflow.
Of course we would love to have the build automated with CMake and catkin/colcon, but that can be a long term goal (we managed to do it for regular Arduino boards but never succeeded for Teensys)

So if micro-ROS could be used with the Arduino IDE, that would be strictly equivalent in our workflow.

Nice!
We’d love to discuss all these matters ‘in person’ someday soon. We think we may have valuable knowledge to share regarding the points raised above.

.

2 Likes

Sure, don’t hesitate.

1 Like

I would also love to run micro-ROS on a Teensy 4.

Zephyr already has support for the NXP MIMXRT1060-EVK board so porting it to the Teensy 4 should be pretty straightforward.

When uploading to one or more Teensy boards, you might consider using tycmd, rather than the teensy_loader_cli, to make it easier to manage multiple boards connected simultaneously.

Also you might want to consider PlatformIO support as well as the Arduino IDE. I find that makes it easier to build things from the command line.

2 Likes

Hello everyone, it would be very nice to see a Zephyr port for the Teensy boards, if you @peterpolidoro have some ideas it would be great to hear about them. Definety this port will ease a lot the usage of micro-ROS in Teensy boards.

Regarding our roadmap:

  • We have implemented some ideas we have on the Arduino IDE integration, currently it takes advantage of the ability to link against pre-compiled libraries. I have tested it in the Robotis’ OpenCR and works well over USB-serial transport, but we also have prepared a preliminary Teensyduino support. You can check it here. We have ordered a Teensy 3.2 and 4.2, so next week we will test it and update you about the status and functionality.
  • Regarding PlatformIO, it is clear that more and more users are starting to use it and it would be awesome to have a micro-ROS port for it. Maybe we can talk internally about this possibility @FraFin @jamoralp.

Thanks you all, and I hope I can come back with good news when we receive the Teensy boards.

2 Likes

Hello @doisyg and @peterpolidoro. I’m super happy to announce that we have received a couple of Teensy boards (4.1 and 3.2) and we have tested the micro-ROS Arduino IDE integration.

They work pretty well, on both boards the micro-ROS client uses the USB serial to talk with the micro-ROS Agent (this can be updated to use any other transport in a future release).

Please check the micro-ROS for Arduino repo. Please notice that your have a to tweak a bit your installed platform.txt in order to enable static library linking.

By the way, anyone knows how to integrate these changes in the official Teensyduino in the same way we did here? I have already opened an issue.

In general, having Arduino IDE and the Teensyduino extension and after patching the platform.txt you can build and flash the micro-ros_publisher into the Teensy board and open a micro-ROS Agent like this:

ros2 run micro_ros_agent micro_ros_agent serial --dev /dev/serial/by-id/usb-Teensyduino_USB_Serial... -v6

For any doubt or question do not hesitate to contact us.

Hope you like it!

PD: we have not tested it in the Teensy 4.0, just in the 4.1, but I guess that having the same MCU it should work. Could anyone that has this 4.0 board test it a report if it works?

5 Likes

Amazing! We will test it in the next few days !

1 Like

Awesome, thank you so much! I will test it on the Teensy 4.0 sometime this week and let you know how it goes.

Yes, the 4.0 uses exactly the same MCU as the 4.1 so it should work just fine. There are a few minor differences in the Teensyduino code, for example fewer serial ports are enabled on the 4.0.

To integrate changes into the official Teensyduino, you might want to post a message about it on the Teensy Forum. Paul, the creator of Teensy, is very active on there. The Teensy community seems reluctant to use any RTOS, though, preferring bare-metal programming instead. Also most people on there are probably not familiar with ROS either, so you might want to provide a little background on why this may be interesting to them.

USB serial is a good way for the client to talk to the agent since the firmware gets loaded over USB and leaving it connected allows firmware updates. I have a project right now, though, that uses 16 Teensy boards in a distributed system and I am finding that many laptops and desktops cannot connect to that many boards simultaneously over USB, although it does work with a Raspberry Pi. I always thought hundreds of USB devices could be connected to a host computer, but that is not true in many cases.

Someday it might be interesting to allow clients to send messages to each other directly over something like CAN bus so more boards can be connected with more deterministic communication timing without the USB and agent delays.

1 Like

We were looking at the potential of teensy 4.1 for micro-ros using both ethernet channels for ethercat supported by the mcu which would provide much higher speeds than usb or 485., wasn’t sure what headroom or sram would be available for the ethercat slave code

ie https://github.com/OpenEtherCATsociety/SOES.

Has anyone looked at this sort of option or willing to look at it to check it out?

Hello @kfriesth, in order to implement these kinds of custom transports I guess that some minor changes will be needed at some points. Are you planning to use the Arduino IDE for programming this Teensy 4.1 or you have another kind of custom build system?

I think that using Ethernet or EtherCAT in Teensy 4.1 would be interesting despite the need of having to purchase an external RJ45 connector.

Let us know if you figure out how to embed your transport library. Here at micro-ROS team, we will be happy to help you to integrate it in the micro-ROS stack.

I am interested in getting Ethernet working on Teensy boards and I may have some time to work on that when I finish up my current projects. One slight issue is that uploading new firmware to Teensy boards requires USB right now so Ethernet cannot be the one and only communication channel to the board.

Are you committed to Ethercat? Is that proprietary? More deterministic communication would be great, but something open source would be even better.

I have been super curious about trying TSN ever since @vmayoral and his group used it on their H-ROS hardware. I do not know if that is considered open source either, though, and that may require extra hardware or an FPGA. So that might be a better fit for Zync-based boards.

The use in chiips for the slave is protected, there is however open source ethercat linux software solutions such as the one I linked. https://github.com/OpenEtherCATsociety/SOES.

Another solution would be changing the DP83825I phy to relatively cheap LAN9252/ LAN9253/ LAN9254 https://www.microchip.com/wwwproducts/en/LAN9252 chip solution for a hardware solution to ethercat.

In general, I think it is wise to offload to dedicated chips as much as possible, saving the microcontroller for other processing and for connecting all of the chips together. Many people disagree with that, though, and prefer to do everything in firmware and software.

It might make sense to implement all of the communication protocol in firmware if it allowed you to avoid making custom hardware. Since you have to add an external RJ45 connector anyway, though, in my opinion you might as well add a nice IC to properly handle the communication details.

Do you think EtherCAT is better than Time Sensitive Networking? Or do you have other parts of your system that require it?

Our plan is to use this with some open source robotic arms we are developing. if you load up everything on firmware and hardware you have to scale the processor and support components.

For instance with a modular robot with mcu’s at each arm joint you could use the use offload chips like LAN9252/3/4 you can now network via ethercat with very low jitter, If you need encoders you could add trinimac TMC4671-LA chips you can then interface stepper, servo or bldc motors, add external drivers, have encoding, temp, voltage, current sensing, brake control with connecting at an arm joint to a single mcu chip or use them for industrial bots placing the controllers and drivers at the base and then using mcu’s for networking and sensors at the joint. You can of course use cheaper trinimac chips or similar controllers for those not needing or wanting encoding functionality and such built in.

Sounds like a nice design. I am a big fan of Trinamic chips, I have used them with Teensy boards on many projects.

Your whole system sounds very similar to H-ROS, which I still think was a fantastic idea even though it is no longer being developed.