Home | Tutorials | Wiki | Issues
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Syncing publisher with subscriber

I am building a plugin to simulate a 200N constant force spring. My method subscribes to "/gazebo/default/myRobot/link/wrench", reads in the force in the x-axis, adds 200N, then applies the force back on the link.

I am applying the force by right-clicking on the link, selecting Add Force/Torque, enter in a value, and hold ENTER. This publishes the force at a certain frequency.

If I do my arithmetic in the callback function then it only works while the force is being applied then stops. If I place the arithmetic in the OnUpdate function called by event::Events::ConnectorWorldUpdateBegin() in the Load function, then the frequency in which I apply my force back is faster than the frequency of the messages received (which varies highly), resulting in very little movement unless I apply large force.

Is there a way to match the frequency at which I apply a force back on the link to the frequency of the topic?