keyboard.hpp
Go to the documentation of this file.
1 
10 #ifndef QTCTRL_KEYBOARD_CTRL
11 #define QTCTRL_KEYBOARD_CTRL
12 
13 #include <ctrl/controller.hpp>
14 
23 class KbdCtrl : public Controller {
25  double moving_factor;
28 
29 public:
34  KbdCtrl(const MotionModel& model, const double& ts)
35  : Controller(model, ts) {}
36 
38  virtual ~KbdCtrl() {}
39 
42 
45 
57  void acc(const int transFact, const int rotFact) {
58  turning_factor = (rotFact > 1 ? 1 : rotFact < -1 ? -1 : rotFact);
59  moving_factor = (transFact > 1 ? 1 : transFact < -1 ? -1
60  : transFact);
61  }
62 
63  // Cf Controller::chooseVelocities(...)
64  void chooseVelocities(double& trans_vel, double& rot_vel,
65  std::ostream& log_str) {
68  moving_factor, turning_factor, time_step); /*
69  log_str << "+(" << moving_factor << " x, " << turning_factor
70  << " x, " << time_step << ")"; */
71  updateVelocities(trans_vel, rot_vel);
72  }
73 
74 }; // end of class KbdCtrl
75 
76 #endif // QTCTRL_KEYBOARD_CTRL
Controller is the abstract class inherited by all the implemented controllers.
Definition: controller.hpp:28
double turning_factor
Increment factor of rotation velocity, in [-1, 1].
Definition: keyboard.hpp:27
KbdCtrl allows to control the robot with the keyboard.
Definition: keyboard.hpp:23
const double time_step
The time step of the controller.
Definition: controller.hpp:39
double moving_velocity
Translation velocity desired for the robot.
Definition: controller.hpp:45
void applyAccelerationFactors(double &trans_vel, double &rot_vel, const double &trans_fact, const double &rot_fact, const double &time_step) const
Modify translation and rotation given velocities, applying the extremal accelerations multiplied by t...
Definition: motion.cpp:77
void stopTranslation()
Stops the robot&#39;s translation.
Definition: keyboard.hpp:44
void acc(const int transFact, const int rotFact)
Changes both velocities (translation and rotation) by adding or removing the related increment (accel...
Definition: keyboard.hpp:57
KbdCtrl(const MotionModel &model, const double &ts)
The constructor needs a motion model.
Definition: keyboard.hpp:34
void updateVelocities(double &trans_vel, double &rot_vel)
Update the velocities from the fields and send the update signal.
Definition: controller.hpp:66
const MotionModel & motion_model
The model of the motion.
Definition: controller.hpp:36
void chooseVelocities(double &trans_vel, double &rot_vel, std::ostream &log_str)
Computes new velocities for ROS node.
Definition: keyboard.hpp:64
virtual ~KbdCtrl()
The destructor needs to be explicitely redefined.
Definition: keyboard.hpp:38
double turning_velocity
Rotation velocity desired for the robot.
Definition: controller.hpp:47
This class defines a motion model, with the motion limits.
Definition: motion.hpp:28
double moving_factor
Increment factor of translation velocity, in [-1, 1].
Definition: keyboard.hpp:25
Controller abstract class.
void stopRotation()
Stops the robot&#39;s rotation.
Definition: keyboard.hpp:41


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