Serial Communication with Motor Driver

asked 2019-05-07 06:03:51 -0500

doctor_zerios gravatar image

updated 2019-05-08 02:13:08 -0500

Hello there! After hundreds of attempt using roboteq_driver to connect my Roscore with the motor driver FBL2360 firmware v1.8d, I realized that the library is written to work with the 1.7 version and I'm not able to fix it (probably because I don't know enough C++), so I decided to follow another route. Because I'm using a Raspberry PI b as main unit, I tried to connect both the devices with pure serial communication (without using ROS) just to test the results, and actually it works fine: if I give a simple command it executes it and I can also read diagnostic messages. So I tried to use rosserial library but there is no node on the motor driver so I can't figure out how to simply connect the ROS with the motor controller simply sending serial messages on /dev/ttyACM0 port. I mean, If I could use Arduino it would be very easy, just a Serial.write( 'motor_commands')and its done; I would like to know if some easy solution exists or if I have to create some rosserial node which connects the devices.

EDIT1: I just found the library pyserial which allows to serial communicate coding in python, and I tested it using this easy code

#!/usr/bin/env python
import sys
import time
import serial

ser = serial.Serial('/dev/ttyACM0')
ser.baudrate = 115200
print(    # check which port was really used
for i in range(10):      
    ser.write(b'!G 1 1000_!G 2 0_')     #set point for ch1 and ch2  _<->enter


This works fine, so I the next step is to integrate this code in some ROS node, which, reading data from navigation sends the command string serially. The problem now is the serial read that actually read everything sent on the serial bus, also the ser.write I just sent. Is there any solution?

edit retag flag offensive close merge delete


Your question asked about integration into ROS node but then asks about how to read from serial port. What is your question?

Have you gone through the Navigation Stack tutorials? It covers almost anything a person new to ROS could want. I suggest you go through the tutorials and comes back with specific questions when you get stuck.

billy gravatar image billy  ( 2019-05-08 23:47:13 -0500 )edit