Example #1
0
Force::MobilityLinearStop::MobilityLinearStop
   (GeneralForceSubsystem&    forces, 
    const MobilizedBody&      mobod, 
    MobilizerQIndex           whichQ, 
    Real                      defaultStiffness,
    Real                      defaultDissipation,
    Real                      defaultQLow,
    Real                      defaultQHigh)
:   Force(new MobilityLinearStopImpl(mobod,whichQ,
                                     defaultStiffness, defaultDissipation,
                                     defaultQLow, defaultQHigh))
{
    SimTK_ERRCHK2_ALWAYS(defaultStiffness >= 0 && defaultDissipation >= 0, 
        "Force::MobilityLinearStop::MobilityLinearStop()",
        "Stiffness and dissipation coefficient must be nonnegative "
        "(defaultStiffness=%g, defaultDissipation=%g).",
        defaultStiffness, defaultDissipation);
    SimTK_ERRCHK2_ALWAYS(defaultQLow <= defaultQHigh, 
        "Force::MobilityLinearStop::MobilityLinearStop()",
        "Lower bound can't be larger than upper bound "
        "(defaultQLow=%g, defaultQHigh=%g).",
        defaultQLow, defaultQHigh);

    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #2
0
Force::MobilityConstantForce::MobilityConstantForce
   (GeneralForceSubsystem&  forces, 
    const MobilizedBody&    mobod, 
    MobilizerUIndex         whichU,
    Real                    defaultForce) 
: Force(new MobilityConstantForceImpl(mobod, whichU, defaultForce)) {
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #3
0
Force::Gravity::Gravity
   (GeneralForceSubsystem&          forces,
    const SimbodyMatterSubsystem&   matter,
    const Vec3&                     defGravity)
:   Force(new GravityImpl(matter,defGravity,0))
{
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #4
0
Force::Gravity::Gravity
   (GeneralForceSubsystem&          forces,
    const SimbodyMatterSubsystem&   matter,
    Real                            defMagnitude)
:   Force(new GravityImpl(matter,defMagnitude,0))
{
    SimTK_ERRCHK1_ALWAYS(defMagnitude >= 0,
        "Force::Gravity::Gravity(magnitude)",
        "The gravity magnitude g must be nonnegative but was specified as %g.",
        defMagnitude);
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #5
0
Force::MobilityLinearDamper::
MobilityLinearDamper(GeneralForceSubsystem& forces, 
                     const MobilizedBody&   mobod, 
                     MobilizerUIndex        whichU,
                     Real                   defaultDamping) 
:   Force(new MobilityLinearDamperImpl(mobod, whichU, defaultDamping)) 
{
    SimTK_ERRCHK1_ALWAYS(defaultDamping >= 0, 
        "Force::MobilityLinearDamper::MobilityLinearDamper()",
        "Damping coefficient must be nonnegative "
        "(defaultDamping=%g).", defaultDamping);

    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #6
0
Force::MobilityLinearSpring::
MobilityLinearSpring(GeneralForceSubsystem&  forces, 
                     const MobilizedBody&    mobod, 
                     MobilizerQIndex         whichQ, 
                     Real                    defaultStiffness, 
                     Real                    defaultQZero) 
:   Force(new MobilityLinearSpringImpl(mobod, whichQ, 
                                       defaultStiffness, defaultQZero)) 
{
    SimTK_ERRCHK1_ALWAYS(defaultStiffness >= 0, 
        "Force::MobilityLinearSpring::MobilityLinearSpring()",
        "Stiffness coefficient must be nonnegative "
        "(defaultStiffness=%g).", defaultStiffness);

    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #7
0
CableSpring::CableSpring
   (GeneralForceSubsystem&  forces, 
    const CablePath&        path,
    Real                    defaultStiffness,
    Real                    defaultSlackLength,
    Real                    defaultDissipationCoef)
:   Force(new CableSpring::Impl(path, defaultStiffness, defaultSlackLength, 
                                defaultDissipationCoef))
{
    SimTK_ERRCHK_ALWAYS(defaultStiffness >= 0,
        "CableSpring constructor", "Spring constant must be nonnegative.");
    SimTK_ERRCHK_ALWAYS(defaultSlackLength >= 0,
        "CableSpring constructor", "Slack length must be nonnegative.");
    SimTK_ERRCHK_ALWAYS(defaultDissipationCoef >= 0,
        "CableSpring constructor", "Dissipation coefficient must be nonnegative.");
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #8
0
Force::Gravity::Gravity
   (GeneralForceSubsystem&          forces,
    const SimbodyMatterSubsystem&   matter,
    const UnitVec3&                 defDirection,
    Real                            defMagnitude,
    Real                            defZeroHeight)
:   Force(new GravityImpl(matter,defDirection,defMagnitude,defZeroHeight))
{
    SimTK_ERRCHK1_ALWAYS(defMagnitude >= 0,
        "Force::Gravity::Gravity(downDirection,magnitude)",
        "The gravity magnitude g must be nonnegative but was specified as %g.",
        defMagnitude);
    SimTK_ERRCHK_ALWAYS(defDirection.isFinite(),
        "Force::Gravity::Gravity(downDirection,magnitude)",
        "A non-finite 'down' direction was received; did you specify a zero-"
        "length Vec3? The direction must be non-zero.");
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #9
0
Force::DiscreteForces::DiscreteForces
   (GeneralForceSubsystem& forces, const SimbodyMatterSubsystem& matter) 
:   Force(new DiscreteForcesImpl(matter)) {
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #10
0
Force::Custom::Custom(GeneralForceSubsystem& forces, Implementation* implementation) : 
        Force(new CustomImpl(implementation)) {
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
ElasticFoundationForce::ElasticFoundationForce(GeneralForceSubsystem& forces, GeneralContactSubsystem& contacts, ContactSetIndex set) :
        Force(new ElasticFoundationForceImpl(contacts, set)) {
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #12
0
Force::ConstantTorque::ConstantTorque(GeneralForceSubsystem& forces, const MobilizedBody& body, const Vec3& torque) :
        Force(new ConstantTorqueImpl(body, torque)) {
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #13
0
Force::GlobalDamper::GlobalDamper(GeneralForceSubsystem& forces, const SimbodyMatterSubsystem& matter,
        Real damping) : Force(new GlobalDamperImpl(matter, damping)) {
    assert(damping >= 0);
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #14
0
Force::ConstantForce::ConstantForce(GeneralForceSubsystem& forces, const MobilizedBody& body, const Vec3& station, const Vec3& force) :
        Force(new ConstantForceImpl(body, station, force)) {
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #15
0
Force::TwoPointLinearSpring::TwoPointLinearSpring(GeneralForceSubsystem& forces, const MobilizedBody& body1, const Vec3& station1,
        const MobilizedBody& body2, const Vec3& station2, Real k, Real x0) : Force(new TwoPointLinearSpringImpl(
        body1, station1, body2, station2, k, x0)) {
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #16
0
Force::UniformGravity::UniformGravity(GeneralForceSubsystem& forces, const SimbodyMatterSubsystem& matter,
        const Vec3& g, Real zeroHeight) : Force(new UniformGravityImpl(matter, g, zeroHeight)) {
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #17
0
Force::TwoPointLinearDamper::TwoPointLinearDamper(GeneralForceSubsystem& forces, const MobilizedBody& body1, const Vec3& station1,
        const MobilizedBody& body2, const Vec3& station2, Real damping) : Force(new TwoPointLinearDamperImpl(
        body1, station1, body2, station2, damping)) {
    assert(damping >= 0);
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}
Example #18
0
Force::TwoPointConstantForce::TwoPointConstantForce(GeneralForceSubsystem& forces, const MobilizedBody& body1, const Vec3& station1,
        const MobilizedBody& body2, const Vec3& station2, Real force) : Force(new TwoPointConstantForceImpl(
        body1, station1, body2, station2, force)) {
    updImpl().setForceSubsystem(forces, forces.adoptForce(*this));
}