Package jsim.forces
Class ActuatorForce
java.lang.Object
jsim.forces.ActuatorForce
- All Implemented Interfaces:
ForceGenerator
Force generator that represents a motor, pneumatic, or other actuator.
Robot code sets the desired force/torque via setForce(double, double, double) and setTorque(double, double, double)
each control loop; the simulation picks up the latest values on the next physics tick.
All values are in world frame unless the body does not rotate (e.g. using FIXED_ROTATION).
To model a drivetrain motor, create one ActuatorForce per wheel and set the wheel's traction force each tick based on motor output voltage and the drive model.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidapply(double dt) Apply forces/torques to whichever bodies this generator influences.voidsetForce(double fx, double fy, double fz) Set the world-frame force to apply at the body's centre of mass (N).voidsetForceAtPoint(double fx, double fy, double fz, double px, double py, double pz) Set the force and its world-space application point (generates torque automatically).voidsetTorque(double tx, double ty, double tz) Set the world-frame torque to apply directly (N·m).voidzero()Clear all actuator forces and torques (e.g.
-
Constructor Details
-
ActuatorForce
Create an actuator for the given rigid body.- Parameters:
body- the rigid body this actuator drives
-
-
Method Details
-
setForce
public void setForce(double fx, double fy, double fz) Set the world-frame force to apply at the body's centre of mass (N).- Parameters:
fx- X component (N)fy- Y component (N)fz- Z component (N)
-
setTorque
public void setTorque(double tx, double ty, double tz) Set the world-frame torque to apply directly (N·m).- Parameters:
tx- X component (N·m)ty- Y component (N·m)tz- Z component (N·m)
-
setForceAtPoint
public void setForceAtPoint(double fx, double fy, double fz, double px, double py, double pz) Set the force and its world-space application point (generates torque automatically).- Parameters:
fx- force X component (N)fy- force Y component (N)fz- force Z component (N)px- application point X (metres)py- application point Y (metres)pz- application point Z (metres)
-
zero
public void zero()Clear all actuator forces and torques (e.g. on disable). -
apply
public void apply(double dt) Description copied from interface:ForceGeneratorApply forces/torques to whichever bodies this generator influences.- Specified by:
applyin interfaceForceGenerator- Parameters:
dt- the fixed simulation timestep in seconds
-