TPIK  1.0
Task Priority Inverse Kinematics
Loading...
Searching...
No Matches
TPIKDefines.h
Go to the documentation of this file.
1#ifndef __TPIKDEFINES_H__
2#define __TPIKDEFINES_H__
3
4//#include <ctrl_toolbox/HelperFunctions.h>
5#include <eigen3/Eigen/Dense>
6#include <libconfig.h++>
7#include <memory>
8#include "ConfHelpers.h"
9
10namespace tpik {
16 Eigen::VectorXd xmin;
17 Eigen::VectorXd xmax;
21 friend std::ostream& operator<<(std::ostream& os, BellShapedParameter const& bellShape)
22 {
23 return os << "\033[1;37m"
24 << "xmin \n"
25 << "\033[0m" << bellShape.xmin << "\n"
26 << "\033[1;37m"
27 << "xmax \n"
28 << "\033[0m" << bellShape.xmax;
29 }
30
31 template <typename T>
32 bool ConfigureFromFile(T& confObj) noexcept(false)
33 {
34 if (!GetParamVector(confObj, xmin, "xmin")) {
35 return false;
36 }
37 if (!GetParamVector(confObj, xmax, "xmax")) {
38 return false;
39 }
40
41 return true;
42 }
43};
44
49 bool taskEnable = false;
50
51 double gain = 0.0;
52 double conf_gain = 0.0;
53
54 double saturation = 0.0;
55 double conf_saturation = 0.0;
56
60 friend std::ostream& operator<<(std::ostream& os, TaskParameter const& taskParam)
61 {
62 return os << "\033[1;37m"
63 << "taskEnable \n"
64 << "\033[0m" << taskParam.taskEnable << "\n"<< "\033[1;37m"
65 << "gain \n"
66 << "\033[0m" << taskParam.gain << "\n"
67 << "\033[1;37m"
68 << "saturation \n"
69 << "\033[0m" << taskParam.saturation;
70 }
71
72 bool ConfigureFromFile(const libconfig::Setting& confObj) noexcept(false)
73 {
74 if (!GetParam(confObj, taskEnable, "enable")) {
75 return false;
76 }
77
78 if (!GetParam(confObj, gain, "gain")) {
79 return false;
80 }
81 conf_gain = gain; // Backup value in case of online value changes
82
83 if (!GetParam(confObj, saturation, "saturation")) {
84 return false;
85 }
86 conf_saturation = saturation; // Backup value in case of online value changes
87
88 return true;
89 }
90};
94enum class ProjectorType {
95 Default,
96 OnLine,
97 OnPlane,
98};
99
100enum class TaskType {
101 Equality,
103};
104
105enum class TaskOption {
106 Default,
109};
110}
111
112#endif
Definition Action.h:9
ProjectorType
The ProjectorType enum definig the projector type.
Definition TPIKDefines.h:94
bool GetParam(const libconfig::Setting &confObj, A &param, const std::string &name) noexcept(false)
SetParam functor.
Definition ConfHelpers.h:18
TaskOption
Definition TPIKDefines.h:105
TaskType
Definition TPIKDefines.h:100
bool GetParamVector(const libconfig::Setting &confObj, A &param, const std::string &name) noexcept(false)
SetParam functor.
Definition ConfHelpers.h:46
Parameter used to define a bell shaped function. Used to create either an increasing or a decreasing ...
Definition TPIKDefines.h:15
Eigen::VectorXd xmax
Vector containing the xmax for all the bell shaped function described by the struct.
Definition TPIKDefines.h:17
friend std::ostream & operator<<(std::ostream &os, BellShapedParameter const &bellShape)
Overload of the cout operator.
Definition TPIKDefines.h:21
Eigen::VectorXd xmin
Vector containing the xmin for all the bell shaped function described by the struct.
Definition TPIKDefines.h:16
bool ConfigureFromFile(T &confObj) noexcept(false)
Definition TPIKDefines.h:32
Task Parameter, used both in the equality and inequality task.
Definition TPIKDefines.h:48
double gain
The reference gain used in calculation.
Definition TPIKDefines.h:51
double conf_saturation
A backup variable for reference saturation loaded from the configuration file.
Definition TPIKDefines.h:55
double saturation
The reference saturation value.
Definition TPIKDefines.h:54
bool ConfigureFromFile(const libconfig::Setting &confObj) noexcept(false)
Definition TPIKDefines.h:72
bool taskEnable
Boolean stating whether the task is active.
Definition TPIKDefines.h:49
friend std::ostream & operator<<(std::ostream &os, TaskParameter const &taskParam)
Overload of the cout operator.
Definition TPIKDefines.h:60
double conf_gain
A backup variable for reference gain loaded from the configuration file.
Definition TPIKDefines.h:52