Sparse ten_J and ten_J_colind
PiperOrigin-RevId: 869712136 Change-Id: Id2979684aa0c39552cb8453852483cbac55f0ea3
This commit is contained in:
committed by
Copybara-Service
parent
277f469239
commit
5903d4826f
@@ -3226,7 +3226,16 @@ int mjCModel::CountNJmom(const mjModel* m) {
|
||||
return count;
|
||||
}
|
||||
|
||||
// compute non-zeros in ten_J matrix
|
||||
int mjCModel::CountNJten(const mjModel* m) {
|
||||
int nv = m->nv;
|
||||
int ntendon = m->ntendon;
|
||||
|
||||
// conservative upper bound: each tendon can have at most nv non-zeros
|
||||
// TODO(taylorhowell): compute tighter bound
|
||||
int count = ntendon * nv;
|
||||
return count;
|
||||
}
|
||||
|
||||
// copy objects outside kinematic tree
|
||||
void mjCModel::CopyObjects(mjModel* m) {
|
||||
@@ -5037,6 +5046,9 @@ void mjCModel::TryCompile(mjModel*& m, mjData*& d, const mjVFS* vfs) {
|
||||
// compute non-zeros in actuator_moment
|
||||
m->nJmom = nJmom = CountNJmom(m);
|
||||
|
||||
// compute non-zeros in ten_J
|
||||
m->nJten = nJten = CountNJten(m);
|
||||
|
||||
// scale mass
|
||||
if (compiler.settotalmass > 0) {
|
||||
mj_setTotalmass(m, compiler.settotalmass);
|
||||
|
||||
Reference in New Issue
Block a user