Refactor a loop in engine_solver.c
PiperOrigin-RevId: 560997065 Change-Id: I26540e4f750eb18d9497bf35396adbb15cc3a122
This commit is contained in:
committed by
Copybara-Service
parent
55173e58f9
commit
5f3e22a45f
@@ -929,13 +929,17 @@ static void CGeval(const mjModel* m, mjData* d, mjCGContext* ctx, mjCGPnt* p) {
|
||||
mjtNum quadTotal[3];
|
||||
mju_copy3(quadTotal, ctx->quadGauss);
|
||||
|
||||
// process constraints
|
||||
for (int i=0; i < nefc; i++) {
|
||||
// equality
|
||||
for (int i=0; i < ne; i++) {
|
||||
if (i < ne) {
|
||||
mju_addTo3(quadTotal, ctx->quad+3*i);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
// friction
|
||||
for (int i=ne; i < ne+nf; i++) {
|
||||
if (i < ne + nf) {
|
||||
// search point, friction loss, bound (Rf)
|
||||
mjtNum start = ctx->Jaref[i], dir = ctx->Jv[i];
|
||||
mjtNum x = start + alpha*dir;
|
||||
@@ -958,10 +962,10 @@ static void CGeval(const mjModel* m, mjData* d, mjCGContext* ctx, mjCGPnt* p) {
|
||||
mjtNum qf[3] = {f*(-0.5*Rf+start), f*dir, 0};
|
||||
mju_addTo3(quadTotal, qf);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// limit and contact
|
||||
for (int i=ne+nf; i < nefc; i++) {
|
||||
if (d->efc_type[i] == mjCNSTR_CONTACT_ELLIPTIC) { // elliptic cone
|
||||
// extract contact info
|
||||
mjContact* con = d->contact + d->efc_id[i];
|
||||
|
||||
Reference in New Issue
Block a user