TPIK  1.0
Task Priority Inverse Kinematics
Loading...
Searching...
No Matches
NonReactiveTask.h
Go to the documentation of this file.
1#include "TPIKDefines.h"
2#include "TPIKExceptions.h"
3#include "Task.h"
4#include <iostream>
5
6namespace tpik {
7/*
8 * @brief Non Reactive Task class, derived from the abstract class tpik::Task
9 * @details Implementation of the Non Reactive tasks provided with an internal activation function equal to 1 and the TaskParameter struct
10 * aimed to store the saturation value, the gain alway equal to 1 and a boolean stating whether the task is active.
11 * The derived classes must implement the following pure virtual methods:
12 * Update() public method used to update the task variables, hence the implementation of the previous virtual method must be called in order
13 * to update all the class variables.
14 */
15class NonReactiveTask : public Task {
16
17public:
18 /*
19 * @brief Constructor of NonReactiveTask Class.
20 * @details Initialization of the class variables:
21 * @param ID task ID
22 * @param taskSpace
23 * @param DoF
24 */
25 NonReactiveTask(const std::string ID, int taskSpace, int DoF);
26 /*
27 * @brief Default deconstructor.
28 */
29 ~NonReactiveTask() override;
30 /*
31 * @brief Method setting the task parameter.
32 */
34 {
36 return taskParameter_;
37 }
38 /*
39 * @brief Method getting and setting the task parameter.
40 * @return Task parameter.
41 */
42 auto TaskParameter() const -> const struct TaskParameter& { return taskParameter_; }
43 /*
44 * @brief Method to flag the possibility to saturete the reference component by component
45 */
51 /*
52 * @brief Method to config from file the task.
53 */
54 bool ConfigFromFile(libconfig::Config& confObj) noexcept(false) override;
55 /*
56 * @brief Overload of the cout operator.
57 */
58 friend std::ostream& operator<<(std::ostream& os, NonReactiveTask const& nonReactive)
59 {
60 return os << "\033[1;37m"
61 << static_cast<const Task&>(nonReactive)
62 << "TaskParameter\n"
63 << "\033[0m" << nonReactive.taskParameter_ << "\n"
64 << "Reference Rate\n"
65 << "\033[0m" << nonReactive.x_dot_bar_ << "\n";
66 }
67
68protected:
69 /*
70 * @brief Method used to check the initialization, hence that all the task parameters have been initializated.
71 * Such meethod must be called in the Update() method before any other method.
72 * @note An exception is thrown if the task parameter has not been initialized yet.
73 */
74 virtual void CheckInitialization() noexcept(false);
75
76 /*
77 * @brief Implementation of the pure virtual method of the base class Task used to update the internal activation function.
78 * Such method must be called in the Update method. For non reactive tasks there is no need to use an activaction function.
79 * For compliance with Reactive task is used and is set to the identity
80 */
82 /*
83 * @brief Implementation of the pure virtual method of the base class Task used to update the task reference rate.
84 * Such method must be called in the Update method.
85 */
86 void UpdateReferenceRate() override;
87
88 /*
89 * @brief Method used to saturate the reference, such method must be called in the Update() method after the UpdateReference method.
90 */
92
93 bool initializedTaskParameter_; // The boolean used to check whether the task parameter have been initialized.
94 struct TaskParameter taskParameter_; // The tpik::TaskParameter.
95 bool saturateRaferenceRateComponentWise_; //flag to check if the refarence rate must be saturete as vector or component by component
96};
97}
Definition NonReactiveTask.h:15
struct TaskParameter taskParameter_
Definition NonReactiveTask.h:94
virtual void CheckInitialization() noexcept(false)
auto TaskParameter() const -> const struct TaskParameter &
Definition NonReactiveTask.h:42
NonReactiveTask(const std::string ID, int taskSpace, int DoF)
void UpdateInternalActivationFunction() override
bool ConfigFromFile(libconfig::Config &confObj) noexcept(false) override
auto TaskParameter() -> TaskParameter &
Definition NonReactiveTask.h:33
~NonReactiveTask() override
friend std::ostream & operator<<(std::ostream &os, NonReactiveTask const &nonReactive)
Definition NonReactiveTask.h:58
auto SaturateReferenceRateComponentWise() -> bool &
Definition NonReactiveTask.h:46
bool initializedTaskParameter_
Definition NonReactiveTask.h:93
void UpdateReferenceRate() override
bool saturateRaferenceRateComponentWise_
Definition NonReactiveTask.h:95
Definition Task.h:27
auto ID() const -> const std::string &
Definition Task.h:90
auto DoF() const -> int
Definition Task.h:74
Eigen::VectorXd x_dot_bar_
Definition Task.h:145
Definition Action.h:9
Task Parameter, used both in the equality and inequality task.
Definition TPIKDefines.h:48