ubi-agni / tactile_toolbox

software to handle tactile sensors in ROS
9 stars 5 forks source link

Dropped tactile contact messages #18

Closed rhaschke closed 3 years ago

rhaschke commented 3 years ago

When testing #17, I noticed "message drops" in tactile_contact_states: Publishing tactile states at 10 Hz, I noticed that only 2/10 contact messages are published by the merger. The merger can publish up to 100 Hz, but throttles itself to the incoming frequency. So we would expect 10Hz again. I was suspecting merger's double spinOnce() and/or its queue size of 1 as discussed in https://github.com/ubi-agni/tactile_toolbox/pull/13#pullrequestreview-504268170, but these were NOT the issues. Needs more investigation.

guihomework commented 3 years ago

I think the problem is the "test python app" show in #17 . It publishes a /clock but also reads this same clock if use_sim_time=true so it was listening to its own ticks. Second the tick were at 10 Hz, so the counting cannot be precise in all apps relying on /clock, hence sometimes missing elements.

with a /clock published at higher frame rate (100 Hz), and the time loop running independent from the /clock, there is no frame drop and nice aligning with 10 Hz.

rhaschke commented 3 years ago

Yes, it was related to sim time, but the culprit wasn't the tactile state generator script from https://github.com/ubi-agni/tactile_toolbox/pull/17#issue-500207763. Rather, the tactile_merger was using rate.sleep() and thus relying on the ROS time for its publishing. Publishing the clock at the same frequency as the tactile messages themselves, caused the loop to sleep too long sometimes, resulting in two tactile messages being received in the meantime. Thus only the last one was processed.