20 std::vector< std::vector<TaskPtr> >
tasks;
49 virtual bool configure(
const std::vector<TaskConfig> &config);
68 void setReference(
const std::string& task_name,
const base::samples::Joints& ref);
75 void setReference(
const std::string& task_name,
const base::samples::RigidBodyStateSE3& ref);
82 void setTaskWeights(
const std::string& task_name,
const base::VectorXd &weights);
97 bool hasTask(
const std::string& name);
107 static void sortTaskConfig(
const std::vector<TaskConfig>& config, std::vector< std::vector<TaskConfig> >& sorted_config);
181 throw std::runtime_error(
"Failed to create instance of plugin " + name +
". Is the plugin registered?");
182 return it->second(robot_model, solver, dt);
188 T* ret =
dynamic_cast<T*
>(tmp);
211 throw std::runtime_error(
"Failed to register plugin with name " + name +
". A plugin with the same name is already registered");
Definition QuadraticProgram.hpp:10
Base class for all wbc scenes.
Definition Scene.hpp:16
void setReference(const std::string &task_name, const base::samples::Joints &ref)
Set reference input for a joint space task.
Definition Scene.cpp:104
virtual const HierarchicalQP & update()=0
Update the wbc scene and return the (updated) optimization problem.
static uint getNTaskVariables(const std::vector< TaskConfig > &config)
Return number of tasks per priority, given the task config.
Definition Scene.cpp:171
HierarchicalQP hqp
Definition Scene.hpp:23
bool hasTask(const std::string &name)
True in case the given task exists.
Definition Scene.cpp:137
virtual bool configure(const std::vector< TaskConfig > &config)
Configure the WBC scene. Create tasks and sort them by priority.
Definition Scene.cpp:29
std::vector< std::vector< ConstraintPtr > > constraints
Definition Scene.hpp:21
std::vector< std::vector< TaskPtr > > tasks
Definition Scene.hpp:20
RobotModelPtr robot_model
Definition Scene.hpp:18
virtual const base::commands::Joints & solve(const HierarchicalQP &hqp)=0
Solve the given optimization problem.
void clearTasks()
Delete all tasks and free memory.
Definition Scene.cpp:17
const base::VectorXd & getSolverOutputRaw() const
Get current solver output in raw values.
Definition Scene.hpp:137
static void sortTaskConfig(const std::vector< TaskConfig > &config, std::vector< std::vector< TaskConfig > > &sorted_config)
Sort task config by the priorities of the tasks.
Definition Scene.cpp:147
const base::commands::Joints & getSolverOutput() const
Get current solver output.
Definition Scene.hpp:132
TasksStatus tasks_status
Definition Scene.hpp:22
std::vector< TaskConfig > wbc_config
Definition Scene.hpp:28
std::vector< int > n_task_variables_per_prio
Definition Scene.hpp:24
std::vector< TaskConfig > getWbcConfig()
Return task configuration.
Definition Scene.hpp:167
bool configured
Definition Scene.hpp:25
base::VectorXd solver_output
Definition Scene.hpp:29
virtual const TasksStatus & updateTasksStatus()=0
updateTasksStatus Evaluate the fulfillment of the tasks given the current robot state and the solver ...
void getHierarchicalQP(HierarchicalQP &_hqp)
Return tasks sorted by priority for the solver.
Definition Scene.hpp:127
const TasksStatus & getTasksStatus() const
Returns all tasks as vector.
Definition Scene.hpp:102
Scene(RobotModelPtr robot_model, QPSolverPtr solver, const double dt)
Definition Scene.cpp:8
QPSolverPtr getSolver()
Return the current solver.
Definition Scene.hpp:162
void setJointWeights(const JointWeights &weights)
set Joint weights by given name
Definition Scene.cpp:192
TaskPtr getTask(const std::string &name)
Return a Particular task. Throw if the task does not exist.
Definition Scene.cpp:126
virtual TaskPtr createTask(const TaskConfig &config)=0
JointWeights joint_weights
Definition Scene.hpp:27
void setTaskActivation(const std::string &task_name, double activation)
Set Task activation for a task.
Definition Scene.cpp:122
const JointWeights & getActuatedJointWeights() const
Get Joint weights as Named vector.
Definition Scene.hpp:152
~Scene()
Definition Scene.cpp:14
static std::vector< int > getNTaskVariablesPerPrio(const std::vector< TaskConfig > &config)
Return number of tasks per priority, given the task config.
Definition Scene.cpp:178
RobotModelPtr getRobotModel()
Return the current robot model.
Definition Scene.hpp:157
JointWeights actuated_joint_weights
Definition Scene.hpp:27
void setTaskWeights(const std::string &task_name, const base::VectorXd &weights)
Set Task weights input for a task.
Definition Scene.cpp:118
const JointWeights & getJointWeights() const
Get Joint weights as Named vector.
Definition Scene.hpp:147
QPSolverPtr solver
Definition Scene.hpp:19
base::commands::Joints solver_output_joints
Definition Scene.hpp:26
Defines a task in the whole body control problem. Valid Configurations are e.g.
Definition TaskConfig.hpp:39
Definition TaskStatus.hpp:40
Definition ContactsAccelerationConstraint.cpp:3
std::shared_ptr< Task > TaskPtr
Definition Task.hpp:93
QPSolver * createT()
Definition QPSolver.hpp:33
std::shared_ptr< Scene > ScenePtr
Definition Scene.hpp:171
std::shared_ptr< QPSolver > QPSolverPtr
Definition QPSolver.hpp:31
std::shared_ptr< RobotModel > RobotModelPtr
Definition RobotModel.hpp:204
Describes a hierarchy of quadratic programs.
Definition QuadraticProgram.hpp:57
static SceneMap * getSceneMap()
Definition Scene.hpp:192
static T * createInstance(const std::string &name, RobotModelPtr robot_model, QPSolverPtr solver, const double dt)
Definition Scene.hpp:186
static Scene * createInstance(const std::string &name, RobotModelPtr robot_model, QPSolverPtr solver, const double dt)
Definition Scene.hpp:178
std::map< std::string, Scene *(*)(RobotModelPtr, QPSolverPtr, double)> SceneMap
Definition Scene.hpp:176
static void clear()
Definition Scene.hpp:198
SceneRegistry(const std::string &name)
Definition Scene.hpp:208