Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The only way I have found is to create a VisualPlugin and send the force as a message to it.

So in the Load() function of my ModelPlugin, I initialize a factory like this:

factory_pub_ = node_handle_->Advertise<msgs::Vector3d>("~/lift_force");

Which I then use to publish the force in the OnUpdate() function:

msgs::Vector3d force_msg;
force_msg.set_x(force.X());
force_msg.set_y(force.Y());
force_msg.set_z(force.Z());
factory_pub_->Publish(force_msg);

The next step is to fetch that value and draw it from the VisualPlugin