Page 1 of 1

Coordinate Projection

Posted: Mon Feb 13, 2012 2:44 am
by kishor
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.

Re: Coordinate Projection

Posted: Mon Feb 13, 2012 10:14 am
by sherm
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

Re: Coordinate Projection

Posted: Mon Feb 13, 2012 7:21 pm
by kishor
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.

Re: Coordinate Projection

Posted: Mon Feb 13, 2012 7:35 pm
by sherm
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

Re: Coordinate Projection

Posted: Mon Feb 13, 2012 7:42 pm
by kishor
Hi Sherm,
Thanks for the quick reply. This does clear things up for me.

Best Regards,
Kishor.