Page 1 of 1

Explanation of Sky Higher Source Code

Posted: Thu Jul 13, 2017 1:27 pm
by student
hi,
on "http://simtk-confluence.stanford.edu:80 ... ource+Code" there is code to get the velocity of center of mass: " Vec3 COM_velocity = osimModel.getMultibodySystem().getMatterSubsystem().calcSystemMassCenterVelocityInGround(osimState);"

and on "http://simtk-confluence.stanford.edu:80 ... timization" there is another one:
"osimModel.getSimbodyEngine().getVelocity(s,osimModel.getBodySet().get("r_ulna_radius_hand"),
massCenter, velocity);"

i dont get the difference between these two?
do both of them give velocity at each time of simulation?

also there is a settleTime defined for sky higher. if the simulation starts from the feet having contact with ground and then jumping why this is needed: " A settleTime is added so that the feet can come off initially without the event handler terminating the simulation early"?
i appreciate your help

regards
Shayan

Re: Explanation of Sky Higher Source Code

Posted: Thu Jul 13, 2017 2:11 pm
by jimmy
One uses the Simbody MatterSubsystem() to get Velocity, and the other uses the SimbodyEngine() to get the Velocity.

The difference in the examples is probably due to when the tutorials were built (one may be newer than the other).
A settleTime is added so that the feet can come off initially without the event handler terminating the simulation early"?
yes

Code: Select all

	// keep returning a positive value while the contact settles out
        double simTime = s.getTime();
        if (simTime < settleTime) {
            return 100.0;
        }