## Joint friction

Official Python bindings with a focus on reinforcement learning and robotics.
kapsl
Posts: 3
Joined: Thu May 16, 2019 1:49 pm

### Joint friction

Hi,
we are currently trying to simulate a 7DOF robot arm as close to reality as possible. We therefore want to have joint friction in Torque Control Mode.

I read that it is possible to emulate this over setting the force in
self._p.setJointMotorControlArray(self.kuka_uid, self._motor_indices, self._p.VELOCITY_CONTROL, forces=np.zeros(len(self._motor_indices)))
to a small value.

But originally there should be also the options
self._p.changeDynamics(self.kuka_uid, self._motor_indices, lateralFriction=friction,
rollingFriction=friction,
spinningFriction=friction,
frictionAnchor=1000)

I am not sure, what is the right friction here. But actually nevertheless what number i put in there, I did not see any difference?

Thanks!

steven
Posts: 57
Joined: Mon Nov 05, 2018 8:16 am
Location: China

### Re: Joint friction

kapsl wrote:
Thu May 16, 2019 1:53 pm
self._p.setJointMotorControlArray(self.kuka_uid, self._motor_indices, self._p.VELOCITY_CONTROL, forces=np.zeros(len(self._motor_indices)))
i think this is a method to simulate the joint friction, like the angularDamping.
kapsl wrote:
Thu May 16, 2019 1:53 pm
self._p.changeDynamics(self.kuka_uid, self._motor_indices, lateralFriction=friction,
rollingFriction=friction,
spinningFriction=friction,
frictionAnchor=1000)
these values take effect only when have some contact with other body.

kapsl
Posts: 3
Joined: Thu May 16, 2019 1:49 pm

### Re: Joint friction

What do you mean, "like the angular damping" Damping is something I can set and it works?!

steven
Posts: 57
Joined: Mon Nov 05, 2018 8:16 am
Location: China

### Re: Joint friction

1. p.setJointMotorControl2(obj,1,p.VELOCITY_CONTROL,targetVelocity=0,force=frictionForce)
2. p.changeDynamics(obj,j,linearDamping=value1, angularDamping=value2)

for my understanding, these two get the similar result with different methods. you can try it and see if get what you want.

kapsl
Posts: 3
Joined: Thu May 16, 2019 1:49 pm

### Re: Joint friction

Hi,
and thanks for your answer. Ok that makes sense! I do some system identification currently where I just use the second method with damping (currently the same value for linear and angular). Interestingly we partly get really large (and sometimes also negative) values, where the trajectory is most similar to the real robot. (negative dampings does not really make sense?!)

Do you know what exactly is the linear and angular damping in the joint?

steven
Posts: 57
Joined: Mon Nov 05, 2018 8:16 am
Location: China

### Re: Joint friction

you can google the damping then you can know what the damping is used for.
the damping force is a resistence that proportional to the velocity but in the opposite direction. as for the implementation in this engine, honestly so far i still don't understand what that equation below comes from. for more details you can refer to the function of btMultiBody::computeAccelerationsArticulatedBodyAlgorithmMultiDof() which is the most important function for the multibody, i think so at least.

Code: Select all

``````//adding damping terms (only)
const btScalar linDampMult = 1., angDampMult = 1.;
zeroAccSpatFrc[0].addVector(angDampMult * m_baseInertia * spatVel[0].getAngular() * (DAMPING_K1_ANGULAR + DAMPING_K2_ANGULAR * spatVel[0].getAngular().safeNorm()),
linDampMult * m_baseMass * spatVel[0].getLinear() * (DAMPING_K1_LINEAR + DAMPING_K2_LINEAR * spatVel[0].getLinear().safeNorm()));
``````