00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00015 #if !defined(_AXE_T_H)
00016 #define _AXE_T_H
00017
00018 #include <boost/serialization/nvp.hpp>
00019 #include <boost/integer.hpp>
00020
00021 #include "motor.h"
00022
00023
00027 class Axe_t : protected Motor_t {
00028 public:
00030 Axe_t();
00031
00034 void calibrate();
00035
00038 void goAbs(const double &value);
00039
00042 void goRel(const double &value);
00043
00045 void stop();
00046
00049 void setSpeed(const double &value);
00050
00054 void setAcc(const double &value);
00055
00059 void setForce(const double &value);
00060
00063 void init();
00064
00066 using Motor_t::setId;
00067
00070 double getMax() const;
00071
00074 double getMin() const;
00075
00078 double getAct() const;
00079
00080 private:
00082 friend class boost::serialization::access;
00083
00087 template<class archive>
00088 void serialize(archive& ar, const unsigned int version);
00089
00090 private:
00091 double act;
00092 double ratio;
00093 double min;
00094 double max;
00095
00097 struct state_t {
00098 double speed;
00099 double acceleration;
00100 double force;
00101
00103 state_t(): speed(0), acceleration(0), force(0) {};
00104
00105 private:
00106
00108 friend class boost::serialization::access;
00109
00113 template<class archive>
00114 void serialize(archive& ar, const unsigned int version);
00115 } state;
00116 };
00117
00118
00119 template<class archive>
00120 void Axe_t::serialize(archive& ar, const unsigned int version) {
00121 using boost::serialization::make_nvp;
00122
00123 ar & make_nvp("Actual", this->act);
00124 ar & make_nvp("Ratio", this->ratio);
00125 ar & make_nvp("Min", this->min);
00126 ar & make_nvp("Max", this->max);
00127 ar & make_nvp("State", this->state);
00128 ar & make_nvp("MotorId", this->id);
00129 }
00130
00131
00132 template<class archive>
00133 void Axe_t::state_t::serialize(archive& ar, const unsigned int version) {
00134 using boost::serialization::make_nvp;
00135
00136 ar & make_nvp("Speed", this->speed);
00137 ar & make_nvp("Acceleration", this->acceleration);
00138 ar & make_nvp("Force", this->force);
00139 }
00140
00141 #endif //_AXE_T_H