Hello all,
I created a simple example modelled after the ControllerExample from OpenSim.
Basically I added an extra joint that is not to be controlled, so it can move freely as allowed by physics,
but I can't get it to work.
The system consists of a pendulum hanging from a ceiling. But between the ceiling and the pendulum itself there is a sliderjoint. The green body is sitting between the sliderjoint and the pinjoint of the pendulum.
The idea is that when the pendulum is swinging that the entire pendulum will also be moving via the slider.
This works perfectly when, in the gui, I set the pendulum out of balance and do a Forward Dynamics simulation.
But when creating the motion via the ControllerPendulum.cpp program the slider does not move at all!
It seems that somehow the extra joint/coordinate (carJoint/carpos) also has a prescribed position and speed, both
being zero initially.
But I don't want that, this joint should not be controlled. It does not have a controller.
It should behave just like in a forward dynamics simulation.
Can this "controlling" be turned off for coordinates that have no controller?
Or is this a limitation of OpenSim?
Thanks in advance,
Sietse Achterop
How to "not control" a joint/coordinate
- Sietse Achterop
- Posts: 79
- Joined: Tue Sep 14, 2021 3:01 am
How to "not control" a joint/coordinate
- Attachments
-
- CMakeLists.txt
- To make the code
- (1.04 KiB) Downloaded 76 times
-
- pendulum.py.txt
- To create Pendulum.osim
- (3.62 KiB) Downloaded 56 times
-
- Pendulum.osim
- The model
- (19.65 KiB) Downloaded 55 times
-
- ControllerPendulum.cpp
- To generate the motion
- (4.66 KiB) Downloaded 68 times
- Colin Smith
- Posts: 53
- Joined: Fri Feb 24, 2012 11:50 am
Re: How to "not control" a joint/coordinate
controller->setActuators( osimModel.updActuators() );
Here, osimModel.updActuators() is giving a list of all the actuators in the model to the controller.
Trying using osimModel.updForceSet().get('actuator_name') to input only the actuators you want to control.
Otherwise, as long as a coordinate is unlocked and has no controller, it should act as you intend by default.
Here, osimModel.updActuators() is giving a list of all the actuators in the model to the controller.
Trying using osimModel.updForceSet().get('actuator_name') to input only the actuators you want to control.
Otherwise, as long as a coordinate is unlocked and has no controller, it should act as you intend by default.
- Sietse Achterop
- Posts: 79
- Joined: Tue Sep 14, 2021 3:01 am
Re: How to "not control" a joint/coordinate
Thanks for the reply!
But changing the above to
Solved my problem! It now is working as expected.
Is there something wrong with updActuators?
In both cases only the same single actuator is added.
Thanks, Sietse
== PS == I came here after similar problems when using the CMC-tool, which crashed for me.
But changing in CMCTool.cpp
into
did not change anything regrettably.
There was only one actuator, so I assumed it was OK.controller->setActuators( osimModel.updActuators() );
But changing the above to
Code: Select all
controller->addActuator(osimModel.updActuators().get("baract"));
Is there something wrong with updActuators?
In both cases only the same single actuator is added.
Thanks, Sietse
== PS == I came here after similar problems when using the CMC-tool, which crashed for me.
But changing
Code: Select all
controller->setActuators(getActuatorsForCMC(_excludedActuators));
into
Code: Select all
const Set<Actuator> allacts = getActuatorsForCMC(_excludedActuators);
int nacts = allacts.getSize();
for(int i=0; i<nacts; i++) {
controller->addActuator(allacts[i]);
}