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

Creating synchronized tasks with multiple devices.

asked 2018-07-13 15:52:42 -0500

Passless11 gravatar image

I'm new to ROS and and want to communicate between 3 Raspberry Pi 3's. 2 of my pis each control a motor, and I want the third pi to communicate to them to start turning the motors at the exact same time.

My initial idea was to have the third pi, the master pi, calculate and publish a specific timestamp for the other pis to start sending commands to their motors, and the two motor pis would just sleep until that time is reached.

Is there a better way to synchronize tasks using ROS?

edit retag flag offensive close merge delete

Comments

1

Could you specify "exact same time"? Are you talking about micro or milliseconds? What is the maximum time difference you can work with?

NEngelhard gravatar image NEngelhard  ( 2018-07-14 01:21:59 -0500 )edit

Working together within a couple milliseconds should be fine, but working as close to the exact same time is preferable.

Passless11 gravatar image Passless11  ( 2018-07-14 14:27:15 -0500 )edit

How are the RPis connected? Could you use additional wires to connect GPIOs between the controller and the two slave RPIs?

NEngelhard gravatar image NEngelhard  ( 2018-07-14 14:42:43 -0500 )edit

Possibly. Could you elaborate on your idea more?

Passless11 gravatar image Passless11  ( 2018-07-19 14:07:06 -0500 )edit

You could set up the next move command through any connection (e.g. a ros-topic) and trigger it by an interrupt. For this you'd have to connect GPIOs from the master-RPI to the slaves.

NEngelhard gravatar image NEngelhard  ( 2018-07-19 14:53:15 -0500 )edit

I'm unfamiliar with interrupts. Do you have an example code I could reference?

Passless11 gravatar image Passless11  ( 2018-07-19 15:14:56 -0500 )edit

I haven't used them so far, but this looks promising: Rpi/Interrupt

NEngelhard gravatar image NEngelhard  ( 2018-07-20 02:27:36 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2018-07-13 17:56:58 -0500

nkhedekar gravatar image

You can set them all up on a single network as is given here http://wiki.ros.org/ROS/NetworkSetup and they'll all be synchronized. Then you can have a simple subscriber on each pi that will start turning the motors whenever they receive a message. The third pi can be used as a master to publish a message when the motors are to be turned.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-07-13 15:52:42 -0500

Seen: 417 times

Last updated: Jul 13 '18