ros-drivers / rosserial

A ROS client library for small, embedded devices, such as Arduino. See: http://wiki.ros.org/rosserial
508 stars 527 forks source link

Global understanding - Setting a serial communication and topic #529

Open Valneltin opened 3 years ago

Valneltin commented 3 years ago

Hello,

I need some help to understand well how to use rosserial package.

I have my PC Ubuntu and a device who communicate via serial port. I would like to publish my message on a topic and then send to the device via serial. And I would like to subscribe to a topic where the device "publishs" its "reponse".

As I understand, I've seen in rosserial_python package the SerialClient.py where it seems there is class to do want I want. I need to do :

my_serviceclient = ServiceClient(port, bauds, timeout)

But where I set the name of the topic to send and receive message ? As I understand, there are in the class ServiceClient() a def SetupSubscriber(data) and def SetupPublisher(data) So I need to do :

my_serviceclient.SetupSubscriber(data) my_serviceclient.SetupPublisher(data)

But what is exactly the "data" ? And after doing this, I need to do :

my_serviceclient.run()

When I want to send a message, I need to do :

my_serviceclient.send(topic, message)

When I want to read a message, I need to create my subscriber to the good topic.

Someone could help me ? Is it the good way ? Thanks !