ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

ROS2 Serial Communication with Arduino

asked 2020-11-05 17:21:16 -0600

andrew_103 gravatar image

updated 2020-11-10 18:28:13 -0600

I've got a project in which I'm using a Raspberry Pi 4B running ROS2 Dashing with an Arduino Due. I want to have the two boards communicate over a serial connection and I've been looking for solutions, of which I've found a couple: microROS and OSRF's ros2_serial_example repository.

On the ROS side, I want serial communication to happen on a Python node. I've been running into issues setting up microROS and its not clear from the docs if ros2_serial_example can be used by a Python node. What I'm looking for ultimately are recommendations for a simple way to access the Pi's serial port from within a ROS Python node. If I could use something like PySerial within the node, that would be excellent. Alternatively, if someone could help me understand how to use microROS with a python node, that would also be excellent.

Thanks for any and all help.

Update:

So I tried just importing/using pyserial after a pip install and it seems to work fine. I feel though that there should be a better way of handling serial communications, so I'm still open to ideas/suggestions.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
0

answered 2021-01-26 03:57:33 -0600

FraFin gravatar image

Hi, micro-ROS team speaking here. Check out this: https://github.com/micro-ROS/micro_ro.... micro-ROS has already been ported to the Arduino Due, so it totally feasible to use it for your project! Hope this helps :)

edit flag offensive delete link more

Comments

Thanks for the info! I didn't realize this PR existed and got merged so soon after this post, otherwise I would've looked more at micro-ROS at the time. For now I've been using the built-in serial libraries for the Due and pyserial, but I'll definitely come back to look at micro-ROS again after the first phase of this project. I do have one question though: I noticed that the default branch is "foxy". Currently my project is using dashing with the intent of switching to foxy after the first phase. Does micro-ROS support dashing or just foxy?

andrew_103 gravatar image andrew_103  ( 2021-02-01 21:37:23 -0600 )edit

I'm afraid it's just Foxy! The micro-ROS library for Arduino was developed and propagated months after the release of Foxy, so we only provide support for it!

FraFin gravatar image FraFin  ( 2021-02-02 00:59:08 -0600 )edit

Trying to get this to run. when compiling any of the examples for the teensy, I get following error: error: 'set_microros_transports' was not declared in this scope set_microros_transports();

Currently using library micro_ros_arduino-0.0.4. Any ideas?

pulcher gravatar image pulcher  ( 2021-02-13 00:01:11 -0600 )edit

I just dealt with this. If you look closely at the 0.0.4 release it’s basically the repository’s source code. I just downloaded the micro_ros_arduino repository as a zip file and used that and it worked.

BotzRock gravatar image BotzRock  ( 2021-03-07 22:33:45 -0600 )edit
0

answered 2020-11-11 12:16:12 -0600

duck-development gravatar image

updated 2020-11-11 12:16:43 -0600

For micro Ros it is recommend to use a stm32 Prozessor. If you use nuttex you can run it on the due.

https://micro-ros.github.io/docs/over...

edit flag offensive delete link more

Question Tools

5 followers

Stats

Asked: 2020-11-05 17:21:16 -0600

Seen: 7,986 times

Last updated: Jan 26 '21