Club-INTech / TechTheHighLevel

Refonte du HL
GNU General Public License v3.0
1 stars 0 forks source link

Use ROS for inter-process communication #1

Open juliandesvignes opened 6 years ago

juliandesvignes commented 6 years ago

Instead of doing a TCP-spaghetti system, you can use the basics of ROS for message exchanges. The master runs "roscore" and his "master node" , while each slave connect to the "roscore" running on the master by simply setting the ROS_MASTER_URI env var, and publishes a "slave node". You only need the IP of the master for initial connection. All the communication between processes and platforms will be handled via roscore, TCP included.

Think of roscore as a message distributor like LaPoste.

Then, every communication uses topics on which you can subscribe and publish. No need for IP configuration or socket handling, everything is handled system-wide via roscore. So instead of creating a thread that listens on a TCP port, you setup a subscriber on a specific topic name like "/intech/lidar_values" and assign a callback that's going to be called when a message arrives. On the other end, the LIDAR code setups a publisher on "/intech/lidar_values" and does pub.publish(values). No need for server configuration, since ROS is operating system-wide.

Check that for more info on ROS topics : http://wiki.ros.org/roscpp/Overview/Publishers%20and%20Subscribers http://wiki.ros.org/ROS/Tutorials/MultipleMachines

juliandesvignes commented 6 years ago

And you can also run ROS on the teensy to handle communication.

Mardelor commented 5 years ago

Publish-subscribe system looks good, thanks :) Next step may be the High Level in cpp with ROS libraries