public class MotionTargetTerm extends LeastSquaresTermBase
Modifier and Type | Field and Description |
---|---|
static boolean |
DEFAULT_DELTA_ACTIVATIONS |
static double |
DEFAULT_Kd |
static double |
DEFAULT_Kp |
static boolean |
DEFAULT_NORMALIZE_H |
static boolean |
DEFAULT_USE_KKT_FACTORANDSOLVE |
static boolean |
DEFAULT_USE_PD_CONTROL |
static boolean |
DEFAULT_USE_TIMESTEP_SCALING |
static boolean |
DEFAULT_USE_TRAPEZOIDAL_SOLVER |
static double |
DEFAULT_WEIGHT |
static PropertyList |
myProps |
VectorNd |
postionError |
VectorNd |
velocityError |
DEFAULT_ENABLED, defaultWeight
Constructor and Description |
---|
MotionTargetTerm(TrackingController controller) |
MotionTargetTerm(TrackingController controller,
double weight) |
Modifier and Type | Method and Description |
---|---|
MotionTargetComponent |
addTarget(MotionTargetComponent target)
Adds a target to track
|
MotionTargetComponent |
addTarget(MotionTargetComponent source,
double weight)
Adds a target to track
|
void |
clearTargets()
Removes targets
|
PropertyList |
getAllPropertyInfo()
Returns a list giving static information about all properties exported by
this object.
|
VectorNd |
getCurrentVel() |
double |
getDerr() |
double |
getKd()
Returns the Derivative gain for PD controller.
|
double |
getKp()
Returns the Proportional gain for PD controller.
|
boolean |
getNormalizeH()
Returns whether or not we're normalizing this term's contribution to
H and b . |
double |
getPerr() |
int |
getRowSize()
Returns the number of rows.
|
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
|
RenderProps |
getTargetRenderProps()
Render props for targets
|
java.util.ArrayList<MotionTargetComponent> |
getTargets()
Returns list of target points/frames
|
int |
getTargetVelSize() |
VectorNd |
getTargetWeights()
Returns target weights, one per target point.
|
void |
getTargetWeights(VectorNd out)
Gets weights for targets.
|
int |
getTerm(MatrixNd H,
VectorNd b,
int rowoff,
double t0,
double t1)
Fills
H and b with this motion term |
boolean |
getUseKKTFactorAndSolve() |
boolean |
getUsePDControl() |
boolean |
getUseTimestepScaling() |
SparseBlockMatrix |
getVelocityJacobian()
Returns the velocity Jacobian, creates if null
XXX This Jacobian needs to be re-computed at each time step
OR it needs to be transformed to global co-ordinates so that the
tracking controller can use it properly, since it does not change
as the model moves
|
void |
initSourceRenderProps() |
void |
initTargetRenderProps() |
boolean |
isEnabled()
Returns that enabled status of this term, for use if term is
an inequality / equality constraint
|
void |
reGetTerm(MatrixNd H,
VectorNd b)
Fills
H and b with this motion term
In contrast to getTerm , this method does not
recompute the values. |
void |
setEnabled(boolean enabled) |
void |
setKd(double k)
Derivative gain for PD controller
|
void |
setKp(double k)
Proportional gain for PD controller
|
void |
setNormalizeH(boolean enable)
Sets whether or not to normalize the contribution to
H
and b by the Frobenius norm of this term's H block. |
void |
setSourceRenderProps(RenderProps rend)
Sets render props for sources
|
void |
setTargetRenderProps(RenderProps rend)
Sets render props for the target points/frames
|
void |
setTargetWeights(VectorNd wgts)
Sets weights for targets.
|
void |
setUseKKTFactorAndSolve(boolean useKKTFactorAndSolve) |
void |
setUsePDControl(boolean usePD) |
void |
setUseTimestepScaling(boolean useTimestepScaling) |
void |
setWeight(double w)
Weight used to scale the contribution of this term in the quadratic optimization problem
|
void |
updatePositionError() |
void |
updateTarget(double t0,
double t1) |
void |
updateVelocityError() |
addRows, getQP, setSize
dispose, getProperty, getSize, getWeight
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getProperty
public static final double DEFAULT_WEIGHT
public static final boolean DEFAULT_USE_PD_CONTROL
public static final boolean DEFAULT_DELTA_ACTIVATIONS
public static boolean DEFAULT_USE_TIMESTEP_SCALING
public static boolean DEFAULT_USE_KKT_FACTORANDSOLVE
public static boolean DEFAULT_USE_TRAPEZOIDAL_SOLVER
public static boolean DEFAULT_NORMALIZE_H
public static double DEFAULT_Kd
public static double DEFAULT_Kp
public static PropertyList myProps
public VectorNd postionError
public VectorNd velocityError
public MotionTargetTerm(TrackingController controller)
public MotionTargetTerm(TrackingController controller, double weight)
public PropertyList getAllPropertyInfo()
HasProperties
getAllPropertyInfo
in interface HasProperties
getAllPropertyInfo
in class LeastSquaresTermBase
public void updateTarget(double t0, double t1)
public void updatePositionError()
public void updateVelocityError()
public boolean isEnabled()
LeastSquaresTerm
isEnabled
in interface LeastSquaresTerm
isEnabled
in class LeastSquaresTermBase
public void setEnabled(boolean enabled)
setEnabled
in class LeastSquaresTermBase
public VectorNd getCurrentVel()
public void initTargetRenderProps()
public void initSourceRenderProps()
public MotionTargetComponent addTarget(MotionTargetComponent source, double weight)
source
- point or frame on the model you wish to drive to
a target positionweight
- used in error trackingpublic MotionTargetComponent addTarget(MotionTargetComponent target)
target
- point or frame on 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 int getTargetVelSize()
public SparseBlockMatrix getVelocityJacobian()
public int getTerm(MatrixNd H, VectorNd b, int rowoff, double t0, double t1)
H
and b
with this motion termgetTerm
in interface LeastSquaresTerm
getTerm
in class LeastSquaresTermBase
H
- 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 reGetTerm(MatrixNd H, VectorNd b)
H
and b
with this motion term
In contrast to getTerm
, this method does not
recompute the values.public void setWeight(double w)
setWeight
in interface QPTerm
setWeight
in class QPTermBase
public void setTargetWeights(VectorNd wgts)
H
(allows you to scale x,y,z
components of velocity separately).wgts
- weights vectorpublic void getTargetWeights(VectorNd out)
out
- weights vectorpublic RenderProps getTargetRenderProps()
public VectorNd getTargetWeights()
public void setTargetRenderProps(RenderProps rend)
public RenderProps getSourceRenderProps()
public void setSourceRenderProps(RenderProps rend)
public void setKd(double k)
public double getKd()
setKd(double)
.public void setKp(double k)
public double getKp()
setKp(double)
.public double getPerr()
public double getDerr()
public void setNormalizeH(boolean enable)
H
and b
by the Frobenius norm of this term's H
block.
This is for scaling purposes when damping is important. If set to false,
then the damping term's scale will depend on the time and spatial scales.
However, if set to true, we will likely scale this term differently every
time step.enable
- if true
, enables normalizationpublic boolean getNormalizeH()
H
and b
. See setNormalizeH(boolean)
H
and b
public int getRowSize()
LeastSquaresTerm
public boolean getUseKKTFactorAndSolve()
public void setUseKKTFactorAndSolve(boolean useKKTFactorAndSolve)
public boolean getUseTimestepScaling()
public void setUseTimestepScaling(boolean useTimestepScaling)
public void setUsePDControl(boolean usePD)
public boolean getUsePDControl()