Page 1 of 1

How to "not control" a joint/coordinate

Posted: Tue May 03, 2022 8:16 am
by sietse
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.
pendulum.png
the pendulum on a slider
pendulum.png (72.18 KiB) Viewed 754 times
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

Re: How to "not control" a joint/coordinate

Posted: Wed May 04, 2022 4:15 pm
by clnsmith
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.

Re: How to "not control" a joint/coordinate

Posted: Thu May 05, 2022 4:53 am
by sietse
Thanks for the reply!
controller->setActuators( osimModel.updActuators() );
There was only one actuator, so I assumed it was OK.
But changing the above to

Code: Select all

controller->addActuator(osimModel.updActuators().get("baract"));
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

Code: Select all

controller->setActuators(getActuatorsForCMC(_excludedActuators));
in CMCTool.cpp
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]);                                                                                                                                        
    }
did not change anything regrettably.