Hi everyone,
I am a newcomer to the optimal control theory and the amazing tool of OpenSim Moco. I find there are two class of OpenSim::MocoPathConstraint and OpenSim::Constraint which can add constraints to a problem. The difference between them confuse me.
There is a constraint named WeldConstraint in the class of OpenSim::Constraint which constraint six DoFs of a joint. If I customize a weld constraint in the class of OpenSim::MocoPathConstraint, would it make a change to the prediction?
Thanks,
Chonghui
What is the difference between path constraints and kinematic constraints?
- Chonghui Zhang
- Posts: 10
- Joined: Wed May 19, 2021 1:58 am
- Pasha van Bijlert
- Posts: 227
- Joined: Sun May 10, 2020 3:15 am
Re: What is the difference between path constraints and kinematic constraints?
Hi Chongui,
The terminology is a bit confusing. OpenSim::Constraint can essentially be thought of as adding an extra component to your model, that enforces a desired constraint by adding constraint forces (which can either be actual forces, or torques, depending on the type of joint you are constraining). So in the case of a WeldConstraint, you can think of it acting as a kneebrace, preventing flexion at the joint. As an aside, if you're interested in a WeldConstraint, I think I remember reading somewhere that you'd be better-off replacing the joint with a WeldJoint instead.
MocoPathConstraint is not a physical constraint on your model. Instead, it's a constraint on the movement (coordination) you would like to find after an optimization. This assumes that the model has enough controllable degrees of freedom to produce this movement, so you could also think of it as a constraint on the control space/ coordination of the movement. For example - I may want to keep the distance between the two knees above 10 cm throughout a walk cycle, even though the model is perfectly capable of them meeting at the midline. There are no external (constraint) forces involved, the optimizer is looking for solutions where you abide by your goal within the confines of the unmodified model.
Hope this helps!
Cheers,
Pasha
The terminology is a bit confusing. OpenSim::Constraint can essentially be thought of as adding an extra component to your model, that enforces a desired constraint by adding constraint forces (which can either be actual forces, or torques, depending on the type of joint you are constraining). So in the case of a WeldConstraint, you can think of it acting as a kneebrace, preventing flexion at the joint. As an aside, if you're interested in a WeldConstraint, I think I remember reading somewhere that you'd be better-off replacing the joint with a WeldJoint instead.
MocoPathConstraint is not a physical constraint on your model. Instead, it's a constraint on the movement (coordination) you would like to find after an optimization. This assumes that the model has enough controllable degrees of freedom to produce this movement, so you could also think of it as a constraint on the control space/ coordination of the movement. For example - I may want to keep the distance between the two knees above 10 cm throughout a walk cycle, even though the model is perfectly capable of them meeting at the midline. There are no external (constraint) forces involved, the optimizer is looking for solutions where you abide by your goal within the confines of the unmodified model.
Hope this helps!
Cheers,
Pasha
- Chonghui Zhang
- Posts: 10
- Joined: Wed May 19, 2021 1:58 am
Re: What is the difference between path constraints and kinematic constraints?
Hi Pasha,
Thanks for your detailed reply. Your examples make me better understand the difference. OpenSim::Constraint will add a constraint force, so it may affect the dynamics of the multibody system? If so, I think that we should choose OpenSim::Constraint or OpenSim::MocoPathConstraint carefully when we wanna add a constraint.
Thanks,
Chonghui
Thanks for your detailed reply. Your examples make me better understand the difference. OpenSim::Constraint will add a constraint force, so it may affect the dynamics of the multibody system? If so, I think that we should choose OpenSim::Constraint or OpenSim::MocoPathConstraint carefully when we wanna add a constraint.
Thanks,
Chonghui
- Pasha van Bijlert
- Posts: 227
- Joined: Sun May 10, 2020 3:15 am
Re: What is the difference between path constraints and kinematic constraints?
Hi Chongui,
Yes, adding OpenSim::Constraint will add constraint forces, so you are changing the multibody system itself, before simulating it.
Opensim::MocoPathConstraint will limit the search space/possible solutions of the simulation, without changing the multibody system.
Cheers,
Pasha
Yes, adding OpenSim::Constraint will add constraint forces, so you are changing the multibody system itself, before simulating it.
Opensim::MocoPathConstraint will limit the search space/possible solutions of the simulation, without changing the multibody system.
Cheers,
Pasha