state.hpp
Go to the documentation of this file.
1 
9 #ifndef QTCTRL_STATE
10 #define QTCTRL_STATE
11 
12 
13 #include <iSeeML/rob/OrPtConfig.hpp>
14 
15 
22 class State : public iSeeML::rob::Object {
23  double t;
24  iSeeML::rob::OrPtConfig config;
25  double translation_vel;
26  double rotation_vel;
27 
28 public:
33  static const string ClassName;
34 
41  State() : t(0), config(), translation_vel(0), rotation_vel(0) {}
42 
50  State(const double& date, const iSeeML::rob::OrPtConfig& q,
51  const double& trans_vel, const double& rot_vel)
52  : t(date), config(q), translation_vel(trans_vel),
53  rotation_vel(rot_vel) {}
54 
55  // The default copy constructor is OK.
56 
61  const double& date() const { return t; }
62 
67  const iSeeML::rob::OrPtConfig& configuration() const
68  { return config; }
69 
74  const double& translationVelocity() const
75  { return translation_vel; }
76 
81  const double& rotationVelocity() const { return rotation_vel; }
82 
93  bool operator==(const State& other) const {
94  return( ( configuration() == other.configuration() ) &&
95  isZero( translationVelocity()
96  - other.translationVelocity() ) &&
97  isZero( rotationVelocity() - other.rotationVelocity() )
98  ); }
99 
108  iSeeML::Object& clone() const
109  { return *( (iSeeML::Object*) (new State(*this)) ); }
110 
114  void writeTo(std::ostream& O) const {
115  const iSeeML::rob::OrPtConfig& q = configuration();
116  const iSeeML::geom::Point& P = q.position();
117  O << '(' << P.xCoord() << ", " << P.yCoord() << ", "
118  << q.orientation() << ", " << translationVelocity()
119  << ", " << rotationVelocity() << ')';
120  } // end of void writeTo(std::ostream&) const
121 
131  State operator+(const iSeeML::rob::OrPtConfig& q) const
132  { State res(*this); res += q; return(res); }
133 
142  void operator+=(const iSeeML::rob::OrPtConfig& q) { config += q; }
143 
144 }; // end of class State
145 
146 #endif // QTCTRL_STATE
State(const double &date, const iSeeML::rob::OrPtConfig &q, const double &trans_vel, const double &rot_vel)
The main constructor.
Definition: state.hpp:50
bool operator==(const State &other) const
Equality operator between states.
Definition: state.hpp:93
const double & rotationVelocity() const
Gives the rotation velocity of the state.
Definition: state.hpp:81
State operator+(const iSeeML::rob::OrPtConfig &q) const
Returns the addition of a configuration to the current state.
Definition: state.hpp:131
const iSeeML::rob::OrPtConfig & configuration() const
Gives the configuration of the state.
Definition: state.hpp:67
void operator+=(const iSeeML::rob::OrPtConfig &q)
Adds a configuration to the current state: moves the state in the configuration&#39;s frame...
Definition: state.hpp:142
double t
Date of the state.
Definition: state.hpp:23
const double & translationVelocity() const
Gives the translation velocity of the state.
Definition: state.hpp:74
const double & date() const
Gives the configuration of the state.
Definition: state.hpp:61
This class defines a state, i.e. a configuration and its (translation and rotation) velocities...
Definition: state.hpp:22
iSeeML::Object & clone() const
Definition: state.hpp:108
double translation_vel
Translation velocity of the state.
Definition: state.hpp:25
State()
The default constructor should only be used for array initializations: it correspond to a default poi...
Definition: state.hpp:41
double rotation_vel
Rotation velocity of the state.
Definition: state.hpp:26
iSeeML::rob::OrPtConfig config
Configuration of the state.
Definition: state.hpp:24
void writeTo(std::ostream &O) const
Writes the configuration&#39;s values in an output stream.
Definition: state.hpp:114
static const string ClassName
Definition: state.hpp:33


qt_ctrl
Author(s): Alexis Scheuer
autogenerated on Wed Dec 16 2020 15:51:32