track.cpp
Go to the documentation of this file.
1 
10 #include <ctrl/track.hpp>
11 
12 /* The constructor needs a motion model, a file name giving the path
13  * to track and an initial configuration.
14  *
15  * States from the path are projected into the initial
16  * configuration's frame..
17  *
18  * Parameter model the motion model,
19  * ts the time step of the controller,
20  * input_file_name the input file name,
21  * init_config the initial configuration.
22  *
23  * See FileCtrl(const MotionModel&, const char*),
24  * Config::projection(const Config&), list::push_back
25  */
27  const double& ts,
28  const char* input_file_name,
29  const iSeeML::rob::OrPtConfig& init_config)
30  : FileCtrl(model, ts, input_file_name), nb_states(0),
31  goal(NULL), state() {
32  if ( inputOK() ) {
33  double t, x, y, th, v, om;
34  std::string endLine;
35  std::getline(*input, endLine); // skip first line
36  do {
37  *input >> t >> x >> y >> th >> v >> om;
38  if ( !inputEnded() ) {
39  iSeeML::rob::OrPtConfig q = init_config.projection
40  ( iSeeML::rob::OrPtConfig(iSeeML::geom::Point(x, y), th) );
41  traject.push_back( new State(t, q, v, om) );
42  nb_states++;
43  std::getline(*input, endLine); // skip the rest of the line
44  } // end of if (input not ended)
45  } while ( !inputEnded() );
46  goal = traject.begin();
47  } // end of if (input OK)
48 } // end of TrackingCtrl::TrackingCtrl(const MotionModel&, ...) ------
49 
bool inputEnded() const
Is the input stream at its end?
Definition: file.hpp:36
std::list< State * >::const_iterator goal
The trajectory&#39;s state which is aimed.
Definition: track.hpp:30
Path following controller abstract class.
bool inputOK() const
Is the input stream OK for reading?
Definition: file.hpp:31
int nb_states
The number of states in the followed trajectory.
Definition: track.hpp:28
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
std::ifstream * input
The input stream, if any.
Definition: file.hpp:27
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