#include <LinearMotor.h>
A Linear motor will try to reach a target speed with a specified max force.
- Deprecated:
- Use Momentum.v2.LinearMotor and getHoldPositionDamping()/setHoldPositionDamping() for position-holding damping. See Migrating from the deprecated v1 API.
◆ getCurrentForce()
| double MOMENTUM_NAMESPACE::LinearSecondaryJoint::getCurrentForce |
( |
| ) |
const |
|
inherited |
Get the force that the secondary constraint is applying to the object at the moment.
- Returns
- the current force created by the constraint. Unit is in Newton.
◆ getDamping()
| double MOMENTUM_NAMESPACE::SecondaryJoint::getDamping |
( |
| ) |
const |
|
inherited |
Get the damping of the secondary constraint, depending if it is linear or rotational it is in different units, newton-seconds per meter for linear and newton-meter-seconds per radian if it is rotational.
- Returns
- the current damping of the secondary constraint
◆ getElasticity()
| double MOMENTUM_NAMESPACE::SecondaryJoint::getElasticity |
( |
| ) |
const |
|
inherited |
Get the elasticity of the secondary constraint, depending if it is linear or rotational it is in different units, newton per meter for linear and newton per radian if it is rotational.
- Returns
- the current elasticity of the secondary constraint
◆ getEnabled()
| bool MOMENTUM_NAMESPACE::SecondaryJoint::getEnabled |
( |
| ) |
const |
|
inherited |
Get if the secondary constraint is enabled on its parent joint.
- Returns
- true if the constraint is enabled for simulation
◆ getEnableSpringAtZeroSpeed()
| bool MOMENTUM_NAMESPACE::LinearMotor::getEnableSpringAtZeroSpeed |
( |
| ) |
const |
- Returns
- true if the motor should act like a spring at target speed = zero
◆ getForceLimit()
| std::pair< double, double > MOMENTUM_NAMESPACE::LinearSecondaryJoint::getForceLimit |
( |
| ) |
const |
|
inherited |
Get the lower and upper force of the secondary constraint.
The unit is in Newton.
- Returns
- the current force range of the constraint
◆ getTargetSpeed()
| double MOMENTUM_NAMESPACE::LinearMotor::getTargetSpeed |
( |
| ) |
const |
Get the target speed that the motor tries to reach using the available force.
In meters per second.
- Returns
- The target speed of the motor
◆ setDamping()
| void MOMENTUM_NAMESPACE::SecondaryJoint::setDamping |
( |
double |
damping | ) |
|
|
inherited |
Set the damping of the secondary constraint, depending if it is linear or rotational it is in different units, newton-seconds per meter for linear and newton-meter-seconds per radian if it is rotational.
- Parameters
-
| damping | the new damping of the secondary constraint |
Only available in simulation mode
◆ setElasticity()
| void MOMENTUM_NAMESPACE::SecondaryJoint::setElasticity |
( |
double |
elasticity | ) |
|
|
inherited |
Set the elasticity of the secondary constraint, depending if it is linear or rotational it is in different units, newton-seconds per meter for linear and newton-meter-seconds per radian if it is rotational.
- Parameters
-
| elasticity | the new elasticity of the secondary constraint |
Only available in simulation mode
◆ setEnabled()
| void MOMENTUM_NAMESPACE::SecondaryJoint::setEnabled |
( |
bool |
enabled | ) |
|
|
inherited |
Set if the secondary constraint is enabled on its parent joint.
- Parameters
-
| enabled | - the new enable state for the constraint |
Only available in simulation mode
◆ setEnableSpringAtZeroSpeed()
| void MOMENTUM_NAMESPACE::LinearMotor::setEnableSpringAtZeroSpeed |
( |
bool |
flag | ) |
|
When target speed is set to zero for the motor, the motor can be specified to act like a spring, keeping the current position.
Only available in simulation mode
- Parameters
-
| flag | - If true, the motor will act like a spring if target speed == 0 |
◆ setForceLimit() [1/2]
| bool MOMENTUM_NAMESPACE::LinearSecondaryJoint::setForceLimit |
( |
double |
lower, |
|
|
double |
upper |
|
) |
| |
|
inherited |
Set the lower and upper force of the secondary constraint.
The unit is in Newton.
Both cannot be inf, or -inf, that will be ignored and the method will return false
- Parameters
-
| lower | - the new available force of the constraint in the negative direction |
| upper | - the new available force of the constraint in the positive direction |
Only available in simulation mode
- Returns
- true if values are correct.
◆ setForceLimit() [2/2]
| bool MOMENTUM_NAMESPACE::LinearSecondaryJoint::setForceLimit |
( |
std::pair< double, double > |
limit | ) |
|
|
inherited |
Set the lower and upper force of the secondary constraint.
The unit is in Newton.
Both cannot be inf, or -inf, that will be ignored and the method will return false
- Parameters
-
| limit | - the new force range of the constraint |
Only available in simulation mode
- Returns
- true if values are correct
◆ setTargetSpeed()
| void MOMENTUM_NAMESPACE::LinearMotor::setTargetSpeed |
( |
double |
speed | ) |
|
Set the target speed that the motor tries to reach using the available force.
In meters per second. Infinity is not a valid speed and will be ignored with a warning.
- Parameters
-
| speed | - the new target speed of the motor |
Only available in simulation mode