ctrlWdgt.hpp
Go to the documentation of this file.
1 
9 #ifndef QTCTRL_GUI_CONTROL
10 #define QTCTRL_GUI_CONTROL
11 
12 #include <QWidget>
13 #include <QKeyEvent>
14 #include <QApplication> // to get qApp definition
15 #include <ctrl/controller.hpp>
16 
25 
26 protected:
31  const MotionModel& model;
32 
37  const MotionModel& motion_model)
38  : ctrl(controller), model(motion_model) {}
39 
40 public:
42  virtual ~ControlWidget() {}
43 
48  virtual QWidget& widget() = 0;
49 
52  virtual void updateState(const State& state) = 0;
53 
58  virtual void updateCommands(const double& trans_vel,
59  const double& rot_vel) = 0;
60 
69  void keyPressed(QKeyEvent* event) {
70  const int key = event->key(); // get the event's key
71  if ( (key == Qt::Key_Q) || (key == Qt::Key_X) ) qApp->quit();
72  }
73 
75  void keyReleased(QKeyEvent*) {}
76 
77 }; // end of class ControlWidget
78 
79 #endif // QTCTRL_GUI_CONTROL
Controller is the abstract class inherited by all the implemented controllers.
Definition: controller.hpp:28
virtual void updateState(const State &state)=0
Update the display of the odometry.
ControlWidget(Controller &controller, const MotionModel &motion_model)
The constructor is used by inheritors.
Definition: ctrlWdgt.hpp:36
This abstract class is inherited by all those containing a Qt widget intended to show the controller&#39;...
Definition: ctrlWdgt.hpp:24
void keyPressed(QKeyEvent *event)
Handles Quit/eXit shortcuts.
Definition: ctrlWdgt.hpp:69
This class defines a state, i.e. a configuration and its (translation and rotation) velocities...
Definition: state.hpp:22
const MotionModel & model
The motion model and its limits values.
Definition: ctrlWdgt.hpp:31
This class defines a motion model, with the motion limits.
Definition: motion.hpp:28
virtual void updateCommands(const double &trans_vel, const double &rot_vel)=0
Update the display of the ROS node.
virtual QWidget & widget()=0
Returns the widget used to display the behaviour.
Controller & ctrl
This widget is the GUI of a controller.
Definition: ctrlWdgt.hpp:29
Controller abstract class.
void keyReleased(QKeyEvent *)
Key release can be handled by inheritors.
Definition: ctrlWdgt.hpp:75
virtual ~ControlWidget()
The destructor needs to be defined as virtual.
Definition: ctrlWdgt.hpp:42


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