How to "not control" a joint/coordinate

Provide easy-to-use, extensible software for modeling, simulating, controlling, and analyzing the neuromusculoskeletal system.
POST REPLY
User avatar
Sietse Achterop
Posts: 79
Joined: Tue Sep 14, 2021 3:01 am

How to "not control" a joint/coordinate

Post by Sietse Achterop » Tue May 03, 2022 8:16 am

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 764 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
Attachments
CMakeLists.txt
To make the code
(1.04 KiB) Downloaded 77 times
pendulum.py.txt
To create Pendulum.osim
(3.62 KiB) Downloaded 57 times
Pendulum.osim
The model
(19.65 KiB) Downloaded 56 times
ControllerPendulum.cpp
To generate the motion
(4.66 KiB) Downloaded 69 times

User avatar
Colin Smith
Posts: 53
Joined: Fri Feb 24, 2012 11:50 am

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

Post by Colin Smith » Wed May 04, 2022 4:15 pm

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.

User avatar
Sietse Achterop
Posts: 79
Joined: Tue Sep 14, 2021 3:01 am

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

Post by Sietse Achterop » Thu May 05, 2022 4:53 am

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.

POST REPLY