-
Notifications
You must be signed in to change notification settings - Fork 0
/
RobotData.h
executable file
·114 lines (83 loc) · 2.8 KB
/
RobotData.h
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
110
111
112
113
114
#pragma once
#ifndef ROBOT_DATA_H
#define ROBOT_DATA_H
#include<vector>
#include <iostream> //for reading text
#include <fstream> //for reading text
#include <string> //for reading text
#include <sstream>
#include <algorithm>
using std::vector;
using std::fstream;
using std::string;
using std::stringstream;
using std::max;
using std::abs;
using std::min;
struct RobotRawData
{
//----------------------------------------------- [ Robot's info ]
vector<double> velocityLimits_;
vector<double> accelerationLimits_;
vector<double> jerkLimits_;
vector<vector<double>> weights_;
//----------------------------------------------- [Path's info ]
vector<vector<double>> path_; //<sampleId, joints angles>
vector<double> starting_points_;
double samplingFrequency_;
double samplingFrequencyTarget_;
double costScaleFactor_;
double makespan_;
double timeToleranceMax_;
double timeToleranceMin_;
double epsilonT_;
};
class RobotData
{
public:
RobotData();
RobotData(RobotRawData& data);
RobotData& loadData(); // For reading from a text file
int getPathLength() const;
int getNbJoints() const;
// int getZoneExitSampleNo() const;
// int getZoneEnterSampleNo() const;
double getVelocityLimit(int jointId) const;
double getAccelerationLimit(int jointId) const;
double getJerkLimit(int jointId) const;
const vector<double>& getWeightsOnJoint(int jointId) const;
double getAngle(int sampleId, int jointId) const;
double getSamplingFrequency() const;
double getSamplingFrequencyTarget() const;
double getScaleFactor() const;
double getTimeToleranceMax() const;
double getTimeToleranceMin() const;
double getMakespan() const;
double getStartingPoint(int sampleId) const;
double getSeenVelocity(int jointId) const;
double getSeenAcceleration(int jointId) const;
double getSeenJerk(int jointId) const;
double getCurrentJerk(int sampleId,int jointId) const;
private:
//----------------------------------------------- [ Robot's info ]
vector<double> velocityLimits_;
vector<double> accelerationLimits_;
vector<double> jerkLimits_;
vector<vector<double>> currentJerk_;
vector<vector<double>> weights_;
//----------------------------------------------- [Path's info ]
vector<vector<double>> path_; //<sampleId, joints angles>
vector<double> starting_points_;
vector<double> maxSeenVeocity_;
vector<double> maxSeenAcceleration_;
vector<double> maxSeenJerk_;
double samplingFrequency_;
double samplingFrequencyTarget_;
double costScaleFactor_;
double makespan_;
double timeToleranceMax_;
double timeToleranceMin_;
double epsilonT_;
void caclMaxVelAccel_();
};
#endif