Ask Your Question
0

Synchronize nodes

asked 2013-08-08 00:17:59 -0500

invoices gravatar image

Hi, I've got following situation:

Two sensors nodes are publishing different values on different topics at 1khz:

SensorNode A publishes measured contact force values

SensorNode B publishes measured angles

Further I've got two subscribers for these two publishers:

Subscriber subA

Subscriber subB

Both Subscriber write on the same state-Object (state.force and state.angle)

Method void control(state.force,state.angle) is called in the CallBackRoutine of subB and does some calculations based on the measured force and measured angle. But what happens is that the force-values and angle-values don't match.

Sometimes it like in the Callback-Routine of subA values are written on state.force 5 times without having been read or sometimes in the Callback-Routine of subB state.force is read 5 times though they values couldn't be updated by subA

How can I synchronize the two nodes? I'm coding in C++ but I'm really new to ROS.

Thanks

edit retag flag offensive close merge delete

Comments

Is there any reason you're not using a single node with two subscribers instead of two different nodes?

tbh gravatar image tbh  ( 2013-08-08 03:51:28 -0500 )edit
1

Maybe you can use a time-stamp to make sure your data sensor match well.

jep31 gravatar image jep31  ( 2013-08-08 20:40:20 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2014-01-30 21:06:02 -0500

tfoote gravatar image

There are lots of possible solutions but the message_filter packages has a good solution either in one of the TimeSynchronizer filters.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2013-08-08 00:17:59 -0500

Seen: 2,200 times

Last updated: Jan 30 '14