teleop.hpp
Go to the documentation of this file.
1 
9 #ifndef QTCTRL_GUI_TELEOP
10 #define QTCTRL_GUI_TELEOP
11 
12 
13 #include <QGroupBox>
14 #include <QSignalMapper>
15 #include <ctrl/keyboard.hpp>
16 #include <gui/viewCtrl.hpp>
17 
31 class TeleopWidget : private QGroupBox, public ControlWidget {
32  Q_OBJECT // This macro is needed to handle graphical events
33 
37 
41  QSignalMapper mapper;
42 
43 public:
50  TeleopWidget(QWidget& parent, KbdCtrl& control,
51  const MotionModel& motion_model);
52 
55 
60  QWidget& widget() { return *this; }
61 
62  // Cf ControlWidget::updateState(const State&)
63  void updateState(const State& state)
64  { vel_drawing.updateState(state); }
65 
66  // Cf ControlWidget::updateCommands(const double&, const double&)
67  void updateCommands(const double& trans_vel, const double& rot_vel)
68  { vel_drawing.updateCommands(trans_vel, rot_vel); }
69 
70 protected Q_SLOTS:
82  void keyPressEvent(QKeyEvent* event)
83  // either react to event's key, or use ControlWidget::keyPressed
84  { react( event->key() ); ControlWidget::keyPressed(event); }
85 
87  void keyReleaseEvent(QKeyEvent*) { stopAcc(); }
88 
89 private Q_SLOTS:
91  void stopAcc() { ((KbdCtrl&)(ctrl)).acc(0,0); }
92 
123  void react(const int& key);
124 
125 }; // end of class TeleopWidget
126 
127 #endif // QTCTRL_GUI_TELEOP
void updateState(const State &state)
Update the display of the odometry.
Definition: viewCtrl.hpp:85
Qt control widget showing current and aimed velocities.
KbdCtrl allows to control the robot with the keyboard.
Definition: keyboard.hpp:23
void react(const int &key)
This widget reacts to commands, which are Qt key values.
Definition: teleop.cpp:111
void updateState(const State &state)
Update the display of the odometry.
Definition: teleop.hpp:63
void stopAcc()
Stops the acceleration of the ROS node.
Definition: teleop.hpp:91
QWidget & widget()
Returns the widget used to display the behaviour.
Definition: teleop.hpp:60
QSignalMapper mapper
The Qt object mapping the widget&#39;s buttons with the parameter transmitted to react().
Definition: teleop.hpp:41
This abstract class is inherited by all those containing a Qt widget intended to show the controller&#39;...
Definition: ctrlWdgt.hpp:24
ViewCtrlWdgt vel_drawing
This widget draws the velocities&#39; evolutions.
Definition: teleop.hpp:36
This class is a Qt widget which allows to show the controller&#39;s behaviour (current and aimed velociti...
Definition: viewCtrl.hpp:24
void keyPressed(QKeyEvent *event)
Handles Quit/eXit shortcuts.
Definition: ctrlWdgt.hpp:69
Keyboard controller (teleoperation) class.
void updateCommands(const double &trans_vel, const double &rot_vel)
Update the display of the ROS node.
Definition: viewCtrl.hpp:90
void updateCommands(const double &trans_vel, const double &rot_vel)
Update the display of the ROS node.
Definition: teleop.hpp:67
This class defines a state, i.e. a configuration and its (translation and rotation) velocities...
Definition: state.hpp:22
void keyReleaseEvent(QKeyEvent *)
When a key is released, both accelerations stop.
Definition: teleop.hpp:87
This class defines a motion model, with the motion limits.
Definition: motion.hpp:28
void keyPressEvent(QKeyEvent *event)
This widget reacts to key pression.
Definition: teleop.hpp:82
Controller & ctrl
This widget is the GUI of a controller.
Definition: ctrlWdgt.hpp:29
TeleopWidget(QWidget &parent, KbdCtrl &control, const MotionModel &motion_model)
The constructor needs the main window containing this widget, and the ROS node to control...
Definition: teleop.cpp:24
~TeleopWidget()
The destructor needs to be redefined.
Definition: teleop.hpp:54
This class is a Qt widget which allows to control the keyboard controller.
Definition: teleop.hpp:31


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