Public Member Functions | Protected Slots | Private Slots | Private Attributes | List of all members
TeleopWidget Class Reference

This class is a Qt widget which allows to control the keyboard controller. More...

#include <teleop.hpp>

Inheritance diagram for TeleopWidget:
Inheritance graph
[legend]

Public Member Functions

 TeleopWidget (QWidget &parent, KbdCtrl &control, const MotionModel &motion_model)
 The constructor needs the main window containing this widget, and the ROS node to control. More...
 
void updateCommands (const double &trans_vel, const double &rot_vel)
 Update the display of the ROS node. More...
 
void updateState (const State &state)
 Update the display of the odometry. More...
 
QWidget & widget ()
 Returns the widget used to display the behaviour. More...
 
 ~TeleopWidget ()
 The destructor needs to be redefined. More...
 
- Public Member Functions inherited from ControlWidget
void keyPressed (QKeyEvent *event)
 Handles Quit/eXit shortcuts. More...
 
void keyReleased (QKeyEvent *)
 Key release can be handled by inheritors. More...
 
virtual ~ControlWidget ()
 The destructor needs to be defined as virtual. More...
 

Protected Slots

void keyPressEvent (QKeyEvent *event)
 This widget reacts to key pression. More...
 
void keyReleaseEvent (QKeyEvent *)
 When a key is released, both accelerations stop. More...
 

Private Slots

void react (const int &key)
 This widget reacts to commands, which are Qt key values. More...
 
void stopAcc ()
 Stops the acceleration of the ROS node. More...
 

Private Attributes

QSignalMapper mapper
 The Qt object mapping the widget's buttons with the parameter transmitted to react(). More...
 
ViewCtrlWdgt vel_drawing
 This widget draws the velocities' evolutions. More...
 

Additional Inherited Members

- Protected Member Functions inherited from ControlWidget
 ControlWidget (Controller &controller, const MotionModel &motion_model)
 The constructor is used by inheritors. More...
 
- Protected Attributes inherited from ControlWidget
Controllerctrl
 This widget is the GUI of a controller. More...
 
const MotionModelmodel
 The motion model and its limits values. More...
 

Detailed Description

This class is a Qt widget which allows to control the keyboard controller.

This widget reacts to key pression, and modify accordingly the controller velocities (with the keyboard controller acceleration or stop methods).

Due to a bug (key pressions were not detected), buttons were added. A more precise method could be used later.

Since
0.2.1

Definition at line 31 of file teleop.hpp.

Constructor & Destructor Documentation

TeleopWidget::TeleopWidget ( QWidget &  parent,
KbdCtrl control,
const MotionModel motion_model 
)

The constructor needs the main window containing this widget, and the ROS node to control.

Parameters
parentThe containing graphical object,
controlthe controller whose behaviour is shown,
motion_modelthe motion model.

Definition at line 24 of file teleop.cpp.

TeleopWidget::~TeleopWidget ( )
inline

The destructor needs to be redefined.

Definition at line 54 of file teleop.hpp.

Member Function Documentation

void TeleopWidget::keyPressEvent ( QKeyEvent *  event)
inlineprotectedslot

This widget reacts to key pression.

The key associated to actions are the following: the application can be stopped either by pressing 'q' (Quit) or 'x' (eXit). The other possibilities are those of react method.

Parameters
eventThe event associated to a key pression.

See QKeyEvent.

Definition at line 82 of file teleop.hpp.

void TeleopWidget::keyReleaseEvent ( QKeyEvent *  )
inlineprotectedslot

When a key is released, both accelerations stop.

Definition at line 87 of file teleop.hpp.

void TeleopWidget::react ( const int &  key)
privateslot

This widget reacts to commands, which are Qt key values.

The commands are currently fixed, there will be later a dialog to change the values associated to each action. These commands modify the controller velocities (with the keyboard controller acceleration, stop, stop translation or stop rotation methods). The robot can be stopped (zero velocities) by pressing either '0' or 'End'. The robot can otherwise change its velocity in two ways:

78 9
45 6
12 3
  or  
Home

Directions are in the robot's frame, up meaning forward (acceleration) while down means backward (deceleration). Center ('5' or 'Home') stops the robot's rotation.

Parameters
keyThe command, one of Qt key values.

See QKeyEvent.

Definition at line 111 of file teleop.cpp.

void TeleopWidget::stopAcc ( )
inlineprivateslot

Stops the acceleration of the ROS node.

Since
0.2.2

Definition at line 91 of file teleop.hpp.

void TeleopWidget::updateCommands ( const double &  trans_vel,
const double &  rot_vel 
)
inlinevirtual

Update the display of the ROS node.

Parameters
trans_velthe translation velocity sent to ROS,
rot_velthe rotation velocity sent to ROS.
Since
0.3.1

Implements ControlWidget.

Definition at line 67 of file teleop.hpp.

void TeleopWidget::updateState ( const State state)
inlinevirtual

Update the display of the odometry.

Parameters
stateThe state of the robot.
Since
0.3.1

Implements ControlWidget.

Definition at line 63 of file teleop.hpp.

QWidget& TeleopWidget::widget ( )
inlinevirtual

Returns the widget used to display the behaviour.

Since
0.3.0

See Qt widget.

Implements ControlWidget.

Definition at line 60 of file teleop.hpp.

Member Data Documentation

QSignalMapper TeleopWidget::mapper
private

The Qt object mapping the widget's buttons with the parameter transmitted to react().

Definition at line 41 of file teleop.hpp.

ViewCtrlWdgt TeleopWidget::vel_drawing
private

This widget draws the velocities' evolutions.

Since
0.2.2

Definition at line 36 of file teleop.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