track.hpp
Go to the documentation of this file.
1 
10 #ifndef QTCTRL_TRACK_CTRL
11 #define QTCTRL_TRACK_CTRL
12 
13 #include <fstream> // to get ifstream definition
14 #include <list>
15 #include <model/state.hpp>
16 #include <ctrl/file.hpp>
17 
23 class TrackingCtrl : public FileCtrl {
24 protected:
26  std::list<State*> traject;
28  int nb_states;
30  std::list<State*>::const_iterator goal;
33 
38  void searchGoal(const double& forwardTime = 0) {
39  while ( ( goal != traject.end() )
40  && ( (*goal)->date() < state.date() + forwardTime ) )
41  goal++; // do not go over the last element:
42  if ( goal == traject.end() ) goal--;
43  } // end of void searchGoal(const double&)
44 
45 public:
62  TrackingCtrl(const MotionModel& model, const double& ts,
63  const char* input_file_name,
64  const iSeeML::rob::OrPtConfig& init_config);
65 
67  virtual ~TrackingCtrl() {}
68 
69  // Cf Controller::newState(const State&)
70  virtual void newState(const State& state)
71  { this->state = state; Controller::newState(state); }
72 
75  const std::list<State*>& trajectory() const { return traject; }
76 
77 }; // end of class TrackingCtrl
78 
79 #endif // QTCTRL_TRACK_CTRL
void searchGoal(const double &forwardTime=0)
Moves the goal forward until it gets after the robot&#39;s date plus a given amount of time...
Definition: track.hpp:38
State state
The current state of the robot.
Definition: track.hpp:32
virtual ~TrackingCtrl()
The destructor needs to be explicitely redefined.
Definition: track.hpp:67
std::list< State * >::const_iterator goal
The trajectory&#39;s state which is aimed.
Definition: track.hpp:30
State class, i.e. configuration and velocities.
File controller (teleoperation) class.
TrackingCtrl aims at following a trajectory with the robot.
Definition: track.hpp:23
int nb_states
The number of states in the followed trajectory.
Definition: track.hpp:28
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
std::list< State * > traject
The trajectory which should be followed.
Definition: track.hpp:26
This class defines a motion model, with the motion limits.
Definition: motion.hpp:28
FileCtrl allows to control the robot from a file.
Definition: file.hpp:25
virtual void newState(const State &state)
Handles new state of the robot.
Definition: track.hpp:70
const std::list< State * > & trajectory() const
Gives the tracked trajectory.
Definition: track.hpp:75
TrackingCtrl(const MotionModel &model, const double &ts, const char *input_file_name, const iSeeML::rob::OrPtConfig &init_config)
The constructor needs a motion model, a time step, a file name giving the path to track and an initia...
Definition: track.cpp:26


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