Class PositionController.PD

java.lang.Object
net.dermetfan.gdx.physics.box2d.PositionController
net.dermetfan.gdx.physics.box2d.PositionController.PD
Enclosing class:
PositionController

public static class PositionController.PD extends PositionController
a proportional-derivative controller
Since:
0.11.1
See Also:
  • Constructor Details

    • PD

      public PD(float gainP, float gainD, com.badlogic.gdx.math.Vector2 destination)
      Parameters:
      gainP - the proportional gain on both axes
      gainD - the derivative gain on both axes
      destination - the destination
    • PD

      public PD(com.badlogic.gdx.math.Vector2 gainP, com.badlogic.gdx.math.Vector2 gainD, com.badlogic.gdx.math.Vector2 destination)
      Parameters:
      gainP - the gainP
      gainD - the gainD
      destination - the destination
  • Method Details

    • calculateForce

      public static float calculateForce(float gainP, float gainD, float pos, float dest, float vel)
      See Also:
    • calculateForce

      public static com.badlogic.gdx.math.Vector2 calculateForce(float gainPX, float gainPY, float gainDX, float gainDY, float posX, float posY, float destX, float destY, float velX, float velY)
      See Also:
    • calculateForce

      public static com.badlogic.gdx.math.Vector2 calculateForce(com.badlogic.gdx.math.Vector2 gainP, com.badlogic.gdx.math.Vector2 gainD, com.badlogic.gdx.math.Vector2 pos, com.badlogic.gdx.math.Vector2 dest, com.badlogic.gdx.math.Vector2 vel)
      See Also:
    • calculateForce

      public com.badlogic.gdx.math.Vector2 calculateForce(com.badlogic.gdx.physics.box2d.Body body, com.badlogic.gdx.math.Vector2 point)
      Specified by:
      calculateForce in class PositionController
      Parameters:
      point - the world point at which the force should be applied
      Returns:
      the force to apply at the given point
    • calculateForceToCenter

      public com.badlogic.gdx.math.Vector2 calculateForceToCenter(com.badlogic.gdx.physics.box2d.Body body)
      Specified by:
      calculateForceToCenter in class PositionController
      Returns:
      the force to apply at the center of mass of the Body
    • getGainP

      public com.badlogic.gdx.math.Vector2 getGainP()
      Returns:
      the gainP
    • setGainP

      public void setGainP(com.badlogic.gdx.math.Vector2 gainP)
      Parameters:
      gainP - the gainP to set
    • getGainD

      public com.badlogic.gdx.math.Vector2 getGainD()
      Returns:
      the gainD
    • setGainD

      public void setGainD(com.badlogic.gdx.math.Vector2 gainD)
      Parameters:
      gainD - the gainD to set
    • getDestination

      public com.badlogic.gdx.math.Vector2 getDestination()
      Returns:
      the destination
    • setDestination

      public void setDestination(com.badlogic.gdx.math.Vector2 destination)
      Parameters:
      destination - the destination to set