Ask Your Question

Send array of three numbers from ROS to Arduino?

asked 2016-12-06 03:46:19 -0500

MartinSA gravatar image

Hey all. We are currently working on getting a serial communication through ROS to an Arbotix-M type board through an FTDI adapter. We have looked into rosserial and other packages but it seems rather complicated and unnecessary since we only want to send an array of three integers to the Arbotix board. We're thinking something like:

ROS-side: Serial write int test[1, 2, 1];


Is this possible or something similar?

Thanks in advance!

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted

answered 2016-12-08 15:14:21 -0500

MartinSA gravatar image

updated 2016-12-08 15:15:17 -0500

Thank you for your answers! I found a possible solution. As there would be no need for two way communication and no ROS on the arduino all i needed to do was basically pass three integers over the serial port. Turned out there was a much simpler way to do that, simply by importing the "Serial" library in the python script in ROS.

The transmitting end in python(ROS):

import serial

import time

arduino = serial.Serial(dev/ttyUSB0, 115200, timeout = 1)



Receiving end on arduino:

if (Serial.available() > 0) {;

integer = Serial.parseInt();


Hope this can help others in the future.

edit flag offensive delete link more

answered 2016-12-08 10:58:21 -0500

BrettHemes gravatar image

You could also simply write a ROS wrapper for some other application-specific serial interface code. It sounds like you don't really need ROS capabilities ON the Arduino so just write your own serial interface for exactly what you need and then do any ROS-specific communication from within the node.

edit flag offensive delete link more

answered 2016-12-06 17:12:29 -0500

paulbovbel gravatar image

updated 2016-12-06 17:13:03 -0500

It is definitely possible, and would be trivial through ROS+rosserial pub/sub using a message containing an int[] array, or reading parameters from the rosparam server.

Implementing a bespoke communication protocol over the serial link is not in scope for this QA board.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2016-12-06 03:46:19 -0500

Seen: 614 times

Last updated: Dec 08 '16