controller.cpp
Go to the documentation of this file.
1 
9 #include <ctrl/controller.hpp>
10 #include <QPointF>
11 
12 /* Handle new state of the robot.
13  * Parameter state the new state of the robot, from odometry.
14  * This method can be overwritten by inheritors.
15  */
16 void Controller::newState(const State& state) {
17  static State last_state(state);
18  // new update: moved of 1 cm or .1 second elapsed
19  if ( (state.configuration().position()
20  .sqrDist( last_state.configuration().position() ) > 0.0001)
21  || (state.date() - last_state.date() > .1)
22  || firstOdometry() ) {
23  // signal the GUI for state display (replace logging)
24  stateUpdated(state); // send for display
25  last_state = state;
26  if ( firstOdometry() ) // if first odometry data,
27  changeFirstOdometry(); // not any more
28  } // end of if (new update)
29 } // end of void Controller::newOdometry(const Odometry::ConstPtr&) --
void changeFirstOdometry()
Change the odometry data status (first or not).
Definition: controller.hpp:80
void stateUpdated(const State &state)
Update the display of the state.
const iSeeML::rob::OrPtConfig & configuration() const
Gives the configuration of the state.
Definition: state.hpp:67
const double & date() const
Gives the configuration of the state.
Definition: state.hpp:61
virtual void newState(const State &state)
Handles new state of the robot.
Definition: controller.cpp:16
This class defines a state, i.e. a configuration and its (translation and rotation) velocities...
Definition: state.hpp:22
bool firstOdometry()
Are the odometry data the first?
Definition: controller.hpp:76
Controller abstract class.


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