How to communicate with a USB/serial device
I have to send command to METTLER-TOLEDO weightscale and also I would like to receive information from it. The weightscale has a proprietary command set called MT-SICS, basically the weightscale is programmed with ASCII strings and replies in the same way. The weightscale has an output pl2303 serial port which I convert into usb with an adapter and ROS Kinetic is able to see the usb. I would know how could I send ASCII strings to the weightscale and read information from it.
Asked by Oivil on 2018-08-22 08:00:19 UTC
Comments
I can understand why you'd post this question here, on ROS Answers, but I'm closing it nonetheless.
Your question is about how to programmatically interact with a device that has a serial port. This in itself is not related (nor influenced) by your choice to ultimately use ROS with it.
I would ..
Asked by gvdhoorn on 2018-08-22 08:40:39 UTC
.. recommend to search around for information on how to use serial ports (with Python, C++ or whichever programming language you intend to use) and first get the basics worked out (ie: be able to query and command the scale using the "ascii commands" you mention by writing to the serial port).
Asked by gvdhoorn on 2018-08-22 08:41:54 UTC
Once that works, start thinking about how you'd want to wrap that in a ROS node, and what the interface that ROS node implements should be (ie: services, topics, actions, etc).
At that point it becomes a ROS question. If you're there, and still have questions (fi about the msgs to use), ..
Asked by gvdhoorn on 2018-08-22 08:43:03 UTC
.. feel free to post a question here.
Asked by gvdhoorn on 2018-08-22 09:01:24 UTC
Note that there are actually already quite a few Python modules and examples available for communicating with Mettler-Toledo devices.
Some random Googling turned up:
and ..
Asked by gvdhoorn on 2018-08-22 09:03:57 UTC
.. project/mettler_toledo_device.
The first is a basic script, the second a more complex library with support for much more lab equipment and the last a Python module specifically geared towards the Toledo device.
Asked by gvdhoorn on 2018-08-22 09:04:55 UTC