wbc
wbc::PosPDController Class Reference

The PosPDController class implements the following two control scemes. More...

#include <PosPDController.hpp>

Inheritance diagram for wbc::PosPDController:
wbc::CartesianPosPDController wbc::JointPosPDController

Public Member Functions

 PosPDController (size_t dim_controller)
 
void update ()
 
void setPGain (const base::VectorXd &gain)
 
const base::VectorXd & pGain ()
 
void setDGain (const base::VectorXd &gain)
 
const base::VectorXd & dGain ()
 
void setFFGain (const base::VectorXd &gain)
 
const base::VectorXd & ffGain ()
 
void setMaxCtrlOutput (const base::VectorXd &max_ctrl_out)
 
const base::VectorXd & maxCtrlOutput ()
 
void setDeadZone (const base::VectorXd &dz)
 
const base::VectorXd & deadZone ()
 
base::VectorXd getControlError ()
 
void applySaturation (const base::VectorXd &in, const base::VectorXd &max, base::VectorXd &out)
 Apply Saturation on the control output. If one or more values of <in> are bigger than the Corrresponding entry of <max>, all values will be scaled down according to the biggest ratio eta = in_i / max,i.
 
void applyDeadZone (const base::VectorXd &in, const base::VectorXd &min, base::VectorXd &out)
 Apply dead zone, i.e. minimum position control error. If one of the input value falls below minimum, it will be set to zero. Otherwise dead zone will be subtracted from the input value, to get a smooth transition:
 

Protected Attributes

size_t dim_controller
 
base::VectorXd p_gain
 
base::VectorXd d_gain
 
base::VectorXd ff_gain
 
base::VectorXd dead_zone
 
base::VectorXd max_control_output
 
base::VectorXd ref_pos
 
base::VectorXd ref_vel
 
base::VectorXd ref_acc
 
base::VectorXd pos
 
base::VectorXd vel
 
base::VectorXd acc
 
base::VectorXd pos_diff
 
base::VectorXd vel_diff
 
base::VectorXd control_out_vel
 
base::VectorXd control_out_acc
 

Detailed Description

The PosPDController class implements the following two control scemes.

 u_vel = k_d*v_ref + k_p(x_ref-x)
 u_acc = a_ref + k_d*(v_ref-v) + k_p(x_ref-x)

where x = position v = velocity a = acceleration k_p = position gain k_d = velocity gain u = Control output

The control output contains u1 as velocities and u2 as acceleration.

Constructor & Destructor Documentation

◆ PosPDController()

wbc::PosPDController::PosPDController ( size_t dim_controller)

Member Function Documentation

◆ applyDeadZone()

void wbc::PosPDController::applyDeadZone ( const base::VectorXd & in,
const base::VectorXd & min,
base::VectorXd & out )

Apply dead zone, i.e. minimum position control error. If one of the input value falls below minimum, it will be set to zero. Otherwise dead zone will be subtracted from the input value, to get a smooth transition:

out_i = in_i - min_i if in_i >= min_i = in_i + min_i if in_i <= -min_i = 0 else

Parameters
inInput Vector. Size has to be same as min.
minMinimum input vector. Size has to be same as in.
outOutput vector. Will be resized if out.size() != in.size()

◆ applySaturation()

void wbc::PosPDController::applySaturation ( const base::VectorXd & in,
const base::VectorXd & max,
base::VectorXd & out )

Apply Saturation on the control output. If one or more values of <in> are bigger than the Corrresponding entry of <max>, all values will be scaled down according to the biggest ratio eta = in_i / max,i.

Parameters
inInput vector. Size has to be same as max.
maxMaximum allowed value for input vector. Size has to be same as in.
outOutput vector. Will be resized if out.size() != in.size()

◆ deadZone()

const base::VectorXd & wbc::PosPDController::deadZone ( )
inline

Get dead zone for the position controller

◆ dGain()

const base::VectorXd & wbc::PosPDController::dGain ( )
inline

Get derivative/velocity gain

◆ ffGain()

const base::VectorXd & wbc::PosPDController::ffGain ( )
inline

Get feedforward gain

◆ getControlError()

base::VectorXd wbc::PosPDController::getControlError ( )
inline

Return position control error

◆ maxCtrlOutput()

const base::VectorXd & wbc::PosPDController::maxCtrlOutput ( )
inline

Get controller saturation

◆ pGain()

const base::VectorXd & wbc::PosPDController::pGain ( )
inline

Get proportional/position gain

◆ setDeadZone()

void wbc::PosPDController::setDeadZone ( const base::VectorXd & dz)

Set dead zone for the position controller. Size has to be the same dimension of the controller

◆ setDGain()

void wbc::PosPDController::setDGain ( const base::VectorXd & gain)

Set derivative/velocity gain. Size has to be the same dimension of the controller

◆ setFFGain()

void wbc::PosPDController::setFFGain ( const base::VectorXd & gain)

Set feedforward gain. Size has to be the same dimension of the controller

◆ setMaxCtrlOutput()

void wbc::PosPDController::setMaxCtrlOutput ( const base::VectorXd & max_ctrl_out)

Set controller saturation. Size has to be the same dimension of the controller

◆ setPGain()

void wbc::PosPDController::setPGain ( const base::VectorXd & gain)

Set proportional/position gain. Size has to be the same dimension of the controller

◆ update()

void wbc::PosPDController::update ( )

Compute control output and store it in control_out_vel and control_out_acc. Throws if any of the ref or actual position entries is NaN. Ignores NaN ref or actual velocity (disables velocity control) and NaN ref acceleration (disables acceleration feed forward)

Member Data Documentation

◆ acc

base::VectorXd wbc::PosPDController::acc
protected

◆ control_out_acc

base::VectorXd wbc::PosPDController::control_out_acc
protected

◆ control_out_vel

base::VectorXd wbc::PosPDController::control_out_vel
protected

◆ d_gain

base::VectorXd wbc::PosPDController::d_gain
protected

◆ dead_zone

base::VectorXd wbc::PosPDController::dead_zone
protected

◆ dim_controller

size_t wbc::PosPDController::dim_controller
protected

◆ ff_gain

base::VectorXd wbc::PosPDController::ff_gain
protected

◆ max_control_output

base::VectorXd wbc::PosPDController::max_control_output
protected

◆ p_gain

base::VectorXd wbc::PosPDController::p_gain
protected

◆ pos

base::VectorXd wbc::PosPDController::pos
protected

◆ pos_diff

base::VectorXd wbc::PosPDController::pos_diff
protected

◆ ref_acc

base::VectorXd wbc::PosPDController::ref_acc
protected

◆ ref_pos

base::VectorXd wbc::PosPDController::ref_pos
protected

◆ ref_vel

base::VectorXd wbc::PosPDController::ref_vel
protected

◆ vel

base::VectorXd wbc::PosPDController::vel
protected

◆ vel_diff

base::VectorXd wbc::PosPDController::vel_diff
protected

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