public class MotionTargetTerm extends LeastSquaresTermBase
QPTerm.TypeModelComponent.FilePathSaveType, ModelComponent.NavpanelVisibilityCompositeComponent.NavpanelDisplay| Modifier and Type | Field and Description |
|---|---|
static double |
DEFAULT_CHASE_TIME |
static boolean |
DEFAULT_ESTIMATE_TARGET_VELOCITY |
static double |
DEFAULT_Kd |
static double |
DEFAULT_Kp |
static boolean |
DEFAULT_LEGACY_CONTROL |
static double |
DEFAULT_PD_DAMPING_RATIO |
static double |
DEFAULT_PD_TIME_CONSTANT |
static boolean |
DEFAULT_USE_PD_CONTROL |
static boolean |
keepVelocityJacobianConstant |
boolean |
myLegacyControl |
static PropertyList |
myProps |
DEFAULT_ENABLED, DEFAULT_WEIGHTenforceUniqueCompositeNames, enforceUniqueNames, myNumber, NULL_OBJ, useCompactPathNames| Constructor and Description |
|---|
MotionTargetTerm() |
MotionTargetTerm(TrackingController controller) |
| Modifier and Type | Method and Description |
|---|---|
TargetFrame |
addFrameTarget(Frame source)
Adds a frame target to track with weight 1
|
TargetFrame |
addFrameTarget(Frame source,
double weight)
Adds a frame target to track
|
TargetPoint |
addPointTarget(Point source)
Adds a point target to track with weight 1
|
TargetPoint |
addPointTarget(Point source,
double weight)
Adds a point target to track
|
MotionTargetComponent |
addTarget(MotionTargetComponent target)
Deprecated.
Use
addPointTarget(Point) or
addFrameTarget(Frame) instead. |
MotionTargetComponent |
addTarget(MotionTargetComponent source,
double weight)
Deprecated.
Use
addPointTarget(Point,double) or
addFrameTarget(Frame,double) instead. |
void |
clearTargets()
Removes targets
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
VectorNd |
getB() |
double |
getChaseTime()
Queries the chase time.
|
boolean |
getEstimateTargetVelocity()
Queries whether target velocity estimation is enabled.
|
MatrixNd |
getH() |
double |
getKd()
Returns the Derivative gain for PD controller.
|
double |
getKp()
Returns the Proportional gain for PD controller.
|
boolean |
getLegacyControl() |
double |
getPdDampingRatio()
Queries the PD control damping ratio, given by
Kd/(2 sqrt(Kp)). |
double |
getPdTimeConstant()
Queries the PD control time constant, given by
1/sqrt(Kp). |
double |
getPositionError() |
void |
getQP(MatrixNd Q,
VectorNd p,
double t0,
double t1)
Adds the contribution of this term to the quadratic cost
components Q and p.
|
Frame |
getSourceFrame(int idx) |
Point |
getSourcePoint(int idx) |
RenderProps |
getSourceRenderProps()
Render props for the sources
|
java.util.ArrayList<MotionTargetComponent> |
getSources()
Returns list of source points/frames that are part of the model
that will move to the targets
|
RenderableComponentList<TargetFrame> |
getTargetFrames() |
PointList<TargetPoint> |
getTargetPoints() |
RenderProps |
getTargetRenderProps()
Render props for targets
|
java.util.ArrayList<MotionTargetComponent> |
getTargets()
Returns list of target points/frames
|
VectorNd |
getTargetVel(double t0,
double t1) |
void |
getTargetWeights(VectorNd weights)
Gets weights for targets.
|
int |
getTerm(MatrixNd A,
VectorNd b,
int rowoff,
double t0,
double t1)
Fills
H and b with this motion term |
boolean |
getUsePDControl() |
double |
getVelocityError() |
void |
initSourceRenderProps() |
void |
initTargetRenderProps(TrackingController controller) |
int |
numConstraints(int qpsize)
Returns the number of constraints associated with this term.
|
void |
setChaseTime(double t)
Sets the chase time
T. |
void |
setEstimateTargetVelocity(boolean enable)
Enables estimation of the target velocities.
|
void |
setKd(double k)
Sets the derivative gain
Kd for PD control. |
void |
setKp(double k)
Sets the proportional gain
Kp for PD control. |
void |
setLegacyControl(boolean enable) |
void |
setPdDampingRatio(double zeta)
Sets the PD control damping ratio
zeta, by setting Kd =
2 zeta sqrt(Kp) while leaving Kp unchanged. |
void |
setPdTimeConstant(double T)
Sets the PD control gains
Kp and Kd from a time
constant T, keeping the current damping ratio zeta
(see setPdDampingRatio(double)), according to |
void |
setSourceRenderProps(RenderProps rend)
Sets render props for sources
|
void |
setTargetRenderProps(RenderProps rend)
Sets render props for the target points/frames
|
void |
setTargetsPointRadius(double rad) |
void |
setTargetWeights(VectorNd weights)
Sets weights for targets.
|
void |
setUsePDControl(boolean usePD) |
void |
setWeight(double w)
Weight used to scale the contribution of this term in the quadratic
optimization problem
|
void |
storeTargetVelocity(VectorNd vel) |
void |
updateHb(TrackingController controller,
double t0,
double t1) |
void |
updateSourceVelocity(VectorNd vel) |
void |
updateTarget(double t0,
double t1) |
void |
updateTargetVelocity(VectorNd vel) |
void |
updateVelocityError(VectorNd verror) |
componentChanged, findComponent, get, get, getByNumber, getChildren, getNavpanelDisplay, getNumberLimit, getType, hasChildren, hierarchyContainsReferences, indexOf, iterator, numComponents, postscan, scan, setDisplayMode, setType, updateNameMapgetController, getProperty, getWeight, isEnabled, isInternal, setEnabled, setInternalcheckFlag, checkName, checkNameUniqueness, clearFlag, clone, connectToHierarchy, copy, createTempFlag, disconnectFromHierarchy, getGrandParent, getHardReferences, getName, getNameRange, getNavpanelVisibility, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isScanning, isSelected, isWritable, makeValidName, makeValidName, notifyParentOfChange, printReferences, recursivelyContained, recursivelyContains, removeTempFlag, setFixed, setFlag, setMarked, setName, setNavpanelVisibility, setNavpanelVisibility, setNumber, setParent, setScanning, setSelected, setWritable, updateReferences, writeequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetController, getWeight, isEnabledconnectToHierarchy, disconnectFromHierarchy, getHardReferences, getName, getNavpanelVisibility, getNumber, getParent, getSoftReferences, hasState, isFixed, isMarked, isSelected, notifyParentOfChange, setFixed, setMarked, setName, setNumber, setParent, setSelected, setWritable, updateReferencesgetPropertyisWritable, writerecursivelyFindpublic static boolean keepVelocityJacobianConstant
public static final boolean DEFAULT_LEGACY_CONTROL
public boolean myLegacyControl
public static final boolean DEFAULT_USE_PD_CONTROL
public static double DEFAULT_CHASE_TIME
public static boolean DEFAULT_ESTIMATE_TARGET_VELOCITY
public static double DEFAULT_Kd
public static double DEFAULT_Kp
public static double DEFAULT_PD_TIME_CONSTANT
public static double DEFAULT_PD_DAMPING_RATIO
public static PropertyList myProps
public MotionTargetTerm()
public MotionTargetTerm(TrackingController controller)
public PropertyList getAllPropertyInfo()
QPTermBasegetAllPropertyInfo in interface HasPropertiesgetAllPropertyInfo in class QPTermBasepublic void setTargetsPointRadius(double rad)
public PointList<TargetPoint> getTargetPoints()
public RenderableComponentList<TargetFrame> getTargetFrames()
public void updateTarget(double t0,
double t1)
public double getPositionError()
public double getVelocityError()
public void updateVelocityError(VectorNd verror)
public void updateSourceVelocity(VectorNd vel)
public void updateTargetVelocity(VectorNd vel)
public void storeTargetVelocity(VectorNd vel)
public void initTargetRenderProps(TrackingController controller)
public void initSourceRenderProps()
public MotionTargetComponent addTarget(MotionTargetComponent source, double weight)
addPointTarget(Point,double) or
addFrameTarget(Frame,double) instead.public MotionTargetComponent addTarget(MotionTargetComponent target)
addPointTarget(Point) or
addFrameTarget(Frame) instead.public TargetPoint addPointTarget(Point source, double weight)
source - point in the model you wish to drive to a target positionweight - used in error trackingpublic TargetPoint addPointTarget(Point source)
source - point in the model you wish to drive to a target
positionpublic TargetFrame addFrameTarget(Frame source, double weight)
source - frame in the model you wish to drive to a target positionweight - used in error trackingpublic TargetFrame addFrameTarget(Frame source)
source - frame in the model you wish to drive to a target positionpublic void clearTargets()
public java.util.ArrayList<MotionTargetComponent> getTargets()
public java.util.ArrayList<MotionTargetComponent> getSources()
public Point getSourcePoint(int idx)
public Frame getSourceFrame(int idx)
public VectorNd getTargetVel(double t0, double t1)
public int getTerm(MatrixNd A, VectorNd b, int rowoff, double t0, double t1)
H and b with this motion termA - LHS matrix to fillb - RHS vector to fillrowoff - row offset to start filling termt0 - starting time of time stept1 - ending time of time steppublic void updateHb(TrackingController controller, double t0, double t1)
public MatrixNd getH()
public VectorNd getB()
public void setWeight(double w)
setWeight in interface QPTermsetWeight in class QPTermBasew - weight for the termpublic void setTargetWeights(VectorNd weights)
H (allows you to scale x,y,z components of
velocity separately).weights - weights vectorpublic void getTargetWeights(VectorNd weights)
weights - weights vectorpublic RenderProps getTargetRenderProps()
public void setTargetRenderProps(RenderProps rend)
public RenderProps getSourceRenderProps()
public void setSourceRenderProps(RenderProps rend)
public void setChaseTime(double t)
T. If not using PD control, this is the time
over which the controller tries to make the source catch up to the
target. A value <= 0 (the default) causes T to be set to
the simulation step size h, which places the source on the
target at the end of each step. Values less than h are
treated as h, since these would overshoot the target. Values
greater than h give smoother excitations, but cause the source
to lag the target by about (T-h) times the target velocity,
unless target velocities are either supplied or estimated (see setEstimateTargetVelocity(boolean)).t - new chase timepublic double getChaseTime()
setChaseTime(double) for details.public void setEstimateTargetVelocity(boolean enable)
setVelocity() method, which is also used when setting its velocity property from a probe) since the previous time step, the
target velocity is estimated from the target positions at the start and
end of the step, using a backward difference. Otherwise, the target
velocity is taken from the target's velocity state, which will be 0
unless explicitly set. Without either explicit setting or estimation,
the source will lag the target when using PD control or a chase time
greater than the step size. Velocity information has no effect for
chase control with a chase time equal to the step size. Target
positions should be smooth (e.g., using cubic interpolation for probe
data) to avoid noise in the estimate. Estimation is not used when legacy
control is enabled. Estimation is enabled by default.enable - if true, enables target velocity estimationpublic boolean getEstimateTargetVelocity()
setEstimateTargetVelocity(boolean).true if target velocity estimation is enabledpublic void setKp(double k)
Kp for PD control. For a source
that tracks the desired velocity exactly, the position error e
obeys e'' + Kd e' + Kp e = 0, so that sqrt(Kp) is the
natural frequency and Kd/(2 sqrt(Kp)) the damping ratio. For
critical damping with time constant T, use Kp = 1/T^2
and Kd = 2/T. Both h Kd and h sqrt(Kp), where
h is the step size, should be less than about 1.k - proportional gainpublic double getKp()
setKp(double).public void setKd(double k)
Kd for PD control. See setKp(double) for details.k - derivative gainpublic double getKd()
setKd(double).public void setPdTimeConstant(double T)
Kp and Kd from a time
constant T, keeping the current damping ratio zeta
(see setPdDampingRatio(double)), according to
Kp = 1/T^2, Kd = 2 zeta/T.
1/T is the natural frequency of the error dynamics. For
critical damping (zeta = 1), the position error after a step
decays as (1 + t/T) exp(-t/T), reaching 10% of its initial
value after about 3.9 T. T should be at least the step
size h. If the current damping ratio is undefined (because
Kp = 0), a damping ratio of 1 is used.T - PD control time constant (must be positive)public double getPdTimeConstant()
1/sqrt(Kp).
See setPdTimeConstant(double). Returns infinity if Kp = 0.public void setPdDampingRatio(double zeta)
zeta, by setting Kd =
2 zeta sqrt(Kp) while leaving Kp unchanged. A value of 1 gives
critical damping. See setPdTimeConstant(double).zeta - PD control damping ratio (must be non-negative)public double getPdDampingRatio()
Kd/(2 sqrt(Kp)). See setPdDampingRatio(double). Returns infinity if
Kp = 0 and Kd > 0.public void getQP(MatrixNd Q, VectorNd p, double t0, double t1)
QPCostTermQ - quadratic termp - proportional termt0 - time at start of stept1 - time at end of steppublic int numConstraints(int qpsize)
QPConstraintTermqpsize - size of the quadratic program. For the tracking
controller, this is the number of excitation values being used,public void setUsePDControl(boolean usePD)
public boolean getUsePDControl()
public void setLegacyControl(boolean enable)
public boolean getLegacyControl()