Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FileCtrl Class Reference

FileCtrl allows to control the robot from a file. More...

#include <file.hpp>

Inheritance diagram for FileCtrl:
Inheritance graph
[legend]

Public Member Functions

void chooseVelocities (double &trans_vel, double &rot_vel, std::ostream &log_str)
 Computes new velocities for ROS node. More...
 
 FileCtrl (const MotionModel &model, const double &ts, const char *input_file_name=NULL)
 The constructor needs a motion model and an optional input file name. More...
 
void setInput (const char *input_file_name)
 Change the input stream to a new file. More...
 
virtual ~FileCtrl ()
 The destructor closes the input stream, if any. More...
 
- Public Member Functions inherited from Controller
virtual void newState (const State &state)
 Handles new state of the robot. More...
 
void stopMotion ()
 Stops the robot (i.e. sets both velocities to zero). More...
 
const double & timeStep () const
 Stops the robot (i.e. sets both velocities to zero). More...
 
virtual ~Controller ()
 The destructor needs to be defined as virtual. More...
 

Protected Member Functions

void inputEnd ()
 Close and terminate the input stream. More...
 
bool inputEnded () const
 Is the input stream at its end? More...
 
bool inputOK () const
 Is the input stream OK for reading? More...
 
- Protected Member Functions inherited from Controller
void changeFirstOdometry ()
 Change the odometry data status (first or not). More...
 
 Controller (const MotionModel &model, const double &ts)
 This constructor (for the inheriting controllers) sets the motion model to the given one. More...
 
bool firstOdometry ()
 Are the odometry data the first? More...
 
void updateVelocities (double &trans_vel, double &rot_vel)
 Update the velocities from the fields and send the update signal. More...
 

Protected Attributes

std::ifstream * input
 The input stream, if any. More...
 
- Protected Attributes inherited from Controller
double initial_date
 The first date of the odometry. More...
 
const MotionModelmotion_model
 The model of the motion. More...
 
double moving_velocity
 Translation velocity desired for the robot. More...
 
const double time_step
 The time step of the controller. More...
 
double turning_velocity
 Rotation velocity desired for the robot. More...
 

Additional Inherited Members

- Signals inherited from Controller
void commandsUpdated (const double &trans_vel, const double &rot_vel)
 Update the display of the controller's commands. More...
 
void stateUpdated (const State &state)
 Update the display of the state. More...
 

Detailed Description

FileCtrl allows to control the robot from a file.

Most of fields and methods were initially defined in ROS node.

Since
0.3.0

Definition at line 25 of file file.hpp.

Constructor & Destructor Documentation

FileCtrl::FileCtrl ( const MotionModel model,
const double &  ts,
const char *  input_file_name = NULL 
)
inline

The constructor needs a motion model and an optional input file name.

Parameters
modelthe motion model,
tsthe time step of the controller,
input_file_namethe input file name.
See also
Controller(const MotionModel&)

Definition at line 50 of file file.hpp.

virtual FileCtrl::~FileCtrl ( )
inlinevirtual

The destructor closes the input stream, if any.

Since
0.2.4

Definition at line 60 of file file.hpp.

Member Function Documentation

void FileCtrl::chooseVelocities ( double &  trans_vel,
double &  rot_vel,
std::ostream &  log_str 
)
virtual

Computes new velocities for ROS node.

This method has to be defined by inheritors. It should use updateVelocities.

Parameters
trans_velthe translation velocity, sent by the ROS node to ROS,
rot_velthe rotation velocity, sent to ROS,
log_strthe log stream, allowing to log debug data.

Implements Controller.

Reimplemented in PIDCtrl, and ImitateCtrl.

Definition at line 14 of file file.cpp.

void FileCtrl::inputEnd ( )
inlineprotected

Close and terminate the input stream.

Since
0.2.4

Definition at line 40 of file file.hpp.

bool FileCtrl::inputEnded ( ) const
inlineprotected

Is the input stream at its end?

Returns
Yes if at the end, no otherwise.
Since
0.3.1

Definition at line 36 of file file.hpp.

bool FileCtrl::inputOK ( ) const
inlineprotected

Is the input stream OK for reading?

Returns
Yes if OK, no otherwise.
Since
0.2.4

Definition at line 31 of file file.hpp.

void FileCtrl::setInput ( const char *  input_file_name)
inline

Change the input stream to a new file.

Parameters
input_file_nameThe input file name.
Since
0.2.4

Definition at line 64 of file file.hpp.

Member Data Documentation

std::ifstream* FileCtrl::input
protected

The input stream, if any.

Since
0.2.4

Definition at line 27 of file file.hpp.


The documentation for this class was generated from the following files:


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