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
Originally posted by invoices on ROS Answers with karma: 21 on 2013-08-08
Post score: 0
Original comments
Comment by thebyohazard on 2013-08-08:
Is there any reason you're not using a single node with two subscribers instead of two different nodes?
Comment by jep31 on 2013-08-08:
Maybe you can use a time-stamp to make sure your data sensor match well.