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

Using rosserial to read data from a device

asked 2019-10-02 04:08:32 -0500

Juliette_ROS gravatar image

Hello, I am working on Ubuntu on a Virtual Machine (Virtual Box) and I need to collect data from a Battery Management System (BMS).

The connection is made by a USB cable and a USB Serial converter so I use a USB port as a serial port.

I managed to connect the BMS to my virtual machine and I can see it in the list when I type lsusb in the terminal of Ubuntu :

BUS 001 Device 003: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC

Now my problem is that I need to read the data from this BMS and I understood that rosserial could help me, but I just started to use ROS one week ago and I don't know how to use this.

Could you please give me some information about how to use rosserial to read this data please ?

Thank you !

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2019-10-02 04:58:31 -0500

Rosserial may not be what you need to use in this case, rosserial is designed to be used with micro-controllers where you are writing the firmware yourself. It gives you access to a limited set of ROS message handling functions directly from the micro-controller code.

If you're writing the firmware of the battery management system yourself then you could use rosserial for this. If the hardware already has it own firmware and you need to read and write data to the serial port to communicate with it then you'll need to use a conventional serial library for this.

I've used boost io in C++ for this before, or you could use pySerial if you're working in python.

edit flag offensive delete link more

answered 2020-06-08 16:18:35 -0500

borgcons gravatar image


What we have done is to create a serial node and publish to a string topic. We have done the same for a tcp and udp node as well.

For serial node you have to decide is you want to publish from a read or publish on a terminator. For ASCII protocols its usually done by ending with a terminator. So your serial node should be of type ASCII or BINARY. For ascii it would send on a parameterized terminator. For BINARY it would send whatever the read returns. It would be the responsibility of the high node receiving the BINARY data to assemble the data into a packet.

BTW you will have to you assign to move the data from the serial port to the string topic.

Hope all that helps.

Separating in serial into a string topic also makes testing, and debugging easier. An extra feature is that if you have the same type of device, like a BMS, that returns apacket of ump instead of serial your BMS node does not have to change. We actually ran into this situation and all that was required was to change a launch file.

edit flag offensive delete link more

Question Tools



Asked: 2019-10-02 04:08:32 -0500

Seen: 1,398 times

Last updated: Jun 08 '20