TPIK  1.0
Task Priority Inverse Kinematics
Loading...
Searching...
No Matches
Solver.h
Go to the documentation of this file.
1#ifndef __SOLVER_H__
2#define __SOLVER_H__
3
4#include "ActionManager.h"
5#include "iCAT.h"
6#include <eigen3/Eigen/Dense>
7#include <iostream>
8
9namespace tpik {
10/*
11* @brief Solver class.
12* @details Implementation of the Solver class. Using the tpik::ActionManager and tpik::TPIK, it computes the inverse kinematic control for all the priorityLevels
13* by taking into account the transition between the current action and the previous one.
14*/
15class Solver {
16
17public:
18 /*
19 * @brief Solver Class constructor.
20 * @param[in] actionManager std::shared_ptr to the tpik::ActionManager containing the unified hierarchy and the action list. Before calling the constructor the
21 * unified hierarchy must already have been specified.
22 * @param[in] tpik std::shared_ptr to tpik::TPIK.
23 */
24 Solver(std::shared_ptr<ActionManager> actionManager, std::shared_ptr<iCAT> icat);
25 /*
26 * @brief Default constructor
27 */
29 /*
30 * @brief Method which sets the current action.
31 * @param[in] action current action ID.
32 * @param[in] transiction true if transiction in between action, false otherwise
33 */
34 bool SetAction(const std::string action, bool transition);
35 /*
36 * @brief Method which implements the kinematic control by computing and returning the desired velocities.
37 * @return Computed Velocity Vector.
38 */
39 const Eigen::VectorXd ComputeVelocities();
40 /*
41 * @brief Method returning the delta y computed at each level.
42 * @return std vector of eigen vector containing the y increments computed for each priority level.
43 */
44 auto DeltaYs() const -> const std::vector<Eigen::VectorXd>& { return delta_y_; }
45 /*
46 * @brief Overloading of the cout operator
47 */
48 friend std::ostream& operator<<(std::ostream& os, Solver const& solver)
49 {
50 return os << "\033[1;37m"
51 << "Solver \n"
52 << std::setprecision(2) << *solver.actionManager_ << "\n"
53 << *solver.iCat_;
54 }
55
56private:
57 std::shared_ptr<ActionManager> actionManager_; // The std::shared_ptr to the tpik::ActionManager.
58 std::shared_ptr<iCAT> iCat_; // The std::shared_ptr to the tpik::TPIK.
59 Hierarchy hierarchy_; // The unified hierarhcy.
60 std::vector<Eigen::VectorXd> delta_y_; // y computed at each priority level.
61};
62}
63
64#endif
Definition Solver.h:15
auto DeltaYs() const -> const std::vector< Eigen::VectorXd > &
Definition Solver.h:44
bool SetAction(const std::string action, bool transition)
~Solver()
Definition Solver.h:28
Solver(std::shared_ptr< ActionManager > actionManager, std::shared_ptr< iCAT > icat)
friend std::ostream & operator<<(std::ostream &os, Solver const &solver)
Definition Solver.h:48
const Eigen::VectorXd ComputeVelocities()
Definition Action.h:9
std::vector< std::shared_ptr< tpik::PriorityLevel > > Hierarchy
Definition Action.h:13