PlayRho  1.1.0
An Interactive Real-Time-Oriented C++ Physics Engine & Library
playrho::d2::MotorJointConf Struct Reference

Motor joint definition. More...

#include <MotorJointConf.hpp>

Inheritance diagram for playrho::d2::MotorJointConf:
[legend]
Collaboration diagram for playrho::d2::MotorJointConf:
[legend]

Public Types

using super = JointBuilder< MotorJointConf >
 Super type.
 
- Public Types inherited from playrho::d2::JointBuilder< MotorJointConf >
using value_type = MotorJointConf
 Value type.
 
using reference = value_type &
 Reference type.
 

Public Member Functions

constexpr MotorJointConf ()=default
 Default constructor.
 
 MotorJointConf (BodyID bA, BodyID bB, Length2 lo=Length2{}, Angle ao=0_deg) noexcept
 Initialize the bodies and offsets using the current transforms.
 
constexpr auto & UseLinearOffset (Length2 v) noexcept
 Uses the given linear offset value.
 
constexpr auto & UseAngularOffset (Angle v) noexcept
 Uses the given angular offset value.
 
constexpr auto & UseMaxForce (NonNegative< Force > v) noexcept
 Uses the given maximum force value.
 
constexpr auto & UseMaxTorque (NonNegative< Torque > v) noexcept
 Uses the given max torque value.
 
constexpr auto & UseCorrectionFactor (Real v) noexcept
 Uses the given correction factor.
 
- Public Member Functions inherited from playrho::d2::JointBuilder< MotorJointConf >
constexpr reference UseBodyA (BodyID b) noexcept
 Use value for body A setting.
 
constexpr reference UseBodyB (BodyID b) noexcept
 Use value for body B setting.
 
constexpr reference UseCollideConnected (bool v) noexcept
 Use value for collide connected setting.
 

Public Attributes

Length2 linearOffset = Length2{}
 Position of body-B minus the position of body-A, in body-A's frame.
 
Angle angularOffset = 0_deg
 Angle of body-B minus angle of body-A.
 
Momentum2 linearImpulse {}
 Linear impulse.
 
AngularMomentum angularImpulse {}
 Angular impulse.
 
NonNegative< ForcemaxForce = NonNegative<Force>(1_N)
 Maximum motor force.
 
NonNegative< TorquemaxTorque = NonNegative<Torque>(1_Nm)
 Maximum motor torque.
 
Real correctionFactor = Real(0.3)
 Position correction factor in the range [0,1].
 
Length2 rA = {}
 Relative A.
 
Length2 rB = {}
 Relative B.
 
Length2 linearError {}
 Linear error.
 
Angle angularError = 0_deg
 Angular error.
 
Mass22 linearMass = {}
 2-by-2 linear mass matrix in kilograms.
 
RotInertia angularMass = {}
 Angular mass.
 
- Public Attributes inherited from playrho::d2::JointConf
BodyID bodyA = InvalidBodyID
 1st attached body.
 
BodyID bodyB = InvalidBodyID
 2nd attached body.
 
bool collideConnected = false
 Collide connected. More...
 

Related Functions

(Note that these are not member functions.)

constexpr auto GetLocalAnchorA (const MotorJointConf &) noexcept
 Gets the local anchor A.
 
constexpr auto GetLocalAnchorB (const MotorJointConf &) noexcept
 Gets the local anchor B.
 
constexpr auto ShiftOrigin (MotorJointConf &, Length2) noexcept
 Shifts the origin notion of the given configuration.
 
void InitVelocity (MotorJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step, const ConstraintSolverConf &conf)
 Initializes velocity constraint data based on the given solver data. More...
 
bool SolveVelocity (MotorJointConf &object, std::vector< BodyConstraint > &bodies, const StepConf &step)
 Solves velocity constraint. More...
 
bool SolvePosition (const MotorJointConf &object, std::vector< BodyConstraint > &bodies, const ConstraintSolverConf &conf)
 Solves the position constraint. More...
 
constexpr auto GetMaxForce (const MotorJointConf &object) noexcept
 Free function for getting the maximum force value of the given configuration.
 
constexpr auto SetMaxForce (MotorJointConf &object, NonNegative< Force > value) noexcept
 Free function for setting the maximum force value of the given configuration.
 
constexpr auto GetMaxTorque (const MotorJointConf &object) noexcept
 Free function for getting the maximum torque value of the given configuration.
 
constexpr auto SetMaxTorque (MotorJointConf &object, NonNegative< Torque > value) noexcept
 Free function for setting the maximum torque value of the given configuration.
 
constexpr auto GetLinearError (const MotorJointConf &object) noexcept
 Free function for getting the linear error value of the given configuration.
 
constexpr auto GetAngularError (const MotorJointConf &object) noexcept
 Free function for getting the angular error value of the given configuration.
 
constexpr auto GetLinearOffset (const MotorJointConf &object) noexcept
 Free function for getting the linear offset value of the given configuration.
 
constexpr auto SetLinearOffset (MotorJointConf &object, Length2 value) noexcept
 Free function for setting the linear offset value of the given configuration.
 
constexpr auto GetAngularOffset (const MotorJointConf &object) noexcept
 Free function for getting the angular offset value of the given configuration.
 
constexpr auto SetAngularOffset (MotorJointConf &object, Angle value) noexcept
 Free function for setting the angular offset value of the given configuration.
 
constexpr auto GetCorrectionFactor (const MotorJointConf &object) noexcept
 Free function for getting the correction factor value of the given configuration.
 
constexpr auto SetCorrectionFactor (MotorJointConf &object, Real value) noexcept
 Free function for setting the correction factor value of the given configuration.
 

Detailed Description

Motor joint definition.

A motor joint is used to control the relative motion between two bodies. A typical usage is to control the movement of a dynamic body with respect to the ground.

See also
Joint, World::CreateJoint
Examples
MotorJoint.cpp.

Friends And Related Function Documentation

◆ InitVelocity()

void InitVelocity ( MotorJointConf object,
std::vector< BodyConstraint > &  bodies,
const StepConf step,
const ConstraintSolverConf conf 
)
related

Initializes velocity constraint data based on the given solver data.

Note
This MUST be called prior to calling SolveVelocity.
See also
SolveVelocity.

◆ SolvePosition()

bool SolvePosition ( const MotorJointConf object,
std::vector< BodyConstraint > &  bodies,
const ConstraintSolverConf conf 
)
related

Solves the position constraint.

Returns
true if the position errors are within tolerance.

◆ SolveVelocity()

bool SolveVelocity ( MotorJointConf object,
std::vector< BodyConstraint > &  bodies,
const StepConf step 
)
related

Solves velocity constraint.

Precondition
InitVelocity has been called.
See also
InitVelocity.
Returns
true if velocity is "solved", false otherwise.

The documentation for this struct was generated from the following files: