Gazebo | Ignition | Community
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

GetWorldLinearVel animation problem

Hello everybody,

I am moving a box using the animation system (KeyFrame,...). I would like to output some datas like the model's position and speed. I have created a model plugin.

No problem for the position but I have some trouble for the speed.

The GetWorldLinearVel function seems to return a 0.0 value for x, y and z attributes.

Here is the code to get the speed datas :

custom_msgs::msg_command speed_msg;
speed_msg.header.stamp = ros::Time::now();
speed_msg.header.frame_id = m_model->GetName();

auto linear = m_model->GetWorldLinearVel(); = m_model->GetWorldAngularVel().z;

ROS_INFO("speed data");
ROS_INFO("x: %lf", linear.x);
ROS_INFO("y: %lf", linear.y);
ROS_INFO("z: %lf", linear.z);