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

Revision history [back]

If you are not using rosserial, I would work on getting basic serial communication working outside of ROS first. @kleekru mentioned he is working in Python. I would look at the documentation for pyserial, and figure out how to just send the characters you want to send. For example, the following snippet would send the ascii character for '2' as you requested

import serial
com = serial.Serial('/dev/ttyUSB0',baudrate=115200)
com.write('2')
com.close()

For @nachoarreola, you need to look up termios.h (assuming you are on linux). Once you understand how to send commands programmatically, you can then write a ROS node that helps you out.

The system I'm currently working with has robots that cannot run ROS onboard. So I have a serial node that advertises a ServiceServer. This serial node is responsible for opening the connection and sending data. When a different node wants to send a serial packet to a robot, it calls the service advertised by the serial node, the serial node assembles the serial packet, sends the data out the serial port, and then replies to the client node with the robot's response.

If you are not using rosserial, I would work on getting basic serial communication working outside of ROS first. @kleekru mentioned he is working in Python. I would look at the documentation for pyserial, pySerial, and figure out how to just send the characters you want to send. For example, the following snippet would send the ascii character for '2' as you requested

import serial
com = serial.Serial('/dev/ttyUSB0',baudrate=115200)
com.write('2')
com.close()

For @nachoarreola, you need to look up termios.h (assuming you are on linux). A bunch of good examples can be found here. Once you understand how to send commands programmatically, you can then write a ROS node that helps you out.

The system I'm currently working with has robots that cannot run ROS onboard. So I have a serial node that advertises a ServiceServer. This serial node is responsible for opening the connection and sending data. When a different node wants to send a serial packet to a robot, it calls the service advertised by the serial node, the serial node assembles the serial packet, sends the data out the serial port, and then replies to the client node with the robot's response.