# Gazebo joint velocities do not agree with joint displacement

This post is a wiki. Anyone with karma >75 is welcome to improve it.

In a simulation that I am running using ros and gazebo, which is described below, the angular velocities that I get from the joint_states topic, do not give me the angular displacement I calculate from the joints angular positions.

Firstly, this happens when the robot is is in contact with the ground! In simulations that do not involve contacts, the velocities give the measured displacements.

The joint velocities should be zero, as the <max_vel> element in the collision properties is large. And according to this, if the contact tangential friction (F_T) is less than mF_n then the contact surfaces do not move relative to each other.

However, the joint velocities aren't zero, and actually give an end-effector velocity of 0.0012 m/s in the direction normal to the ground (With that velocity, the end_effector "wants" to leave the contact).

Inital hypothersis, which turned out not to be true:

Initially, i thought it had to do with the ros_control plugin and the way that it publishes velocities. But, i get the joint velocities from gazebo itself (last plot: Gazebo Velocity Plots) and they agree with the velocities from the joint_states topic.

Question:

Why don't the joint velocities agree with the measured displacements?

Simulation experiment description:

I am running some contact simulations (below I include the simulation parameters) for a robotic leg in gazebo (11.11) using ros (noetic). The experiment I am running is the following: The leg starts touching the ground, like the figure below, and an effort controller is activated with the following command:

t = J^T(h_desired) + G
//where h_desired is the desired wrench,
//G the gravity vector for compensation,
//h is the end_effector jacobian


Then I am getting the joint positions and velocities in order to compare them to an other simulation. However, the joint positions and velocities do not make sense. I present them, at steady state, below.

Data:

From the velocity plots, the mean velocities are:

q_{t,2} = 3.59e-3  \\which means, that
Δq_2    = (3.59e-3)* 0.8 = 0.0029 rad .

q_{t,3} = -8.62e-3 \\ which means, that
Δq_3    = (-8.62e-3) * 0.8 = -0.0069  rad


However, from the position plots:

Δq_2 = -1.20465 + 1.20468 = 3e-5
Δq_3 = -1.22289 + 1.22285 = -4e-5


So physically, this doesn't make sense.

Position:

Velocity:

Simulation parameters

Gazebo physics in urdf file (.xacro to be exact):

<physics type="ode" >
<ode>
<solver>
<type>world</type>
<friction_model>cone_model</friction_model>
</solver>
</ode>
<max_step_size>0.001</max_step_size>
</physics>


and contact parameters:

  <collision>
<surface>
<friction>
<torsional>
<coefficient> 0 </coefficient>
</torsional>
<ode>
<mu>0.7</mu>
<mu2>0.7</mu2>
</ode>
</friction>
<contact>
<ode>
<kp>1e4</kp>
<kd>1e2</kd>
<max_vel>100</max_vel>
</ode>
</contact>
</surface>
</collision>


Gazebo Velocity plots:

Here, the velocity plots straight from gazebo are shown. Gazebo still calculates the same velocities that i get from the joint_states topic. So, the problem is from gazebo and not due to a faulty implementation of the ros_control plugin.

(purple : joint 1, blue: joint 2, green: joint3)

edit retag close merge delete