Resurgence (PY2022)
Codebase for the Husky Robotics 2021-2022 rover Resurgence
Loading...
Searching...
No Matches
control::JacobianPosController< outputDim, inputDim > Class Template Reference

This class controls the position of a multidimensional mechanism with a trapezoidal velocity profile using the jacobian of the kinematics. More...

#include <JacobianPosController.h>

Public Member Functions

 JacobianPosController (const std::function< navtypes::Vectord< outputDim >(const navtypes::Vectord< inputDim > &)> &kinematicsFunc, const std::function< navtypes::Matrixd< outputDim, inputDim >(const navtypes::Vectord< inputDim > &)> &jacobianFunc, double maxVel, double maxAccel)
 Construct a new controller.
 
navtypes::Vectord< inputDim > getCommand (robot::types::datatime_t currTime, const navtypes::Vectord< inputDim > &currPos) const
 Get the current command position in the input space.
 
navtypes::Vectord< inputDim > getCommand (robot::types::datatime_t currTime, const navtypes::Vectord< inputDim > &currPos, double &cosineSim) const
 Get the current command position in the input space.
 
void setTarget (robot::types::datatime_t currTime, const navtypes::Vectord< inputDim > &currPos, const navtypes::Vectord< outputDim > &target)
 Set the target position of the controller.
 
bool hasTarget () const
 Check if a target has been set.
 
void reset ()
 Reset the controller, unsetting the target.
 

Detailed Description

template<int outputDim, int inputDim>
class control::JacobianPosController< outputDim, inputDim >

This class controls the position of a multidimensional mechanism with a trapezoidal velocity profile using the jacobian of the kinematics.

Note that the jacobian matrix is of dimension outputDim x inputDim

Template Parameters
outputDimThe dimension of the output vector of the kinematic function.
inputDimThe dimension of the input vector of the kinematic function.
See also
https://en.wikipedia.org/wiki/Jacobian_matrix_and_determinant

Constructor & Destructor Documentation

◆ JacobianPosController()

template<int outputDim, int inputDim>
control::JacobianPosController< outputDim, inputDim >::JacobianPosController ( const std::function< navtypes::Vectord< outputDim >(const navtypes::Vectord< inputDim > &)> & kinematicsFunc,
const std::function< navtypes::Matrixd< outputDim, inputDim >(const navtypes::Vectord< inputDim > &)> & jacobianFunc,
double maxVel,
double maxAccel )
inline

Construct a new controller.

Parameters
kinematicsFuncThe kinematics of the mechanism being controlled. This is a function that takes in some input vector (ex: joint angles of an arm) and outputs another vector (ex: the 3d pose of the hand)
jacobianFuncThe jacobian of the kinematic function.
maxVelsThe maximum velocity in the output space of the kinematic function.
maxAccelsThe maximum acceleration in the output space of the kinematic function.

Member Function Documentation

◆ getCommand() [1/2]

template<int outputDim, int inputDim>
navtypes::Vectord< inputDim > control::JacobianPosController< outputDim, inputDim >::getCommand ( robot::types::datatime_t currTime,
const navtypes::Vectord< inputDim > & currPos ) const
inline

Get the current command position in the input space.

Parameters
currTimeThe current timestamp.
currPosThe current position, in the input space.
Returns
navtypes::Vectord<inputDim> The target position, in the input space of the kinematic function. Returns the current position if no target is set.

◆ getCommand() [2/2]

template<int outputDim, int inputDim>
navtypes::Vectord< inputDim > control::JacobianPosController< outputDim, inputDim >::getCommand ( robot::types::datatime_t currTime,
const navtypes::Vectord< inputDim > & currPos,
double & cosineSim ) const
inline

Get the current command position in the input space.

Parameters
currTimeThe current timestamp.
currPosThe current position, in the input space.
[out]cosineSimOutput parameter, gives the cosine similarity of the delta to the returned target and the delta to the commanded target. This similarity may be low if the kinematics of the mechanism do not allow it to move in the commanded direction. May be NaN if stuck in singularity point, in which case the command is the current position.
Returns
navtypes::Vectord<inputDim> The target position, in the input space of the kinematic function. Returns the current position if no target is set.

◆ hasTarget()

template<int outputDim, int inputDim>
bool control::JacobianPosController< outputDim, inputDim >::hasTarget ( ) const
inline

Check if a target has been set.

Returns
bool True iff a target has been set.

◆ setTarget()

template<int outputDim, int inputDim>
void control::JacobianPosController< outputDim, inputDim >::setTarget ( robot::types::datatime_t currTime,
const navtypes::Vectord< inputDim > & currPos,
const navtypes::Vectord< outputDim > & target )
inline

Set the target position of the controller.

Parameters
currTimeThe current timestamp.
currPosThe current position in the input space.
targetThe target position in the output space.

The documentation for this class was generated from the following file: