0
$\begingroup$

Rosanswers logo

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];

Arduino-side: Serial.read(something).

Is this possible or something similar?

Thanks in advance!


Originally posted by MartinSA on ROS Answers with karma: 11 on 2016-12-06

Post score: 1

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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)

time.sleep(2)

arduino.write(integer)

Receiving end on arduino:

if (Serial.available() > 0) {

Serial.read();

integer = Serial.parseInt();

}

Hope this can help others in the future.


Originally posted by MartinSA with karma: 11 on 2016-12-08

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.