-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy path6dControl.hpp
109 lines (91 loc) · 2.91 KB
/
6dControl.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#ifndef D_CONTROL_HPP
#define D_CONTROL_HPP
#include <motor_controller/PID.hpp>
#include <math.h>
#include <base/Time.hpp>
#include <base/Eigen.hpp>
#include <base/Float.hpp>
#include <base/commands/LinearAngular6DCommand.hpp>
#include <rtt/FlowStatus.hpp>
namespace auv_control{
struct ExpectedInputs{
bool linear[3];
bool angular[3];
ExpectedInputs() {
for (int i = 0; i < 3; ++i) {
linear[i] = angular[i] = true;
}
}
};
struct PIDState : public motor_controller::PIDState
{
bool active;
PIDState()
: motor_controller::PIDState(), active(false) {}
PIDState(motor_controller::PIDState const& state, bool active)
: motor_controller::PIDState(state), active(active) {}
};
struct LinearAngular6DPIDState{
PIDState linear[3];
PIDState angular[3];
base::Time time;
};
struct LinearAngular6DPID{
motor_controller::PID linear[3];
motor_controller::PID angular[3];
};
struct InputPortConfig{
std::string name;
base::Time timeout;
};
}
namespace base{
struct LinearAngular6DWaypoint{
LinearAngular6DCommand cmd;
double opt_orientation;
double opt_orientation_distance;
double linear_tolerance;
double angular_tolerance;
double hold_time;
LinearAngular6DWaypoint(){
opt_orientation_distance = base::infinity<double>();
linear_tolerance = 0.2;
angular_tolerance = 0.2;
hold_time = 0;
}
};
struct LinearAngular6DWaypointInfo{
LinearAngular6DCommand current_delta;
LinearAngular6DWaypoint current_waypoint;
int queue_size;
};
struct LinearAngular6DPIDSettings{
motor_controller::PIDSettings linear[3];
motor_controller::PIDSettings angular[3];
bool operator==(const LinearAngular6DPIDSettings& rhs) const{
for(int i = 0; i < 3; i++){
if(this->linear[i] != rhs.linear[i] || this->angular[i] != rhs.angular[i])
return false;
}
return true;
}
bool operator!=(const LinearAngular6DPIDSettings& rhs) const{
return !(*this == rhs);
}
};
struct LinearAngular6DParallelPIDSettings{
motor_controller::ParallelPIDSettings linear[3];
motor_controller::ParallelPIDSettings angular[3];
bool operator==(const LinearAngular6DParallelPIDSettings& rhs) const{
for(int i = 0; i < 3; i++){
if(this->linear[i] != rhs.linear[i] || this->angular[i] != rhs.angular[i])
return false;
}
return true;
}
bool operator!=(const LinearAngular6DParallelPIDSettings& rhs) const{
return !(*this == rhs);
}
};
}
#endif