We are trying to enforce constraints for a system with closed-chains using the Assembler object using the following:

Code: Select all

```
auto &system = osimModel.getMultibodySystem();
Assembler assembler(system);
assembler.assemble(state);
```

This assembles the model but most of the generalized coordinate bounds were violated. So we tried to enforce the bounds by adding the following before invoking assembler.assemble(state):

Code: Select all

```
for (i = 0; i < numGenCoords; ++i)
{
SimTK::MobilizedBodyIndex mbx = coords[i].getBodyIndex();
SimTK::MobilizerQIndex qx = coords[i].getMobilizerQIndex();
double lb = coords[i].getRangeMin()*180/Pi;
double ub = coords[i].getRangeMax() * 180 / Pi;
assembler.restrictQ(mbx, qx, lb, ub);
}
```

However this causes a compiler error because the second argument of the function restrictQ requires a SimTK:: MobilizerQIndex type while OpenSim:Coordinate class function getMobilizerQIndex() returns an integer! We tried the following which did not work:

Code: Select all

`SimTK::MobilizerQIndex qx = MobilizerQIndex::safeDownCast(coords[i].getMobilizerQIndex());`

This resulted in the error:

Code: Select all

`'safeDownCast': is not a member of 'SimTK::MobilizerQIndex'.`

Can anybody give us insight on how to get around this problem?