Coordinate Projection

Simbody is useful for internal coordinate and coarse grained molecule modeling, large scale mechanical models like skeletons, and anything else that can be modeled as bodies interconnected by joints, acted upon by forces, and restricted by constraints.
POST REPLY
User avatar
Kishor Bhalerao
Posts: 21
Joined: Thu Mar 13, 2008 12:52 pm

Coordinate Projection

Post by Kishor Bhalerao » Mon Feb 13, 2012 2:44 am

Hi Sherm,
Is there any easy way I can perform coordinate projection from main() ? For a constrained serial chain type system given in ChainExample.cpp, one can use Assembler::assemble(state) and this drives the position level errors to zero. Are there any functions I can call from main() which also drive the velocity level errors to zero ?

Best Regards,
Kishor.

User avatar
Michael Sherman
Posts: 807
Joined: Fri Apr 01, 2005 6:05 pm

Re: Coordinate Projection

Post by Michael Sherman » Mon Feb 13, 2012 10:14 am

Hi, Kishor.

Yes. There is no direct equivalent to the Assembler, but you can call the coordinate projection method System::project() directly to solve velocity constraints. The calling sequence is ugly at the moment with some esoteric parameters used by integrators that you should just set to 1 (this will be fixed in Simbody 3.0). Here's an example:

Code: Select all

    
    MultibodySystem system;
    //...
    Vector dummy;
    system.project(state, ConstraintTol, 
        Vector(state.getNY(), 1), Vector(state.getNYErr(), 1), dummy,
        System::ProjectOptions::VelocityOnly);
    system.realize(state, Stage::Velocity);
You can look this up in doxygen for more info but if you use it exactly as above it should perform a least squares projection of the u's to satisfy the velocity constraints.

Best regards,
Sherm

User avatar
Kishor Bhalerao
Posts: 21
Joined: Thu Mar 13, 2008 12:52 pm

Re: Coordinate Projection

Post by Kishor Bhalerao » Mon Feb 13, 2012 7:21 pm

Hi Sherm,
Another question. Is there a difference between Assembler::assemble() and MultibodySystem::project(..,ProjectionOptions::PositionOnly) ? Do these two functions do the same thing ? Or perhaps project() expects that the errors in position and velocity level are not excessive ?

Also, if I have understood this right, MultibodySystem::project() implements the algorithm described in section 10.1 of the Simbody Theory Manual. Is there a way to specify the number of iterations project() must perform before giving up ?

Best Regards,
Kishor.

User avatar
Michael Sherman
Posts: 807
Joined: Fri Apr 01, 2005 6:05 pm

Re: Coordinate Projection

Post by Michael Sherman » Mon Feb 13, 2012 7:35 pm

Hi, Kishor. Yes, that's exactly right -- project() is the implementation of coordinate projection from the manual and is used primarily by the integrators. It expects that only a modest change will be required, and it must perform a least-squares projection. It also has provision for projecting out some of the integrator's error estimate.

project(Positions) lacks many Assembler features such as marker tracking and specification of individual coordinate values, not to mention the ability to assemble from a long way off.

You can't control the number of iterations except by setting the constraint tolerance. In general project() is expected to be very fast. Simbody 3.0 provides a nicer interface and more control.

Best regards,
Sherm

User avatar
Kishor Bhalerao
Posts: 21
Joined: Thu Mar 13, 2008 12:52 pm

Re: Coordinate Projection

Post by Kishor Bhalerao » Mon Feb 13, 2012 7:42 pm

Hi Sherm,
Thanks for the quick reply. This does clear things up for me.

Best Regards,
Kishor.

POST REPLY