Make elasticity plugins compatible with flex pins. Fixes #1235.
Before change: poncho 18.20s poncho_flex 44.60s floppy 4.70s floppy_flex 6.43s After change: poncho 18.23s poncho_flex 44.62s floppy 4.67s floppy_flex 6.57s PiperOrigin-RevId: 585952587 Change-Id: I0e7c1513f64c7ab1e6ad71e2168b4467c042b46f
This commit is contained in:
committed by
Copybara-Service
parent
7cb84d45c1
commit
7d8d4d398e
@@ -90,6 +90,8 @@ inline void ComputeForce(mjtNum* qfrc_passive,
|
||||
const std::vector<T>& elements,
|
||||
const std::vector<mjtNum>& metric,
|
||||
const std::vector<mjtNum>& elongationglob,
|
||||
const mjModel* m,
|
||||
const int* vertbodyid,
|
||||
const mjtNum* xpos) {
|
||||
for (int t = 0; t < elements.size(); t++) {
|
||||
const int* v = elements[t].vertices;
|
||||
@@ -126,8 +128,14 @@ inline void ComputeForce(mjtNum* qfrc_passive,
|
||||
|
||||
// insert into global force
|
||||
for (int i = 0; i < T::kNumVerts; i++) {
|
||||
for (int x = 0; x < 3; x++) {
|
||||
qfrc_passive[3*v[i]+x] -= force[3*i+x];
|
||||
int body_dofnum = 3;
|
||||
int body_dofadr = 3*v[i];
|
||||
if (vertbodyid) {
|
||||
body_dofnum = m->body_dofnum[vertbodyid[v[i]]];
|
||||
body_dofadr = m->body_dofadr[vertbodyid[v[i]]];
|
||||
}
|
||||
for (int x = 0; x < body_dofnum; x++) {
|
||||
qfrc_passive[body_dofadr+x] -= force[3*i+x];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user