Polynomial stiffness and damping https://youtu.be/aKa3ZlEF9_Y
PiperOrigin-RevId: 884607673 Change-Id: If8088dbf37fed1055304778a7eb84dec52cba920
This commit is contained in:
committed by
Copybara-Service
parent
aec1b45dce
commit
efae9157a7
@@ -419,7 +419,7 @@ mjsBody* mjCComposite::AddCableBody(mjCModel* model, mjsBody* body, int ix,
|
||||
mjsJoint* jnt = mjs_addJoint(body, &defjoint[mjCOMPKIND_JOINT][0].spec);
|
||||
mjs_setDefault(jnt->element, mjs_getDefault(body->element));
|
||||
jnt->type = (first && strcmp(initial.c_str(), "free") == 0) ? mjJNT_FREE : mjJNT_BALL;
|
||||
jnt->damping = jnt->type == mjJNT_FREE ? 0 : jnt->damping;
|
||||
if (jnt->type == mjJNT_FREE) mjuu_zerovec(jnt->damping, 1+mjNPOLY);
|
||||
jnt->armature = jnt->type == mjJNT_FREE ? 0 : jnt->armature;
|
||||
jnt->frictionloss = jnt->type == mjJNT_FREE ? 0 : jnt->frictionloss;
|
||||
mjs_setName(jnt->element, this_joint);
|
||||
|
||||
+19
-10
@@ -2395,8 +2395,8 @@ void mjCModel::AutoSpringDamper(mjModel* m) {
|
||||
mjtNum damping = 2 * inertia / std::max(mjMINVAL, timeconst);
|
||||
|
||||
// save stiffness and damping in the private mjsJoints
|
||||
joints_[n]->stiffness = stiffness;
|
||||
joints_[n]->damping = damping;
|
||||
joints_[n]->stiffness[0] = stiffness;
|
||||
joints_[n]->damping[0] = damping;
|
||||
|
||||
// assign
|
||||
m->jnt_stiffness[n] = stiffness;
|
||||
@@ -2805,7 +2805,8 @@ void mjCModel::CopyTree(mjModel* m) {
|
||||
m->jnt_bodyid[jid] = pj->body->id;
|
||||
mjuu_copyvec(m->jnt_pos+3*jid, pj->pos, 3);
|
||||
mjuu_copyvec(m->jnt_axis+3*jid, pj->axis, 3);
|
||||
m->jnt_stiffness[jid] = (mjtNum)pj->stiffness;
|
||||
m->jnt_stiffness[jid] = (mjtNum)pj->stiffness[0];
|
||||
mjuu_copyvec(m->jnt_stiffnesspoly + mjNPOLY * jid, pj->stiffness + 1, mjNPOLY);
|
||||
mjuu_copyvec(m->jnt_range+2*jid, pj->range, 2);
|
||||
mjuu_copyvec(m->jnt_actfrcrange+2*jid, pj->actfrcrange, 2);
|
||||
mjuu_copyvec(m->jnt_solref+mjNREF*jid, pj->solref_limit, mjNREF);
|
||||
@@ -2862,7 +2863,9 @@ void mjCModel::CopyTree(mjModel* m) {
|
||||
mjuu_copyvec(m->dof_solimp+mjNIMP*dofadr, pj->solimp_friction, mjNIMP);
|
||||
m->dof_frictionloss[dofadr] = (mjtNum)pj->frictionloss;
|
||||
m->dof_armature[dofadr] = (mjtNum)pj->armature;
|
||||
m->dof_damping[dofadr] = (mjtNum)pj->damping;
|
||||
m->dof_damping[dofadr] = (mjtNum)pj->damping[0];
|
||||
mjuu_copyvec(m->dof_dampingpoly + mjNPOLY * dofadr, pj->damping + 1,
|
||||
mjNPOLY);
|
||||
|
||||
// set dof_parentid, update body.lastdof
|
||||
m->dof_parentid[dofadr] = pb->lastdof;
|
||||
@@ -3805,8 +3808,10 @@ void mjCModel::CopyObjects(mjModel* m) {
|
||||
m->tendon_actfrcrange[2*i] = (mjtNum)pte->actfrcrange[0];
|
||||
m->tendon_actfrcrange[2*i+1] = (mjtNum)pte->actfrcrange[1];
|
||||
m->tendon_margin[i] = (mjtNum)pte->margin;
|
||||
m->tendon_stiffness[i] = (mjtNum)pte->stiffness;
|
||||
m->tendon_damping[i] = (mjtNum)pte->damping;
|
||||
m->tendon_stiffness[i] = (mjtNum)pte->stiffness[0];
|
||||
mjuu_copyvec(m->tendon_stiffnesspoly + mjNPOLY * i, pte->stiffness + 1, mjNPOLY);
|
||||
m->tendon_damping[i] = (mjtNum)pte->damping[0];
|
||||
mjuu_copyvec(m->tendon_dampingpoly + mjNPOLY * i, pte->damping + 1, mjNPOLY);
|
||||
m->tendon_armature[i] = (mjtNum)pte->armature;
|
||||
m->tendon_frictionloss[i] = (mjtNum)pte->frictionloss;
|
||||
m->tendon_lengthspring[2*i] = (mjtNum)pte->springlength[0];
|
||||
@@ -5542,7 +5547,8 @@ bool mjCModel::CopyBack(const mjModel* m) {
|
||||
// joint data
|
||||
mjuu_copyvec(pj->pos, m->jnt_pos+3*i, 3);
|
||||
mjuu_copyvec(pj->axis, m->jnt_axis+3*i, 3);
|
||||
pj->stiffness = (double)m->jnt_stiffness[i];
|
||||
pj->stiffness[0] = (double)m->jnt_stiffness[i];
|
||||
mjuu_copyvec(pj->stiffness + 1, m->jnt_stiffnesspoly + mjNPOLY * i, mjNPOLY);
|
||||
mjuu_copyvec(pj->range, m->jnt_range+2*i, 2);
|
||||
mjuu_copyvec(pj->solref_limit, m->jnt_solref+mjNREF*i, mjNREF);
|
||||
mjuu_copyvec(pj->solimp_limit, m->jnt_solimp+mjNIMP*i, mjNIMP);
|
||||
@@ -5557,7 +5563,8 @@ bool mjCModel::CopyBack(const mjModel* m) {
|
||||
mjuu_copyvec(pj->solref_friction, m->dof_solref+mjNREF*j, mjNREF);
|
||||
mjuu_copyvec(pj->solimp_friction, m->dof_solimp+mjNIMP*j, mjNIMP);
|
||||
pj->armature = (double)m->dof_armature[j];
|
||||
pj->damping = (double)m->dof_damping[j];
|
||||
pj->damping[0] = (double)m->dof_damping[j];
|
||||
mjuu_copyvec(pj->damping + 1, m->dof_dampingpoly + mjNPOLY * j, mjNPOLY);
|
||||
pj->frictionloss = (double)m->dof_frictionloss[j];
|
||||
}
|
||||
|
||||
@@ -5680,8 +5687,10 @@ bool mjCModel::CopyBack(const mjModel* m) {
|
||||
mjuu_copyvec(tendons_[i]->rgba, m->tendon_rgba+4*i, 4);
|
||||
tendons_[i]->width = (double)m->tendon_width[i];
|
||||
tendons_[i]->margin = (double)m->tendon_margin[i];
|
||||
tendons_[i]->stiffness = (double)m->tendon_stiffness[i];
|
||||
tendons_[i]->damping = (double)m->tendon_damping[i];
|
||||
tendons_[i]->stiffness[0] = (double)m->tendon_stiffness[i];
|
||||
mjuu_copyvec(tendons_[i]->stiffness + 1, m->tendon_stiffnesspoly + mjNPOLY * i, mjNPOLY);
|
||||
tendons_[i]->damping[0] = (double)m->tendon_damping[i];
|
||||
mjuu_copyvec(tendons_[i]->damping + 1, m->tendon_dampingpoly + mjNPOLY * i, mjNPOLY);
|
||||
tendons_[i]->armature = (double)m->tendon_armature[i];
|
||||
tendons_[i]->frictionloss = (double)m->tendon_frictionloss[i];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user