How to communicate with a USB/serial device [closed]

asked 2018-08-22 08:00:19 -0600

Oivil gravatar image

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.

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by gvdhoorn
close date 2018-08-22 08:43:08.695674

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 ..

gvdhoorn gravatar image gvdhoorn  ( 2018-08-22 08:40:39 -0600 )edit

.. 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).

gvdhoorn gravatar image gvdhoorn  ( 2018-08-22 08:41:54 -0600 )edit

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), ..

gvdhoorn gravatar image gvdhoorn  ( 2018-08-22 08:43:03 -0600 )edit

.. feel free to post a question here.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-22 09:01:24 -0600 )edit

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 ..

gvdhoorn gravatar image gvdhoorn  ( 2018-08-22 09:03:57 -0600 )edit

.. 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.

gvdhoorn gravatar image gvdhoorn  ( 2018-08-22 09:04:55 -0600 )edit