00001 00060 #ifndef JOINTLIMITS_H 00061 #define JOINTLIMITS_H 00062 00063 #include <iostream> 00064 #include <map> 00065 #include <vector> 00066 #include <string> 00067 #include <chrono> 00068 #include <unordered_map> 00069 #include <functional> 00070 #include <cstdlib> 00071 00072 00073 class JointLimits 00074 { 00075 private: 00076 std::vector<double> MaxVelocities_; 00077 std::vector<double> LowerLimits_; 00078 std::vector<double> UpperLimits_; 00079 std::vector<double> Offsets_; 00080 std::vector<double> HWPositive_; 00081 std::vector<double> HWNegative_; 00082 int DOF_; 00083 00084 public: 00085 00086 bool checkPositionLimits(std::vector<double> positions,std::vector<double> velocities); 00087 bool checkVelocityLimits(std::vector<double> velocities); 00088 00089 bool checkHardwareLimits(std::vector<double> velocities); 00090 00091 int setMaxVelocities(std::vector<double> max_vel) 00092 { 00093 if ((int)max_vel.size() == getDOF()) 00094 { 00095 MaxVelocities_ = max_vel; 00096 return 0; 00097 } 00098 return -1; 00099 00100 } 00101 00102 int setLowerLimits(std::vector<double> low_lim) 00103 00104 { 00105 if ((int)low_lim.size() == getDOF()) 00106 { 00107 LowerLimits_ = low_lim; 00108 return 0; 00109 } 00110 return -1; 00111 00112 } 00113 00114 int setUpperLimits(std::vector<double> up_lim) 00115 { 00116 if ((int)up_lim.size() == getDOF()) 00117 { 00118 UpperLimits_ = up_lim; 00119 return 0; 00120 } 00121 return -1; 00122 } 00123 00124 int setOffsets(std::vector<double> offs) 00125 { 00126 if ((int)offs.size() == getDOF()) 00127 { 00128 Offsets_ = offs; 00129 return 0; 00130 } 00131 return -1; 00132 } 00133 00134 void setDOF(int dof) 00135 { 00136 DOF_ = dof; 00137 } 00138 00139 std::vector<double> getMaxVelocities() 00140 { 00141 return MaxVelocities_; 00142 } 00143 00144 std::vector<double> getLowerLimits() 00145 { 00146 return LowerLimits_; 00147 } 00148 00149 std::vector<double> getUpperLimits() 00150 { 00151 return UpperLimits_; 00152 } 00153 00154 std::vector<double> getOffsets() 00155 { 00156 return Offsets_; 00157 } 00158 00159 int getDOF() 00160 { 00161 return DOF_; 00162 } 00163 00164 00165 }; 00166 00167 #endif // JOINTLIMITS