Package jsim.forces

Class ActuatorForce

java.lang.Object
jsim.forces.ActuatorForce
All Implemented Interfaces:
ForceGenerator

public final class ActuatorForce extends Object implements 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
    Constructor
    Description
    Create an actuator for the given rigid body.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    apply(double dt)
    Apply forces/torques to whichever bodies this generator influences.
    void
    setForce(double fx, double fy, double fz)
    Set the world-frame force to apply at the body's centre of mass (N).
    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).
    void
    setTorque(double tx, double ty, double tz)
    Set the world-frame torque to apply directly (N·m).
    void
    Clear all actuator forces and torques (e.g.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • ActuatorForce

      public ActuatorForce(RigidBody body)
      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: ForceGenerator
      Apply forces/torques to whichever bodies this generator influences.
      Specified by:
      apply in interface ForceGenerator
      Parameters:
      dt - the fixed simulation timestep in seconds