wbc
wbc::Scene Class Referenceabstract

Base class for all wbc scenes. More...

#include <Scene.hpp>

Inheritance diagram for wbc::Scene:
wbc::AccelerationScene wbc::AccelerationSceneReducedTSID wbc::AccelerationSceneTSID wbc::VelocityScene wbc::VelocitySceneQP

Public Member Functions

 Scene (RobotModelPtr robot_model, QPSolverPtr solver, const double dt)
 
 ~Scene ()
 
virtual bool configure (const std::vector< TaskConfig > &config)
 Configure the WBC scene. Create tasks and sort them by priority.
 
virtual const HierarchicalQPupdate ()=0
 Update the wbc scene and return the (updated) optimization problem.
 
virtual const base::commands::Joints & solve (const HierarchicalQP &hqp)=0
 Solve the given optimization problem.
 
void setReference (const std::string &task_name, const base::samples::Joints &ref)
 Set reference input for a joint space task.
 
void setReference (const std::string &task_name, const base::samples::RigidBodyStateSE3 &ref)
 Set reference input for a cartesian space task.
 
void setTaskWeights (const std::string &task_name, const base::VectorXd &weights)
 Set Task weights input for a task.
 
void setTaskActivation (const std::string &task_name, double activation)
 Set Task activation for a task.
 
TaskPtr getTask (const std::string &name)
 Return a Particular task. Throw if the task does not exist.
 
bool hasTask (const std::string &name)
 True in case the given task exists.
 
const TasksStatusgetTasksStatus () const
 Returns all tasks as vector.
 
virtual const TasksStatusupdateTasksStatus ()=0
 updateTasksStatus Evaluate the fulfillment of the tasks given the current robot state and the solver output
 
void getHierarchicalQP (HierarchicalQP &_hqp)
 Return tasks sorted by priority for the solver.
 
const base::commands::Joints & getSolverOutput () const
 Get current solver output.
 
const base::VectorXd & getSolverOutputRaw () const
 Get current solver output in raw values.
 
void setJointWeights (const JointWeights &weights)
 set Joint weights by given name
 
const JointWeightsgetJointWeights () const
 Get Joint weights as Named vector.
 
const JointWeightsgetActuatedJointWeights () const
 Get Joint weights as Named vector.
 
RobotModelPtr getRobotModel ()
 Return the current robot model.
 
QPSolverPtr getSolver ()
 Return the current solver.
 
std::vector< TaskConfiggetWbcConfig ()
 Return task configuration.
 

Static Public Member Functions

static void sortTaskConfig (const std::vector< TaskConfig > &config, std::vector< std::vector< TaskConfig > > &sorted_config)
 Sort task config by the priorities of the tasks.
 
static uint getNTaskVariables (const std::vector< TaskConfig > &config)
 Return number of tasks per priority, given the task config.
 
static std::vector< int > getNTaskVariablesPerPrio (const std::vector< TaskConfig > &config)
 Return number of tasks per priority, given the task config.
 

Protected Member Functions

virtual TaskPtr createTask (const TaskConfig &config)=0
 
void clearTasks ()
 Delete all tasks and free memory.
 

Protected Attributes

RobotModelPtr robot_model
 
QPSolverPtr solver
 
std::vector< std::vector< TaskPtr > > tasks
 
std::vector< std::vector< ConstraintPtr > > constraints
 
TasksStatus tasks_status
 
HierarchicalQP hqp
 
std::vector< int > n_task_variables_per_prio
 
bool configured
 
base::commands::Joints solver_output_joints
 
JointWeights joint_weights
 
JointWeights actuated_joint_weights
 
std::vector< TaskConfigwbc_config
 
base::VectorXd solver_output
 

Detailed Description

Base class for all wbc scenes.

Constructor & Destructor Documentation

◆ Scene()

wbc::Scene::Scene ( RobotModelPtr robot_model,
QPSolverPtr solver,
const double dt )

◆ ~Scene()

wbc::Scene::~Scene ( )

Member Function Documentation

◆ clearTasks()

void wbc::Scene::clearTasks ( )
protected

Delete all tasks and free memory.

◆ configure()

bool wbc::Scene::configure ( const std::vector< TaskConfig > & config)
virtual

Configure the WBC scene. Create tasks and sort them by priority.

Parameters
configconfiguration. Size has to be > 0. All tasks have to be valid. See TaskConfig.hpp for more details.

Create tasks. Store the number of task variables per priority

◆ createTask()

virtual TaskPtr wbc::Scene::createTask ( const TaskConfig & config)
protectedpure virtual

brief Create a task and add it to the WBC scene

Implemented in wbc::AccelerationScene, wbc::AccelerationSceneReducedTSID, wbc::AccelerationSceneTSID, and wbc::VelocityScene.

◆ getActuatedJointWeights()

const JointWeights & wbc::Scene::getActuatedJointWeights ( ) const
inline

Get Joint weights as Named vector.

◆ getHierarchicalQP()

void wbc::Scene::getHierarchicalQP ( HierarchicalQP & _hqp)
inline

Return tasks sorted by priority for the solver.

◆ getJointWeights()

const JointWeights & wbc::Scene::getJointWeights ( ) const
inline

Get Joint weights as Named vector.

◆ getNTaskVariables()

uint wbc::Scene::getNTaskVariables ( const std::vector< TaskConfig > & config)
static

Return number of tasks per priority, given the task config.

◆ getNTaskVariablesPerPrio()

std::vector< int > wbc::Scene::getNTaskVariablesPerPrio ( const std::vector< TaskConfig > & config)
static

Return number of tasks per priority, given the task config.

◆ getRobotModel()

RobotModelPtr wbc::Scene::getRobotModel ( )
inline

Return the current robot model.

◆ getSolver()

QPSolverPtr wbc::Scene::getSolver ( )
inline

Return the current solver.

◆ getSolverOutput()

const base::commands::Joints & wbc::Scene::getSolverOutput ( ) const
inline

Get current solver output.

◆ getSolverOutputRaw()

const base::VectorXd & wbc::Scene::getSolverOutputRaw ( ) const
inline

Get current solver output in raw values.

◆ getTask()

TaskPtr wbc::Scene::getTask ( const std::string & name)

Return a Particular task. Throw if the task does not exist.

◆ getTasksStatus()

const TasksStatus & wbc::Scene::getTasksStatus ( ) const
inline

Returns all tasks as vector.

◆ getWbcConfig()

std::vector< TaskConfig > wbc::Scene::getWbcConfig ( )
inline

Return task configuration.

◆ hasTask()

bool wbc::Scene::hasTask ( const std::string & name)

True in case the given task exists.

◆ setJointWeights()

void wbc::Scene::setJointWeights ( const JointWeights & weights)

set Joint weights by given name

◆ setReference() [1/2]

void wbc::Scene::setReference ( const std::string & task_name,
const base::samples::Joints & ref )

Set reference input for a joint space task.

Parameters
task_nameName of the task
task_nameJoint space reference values

◆ setReference() [2/2]

void wbc::Scene::setReference ( const std::string & task_name,
const base::samples::RigidBodyStateSE3 & ref )

Set reference input for a cartesian space task.

Parameters
task_nameName of the task
task_nameCartesian space reference values

◆ setTaskActivation()

void wbc::Scene::setTaskActivation ( const std::string & task_name,
double activation )

Set Task activation for a task.

Parameters
task_nameName of the task
activationActivation value. Has to be in interval [0.0Scene,1.0]

◆ setTaskWeights()

void wbc::Scene::setTaskWeights ( const std::string & task_name,
const base::VectorXd & weights )

Set Task weights input for a task.

Parameters
task_nameName of the task
weightsWeight vector. Size has to be same as number of task variables

◆ solve()

virtual const base::commands::Joints & wbc::Scene::solve ( const HierarchicalQP & hqp)
pure virtual

Solve the given optimization problem.

Returns
Solver output as joint command

Implemented in wbc::AccelerationScene, wbc::AccelerationSceneReducedTSID, wbc::AccelerationSceneTSID, and wbc::VelocityScene.

◆ sortTaskConfig()

void wbc::Scene::sortTaskConfig ( const std::vector< TaskConfig > & config,
std::vector< std::vector< TaskConfig > > & sorted_config )
static

Sort task config by the priorities of the tasks.

◆ update()

virtual const HierarchicalQP & wbc::Scene::update ( )
pure virtual

Update the wbc scene and return the (updated) optimization problem.

Returns
Hierarchical quadratic program (solver input)

Implemented in wbc::AccelerationScene, wbc::AccelerationSceneReducedTSID, wbc::AccelerationSceneTSID, wbc::VelocityScene, and wbc::VelocitySceneQP.

◆ updateTasksStatus()

virtual const TasksStatus & wbc::Scene::updateTasksStatus ( )
pure virtual

updateTasksStatus Evaluate the fulfillment of the tasks given the current robot state and the solver output

Implemented in wbc::AccelerationScene, wbc::AccelerationSceneReducedTSID, wbc::AccelerationSceneTSID, and wbc::VelocityScene.

Member Data Documentation

◆ actuated_joint_weights

JointWeights wbc::Scene::actuated_joint_weights
protected

◆ configured

bool wbc::Scene::configured
protected

◆ constraints

std::vector< std::vector<ConstraintPtr> > wbc::Scene::constraints
protected

◆ hqp

HierarchicalQP wbc::Scene::hqp
protected

◆ joint_weights

JointWeights wbc::Scene::joint_weights
protected

◆ n_task_variables_per_prio

std::vector<int> wbc::Scene::n_task_variables_per_prio
protected

◆ robot_model

RobotModelPtr wbc::Scene::robot_model
protected

◆ solver

QPSolverPtr wbc::Scene::solver
protected

◆ solver_output

base::VectorXd wbc::Scene::solver_output
protected

◆ solver_output_joints

base::commands::Joints wbc::Scene::solver_output_joints
protected

◆ tasks

std::vector< std::vector<TaskPtr> > wbc::Scene::tasks
protected

◆ tasks_status

TasksStatus wbc::Scene::tasks_status
protected

◆ wbc_config

std::vector<TaskConfig> wbc::Scene::wbc_config
protected

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