hmi.physics.controller
Class BallJointController

java.lang.Object
  extended by hmi.physics.controller.BallJointController
All Implemented Interfaces:
PhysicalController

public class BallJointController
extends Object
implements PhysicalController

A PD-controller that guides a ball joint to a certain desired angle and (optionally) desired avelocity for each angle: torque = ks * (desiredangle-currentangle) + ds * (desiredavelocity - currentavelocity) with ks the spring gain, ds the damper gain Note that this controller requires a high physical simulation rate (3 ms or less)


Field Summary
private  float anglex
           
private  float angley
           
private  float anglez
           
private  float aprevx
           
private  float aprevy
           
private  float aprevz
           
private  float avelx
           
private  float avely
           
private  float avelz
           
private static float DEFAULT_DSX
           
private static float DEFAULT_DSY
           
private static float DEFAULT_DSZ
           
private static float DEFAULT_KSX
           
private static float DEFAULT_KSY
           
private static float DEFAULT_KSZ
           
private  String[] desJointIDs
           
private  float dsx
           
private  float dsy
           
private  float dsz
           
private  boolean firstRun
           
private  PhysicalJoint joint
           
private  String jointId
           
private  String[] jointIDs
           
private  float ksx
           
private  float ksy
           
private  float ksz
           
private  org.slf4j.Logger logger
           
private  PhysicalHumanoid pHuman
           
 
Constructor Summary
BallJointController()
           
BallJointController(PhysicalJoint j, float ax, float ay, float az)
          Constructor, sets up a PD-controller with 0 desired velocity Spring and damper gains are set up to dampen a shoulder joint that loosely hangs down
BallJointController(PhysicalJoint j, float ax, float ay, float az, float avx, float avy, float avz, float kx, float ky, float kz, float dx, float dy, float dz)
          Constructor
 
Method Summary
 PhysicalController copy(PhysicalHumanoid ph)
          Creates a copy of the controller
 String[] getDesiredJointIDs()
          Gets the ids of joints the controller would like to steer if available
 String getParameterValue(String name)
          Get the parameter value of parameter name, return null if not found
 String[] getRequiredJointIDs()
          Gets the ids of controlled joints
 void reset()
          Clears out all previous time dependen variables
 void setParameterValue(String name, float value)
           
 void setParameterValue(String name, String value)
           
 void setPhysicalHumanoid(PhysicalHumanoid ph)
          Links the controller to a new set of physical joints
 void setSprings(float kx, float ky, float kz)
          Sets new spring values
 void update(double timeDiff)
          Updates the controller
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private org.slf4j.Logger logger

joint

private PhysicalJoint joint

jointId

private String jointId

anglex

private float anglex

angley

private float angley

anglez

private float anglez

avelx

private float avelx

avely

private float avely

avelz

private float avelz

aprevx

private float aprevx

aprevy

private float aprevy

aprevz

private float aprevz

ksx

private float ksx

dsx

private float dsx

ksy

private float ksy

dsy

private float dsy

ksz

private float ksz

dsz

private float dsz

DEFAULT_KSX

private static final float DEFAULT_KSX
See Also:
Constant Field Values

DEFAULT_DSX

private static final float DEFAULT_DSX
See Also:
Constant Field Values

DEFAULT_KSY

private static final float DEFAULT_KSY
See Also:
Constant Field Values

DEFAULT_DSY

private static final float DEFAULT_DSY
See Also:
Constant Field Values

DEFAULT_KSZ

private static final float DEFAULT_KSZ
See Also:
Constant Field Values

DEFAULT_DSZ

private static final float DEFAULT_DSZ
See Also:
Constant Field Values

jointIDs

private String[] jointIDs

desJointIDs

private String[] desJointIDs

firstRun

private boolean firstRun

pHuman

private PhysicalHumanoid pHuman
Constructor Detail

BallJointController

public BallJointController(PhysicalJoint j,
                           float ax,
                           float ay,
                           float az,
                           float avx,
                           float avy,
                           float avz,
                           float kx,
                           float ky,
                           float kz,
                           float dx,
                           float dy,
                           float dz)
Constructor

Parameters:
j - physical joint that is controlled
ax - desired x angle
ay - desired y angle
az - desired z angle
avx - desired x avelocity
avy - desired y avelocity
avz - desired z avelocity
kx - spring gain x
ky - spring gain y
kz - spring gain z
dx - damper gain x
dy - damper gain y
dz - damper gain z Note that x y and z are just the 1st, 2nd and 3rd axis as set up in the physical joint, not necessarily x y and z axis.

BallJointController

public BallJointController(PhysicalJoint j,
                           float ax,
                           float ay,
                           float az)
Constructor, sets up a PD-controller with 0 desired velocity Spring and damper gains are set up to dampen a shoulder joint that loosely hangs down

Parameters:
j - controlled physical joint
ax - desired x angle
ay - desired y angle
az - desired z angle

BallJointController

public BallJointController()
Method Detail

setSprings

public void setSprings(float kx,
                       float ky,
                       float kz)
Sets new spring values


reset

public void reset()
Description copied from interface: PhysicalController
Clears out all previous time dependen variables

Specified by:
reset in interface PhysicalController

update

public void update(double timeDiff)
Description copied from interface: PhysicalController
Updates the controller

Specified by:
update in interface PhysicalController
Parameters:
timeDiff - time since last update

getRequiredJointIDs

public String[] getRequiredJointIDs()
Description copied from interface: PhysicalController
Gets the ids of controlled joints

Specified by:
getRequiredJointIDs in interface PhysicalController

setPhysicalHumanoid

public void setPhysicalHumanoid(PhysicalHumanoid ph)
Description copied from interface: PhysicalController
Links the controller to a new set of physical joints

Specified by:
setPhysicalHumanoid in interface PhysicalController
Parameters:
ph - physical humanoid to link to

copy

public PhysicalController copy(PhysicalHumanoid ph)
Description copied from interface: PhysicalController
Creates a copy of the controller

Specified by:
copy in interface PhysicalController

getParameterValue

public String getParameterValue(String name)
Description copied from interface: PhysicalController
Get the parameter value of parameter name, return null if not found

Specified by:
getParameterValue in interface PhysicalController

setParameterValue

public void setParameterValue(String name,
                              String value)
Specified by:
setParameterValue in interface PhysicalController

setParameterValue

public void setParameterValue(String name,
                              float value)
Specified by:
setParameterValue in interface PhysicalController

getDesiredJointIDs

public String[] getDesiredJointIDs()
Description copied from interface: PhysicalController
Gets the ids of joints the controller would like to steer if available

Specified by:
getDesiredJointIDs in interface PhysicalController