delphyne_gui
TeleopPlugin Class Reference

Detailed Description

Implements a teleoperation plugin.

See TeleopPlugin.qml to complete understand how the view is connected to each QProperty. The plugin has a text input in which users must place the topic name of the agent to teleoperate. Topic name should be: <teleop/X> where X is the agent number. The plugin appends an extra "/" at the beginning to match topic names. When "Start Driving" is clicked, use:

  • ↑ to throttle.
  • ↓ to brake.
  • ← to steer left.
  • → to steer right. Note that when either throttling or braking, if ↑ or ↓ are released both values will return to zero. However, that does not happen with the steering control. To "Stop Driving", click again the button.

#include <visualizer/teleop_plugin/teleop_plugin.h>

Inheritance diagram for TeleopPlugin:
[legend]

Public Slots

void OnStartDriving ()
 Callback in Qt thread when start driving is clicked. More...
 
void UpdateSteeringAngle (double sign)
 Updates the steering angle from the plugin UI. More...
 

Signals

void CarNumberChanged ()
 Signals to notify that properties changed. More...
 
void SteeringAngleValueChanged ()
 
void ThrottleValueChanged ()
 
void BrakeValueChanged ()
 
void NewSteeringAngleChanged ()
 
void ThrottleKeyPressedChanged ()
 
void KeepCurrentThrottleChanged ()
 
void BrakeKeyPressedChanged ()
 
void KeepCurrentBrakeChanged ()
 
void IsDrivingChanged ()
 

Public Member Functions

 TeleopPlugin ()
 Constructor. More...
 
void LoadConfig (const tinyxml2::XMLElement *_pluginElem) override
 Loads the plugin configuration. More...
 
Q_INVOKABLE QString BrakeValue () const
 
Q_INVOKABLE QString CarNumber () const
 
Q_INVOKABLE QString SteeringAngleValue () const
 
Q_INVOKABLE QString ThrottleValue () const
 
Q_INVOKABLE bool NewSteeringAngle () const
 
Q_INVOKABLE bool ThrottleKeyPressed () const
 
Q_INVOKABLE bool KeepCurrentThrottle () const
 
Q_INVOKABLE bool BrakeKeyPressed () const
 
Q_INVOKABLE bool KeepCurrentBrake () const
 
Q_INVOKABLE bool IsDriving () const
 
Q_INVOKABLE void SetNewSteeringAngle (bool _newSteeringAngle)
 
Q_INVOKABLE void SetThrottleKeyPressed (bool _throttleKeyPressed)
 
Q_INVOKABLE void SetKeepCurrentThrottle (bool _keepCurrentThrottle)
 
Q_INVOKABLE void SetBrakeKeyPressed (bool _brakeKeyPressed)
 
Q_INVOKABLE void SetKeepCurrentBrake (bool _keepCurrentBrake)
 
Q_INVOKABLE void SetIsDriving (bool _isDriving)
 
Q_INVOKABLE void SetCarNumber (const QString &_carNumber)
 
Q_INVOKABLE void SetSteeringAngleValue (const QString &_steeringAngleValue)
 
Q_INVOKABLE void SetThrottleValue (const QString &_throttleValue)
 
Q_INVOKABLE void SetBrakeValue (const QString &_brakeValue)
 

Protected Member Functions

void timerEvent (QTimerEvent *event) override
 Timer event callback which handles the logic of publishing driving commands. More...
 

Properties

QString carNumber
 
QString steeringAngleValue
 
QString throttleValue
 
QString brakeValue
 
bool newSteeringAngle {false}
 
bool throttleKeyPressed {false}
 
bool keepCurrentThrottle {false}
 
bool brakeKeyPressed {false}
 
bool keepCurrentBrake {false}
 
bool isDriving {false}
 

Constructor & Destructor Documentation

◆ TeleopPlugin()

Constructor.

Starts the timer and connects it to timerEvent().

Member Function Documentation

◆ BrakeKeyPressed()

Q_INVOKABLE bool BrakeKeyPressed ( ) const

◆ BrakeKeyPressedChanged

void BrakeKeyPressedChanged ( )
signal

◆ BrakeValue()

Q_INVOKABLE QString BrakeValue ( ) const

◆ BrakeValueChanged

void BrakeValueChanged ( )
signal

◆ CarNumber()

Q_INVOKABLE QString CarNumber ( ) const

◆ CarNumberChanged

void CarNumberChanged ( )
signal

Signals to notify that properties changed.

◆ IsDriving()

Q_INVOKABLE bool IsDriving ( ) const

◆ IsDrivingChanged

void IsDrivingChanged ( )
signal

◆ KeepCurrentBrake()

Q_INVOKABLE bool KeepCurrentBrake ( ) const

◆ KeepCurrentBrakeChanged

void KeepCurrentBrakeChanged ( )
signal

◆ KeepCurrentThrottle()

Q_INVOKABLE bool KeepCurrentThrottle ( ) const

◆ KeepCurrentThrottleChanged

void KeepCurrentThrottleChanged ( )
signal

◆ LoadConfig()

void LoadConfig ( const tinyxml2::XMLElement *  _pluginElem)
override

Loads the plugin configuration.

Expects to find car_number only which is translated to

◆ NewSteeringAngle()

Q_INVOKABLE bool NewSteeringAngle ( ) const

◆ NewSteeringAngleChanged

void NewSteeringAngleChanged ( )
signal

◆ OnStartDriving

void OnStartDriving ( )
slot

Callback in Qt thread when start driving is clicked.

◆ SetBrakeKeyPressed()

Q_INVOKABLE void SetBrakeKeyPressed ( bool  _brakeKeyPressed)

◆ SetBrakeValue()

Q_INVOKABLE void SetBrakeValue ( const QString &  _brakeValue)

◆ SetCarNumber()

Q_INVOKABLE void SetCarNumber ( const QString &  _carNumber)

◆ SetIsDriving()

Q_INVOKABLE void SetIsDriving ( bool  _isDriving)

◆ SetKeepCurrentBrake()

Q_INVOKABLE void SetKeepCurrentBrake ( bool  _keepCurrentBrake)

◆ SetKeepCurrentThrottle()

Q_INVOKABLE void SetKeepCurrentThrottle ( bool  _keepCurrentThrottle)

◆ SetNewSteeringAngle()

Q_INVOKABLE void SetNewSteeringAngle ( bool  _newSteeringAngle)

◆ SetSteeringAngleValue()

Q_INVOKABLE void SetSteeringAngleValue ( const QString &  _steeringAngleValue)

◆ SetThrottleKeyPressed()

Q_INVOKABLE void SetThrottleKeyPressed ( bool  _throttleKeyPressed)

◆ SetThrottleValue()

Q_INVOKABLE void SetThrottleValue ( const QString &  _throttleValue)

◆ SteeringAngleValue()

Q_INVOKABLE QString SteeringAngleValue ( ) const

◆ SteeringAngleValueChanged

void SteeringAngleValueChanged ( )
signal

◆ ThrottleKeyPressed()

Q_INVOKABLE bool ThrottleKeyPressed ( ) const

◆ ThrottleKeyPressedChanged

void ThrottleKeyPressedChanged ( )
signal

◆ ThrottleValue()

Q_INVOKABLE QString ThrottleValue ( ) const

◆ ThrottleValueChanged

void ThrottleValueChanged ( )
signal

◆ timerEvent()

void timerEvent ( QTimerEvent *  event)
overrideprotected

Timer event callback which handles the logic of publishing driving commands.

◆ UpdateSteeringAngle

void UpdateSteeringAngle ( double  sign)
slot

Updates the steering angle from the plugin UI.

Parameters
signIt should be either 1.0 or -1.0 to move the handle wheel.

Property Documentation

◆ brakeKeyPressed

bool brakeKeyPressed {false}
readwrite

◆ brakeValue

QString brakeValue
readwrite

◆ carNumber

QString carNumber
readwrite

◆ isDriving

bool isDriving {false}
readwrite

◆ keepCurrentBrake

bool keepCurrentBrake {false}
readwrite

◆ keepCurrentThrottle

bool keepCurrentThrottle {false}
readwrite

◆ newSteeringAngle

bool newSteeringAngle {false}
readwrite

◆ steeringAngleValue

QString steeringAngleValue
readwrite

◆ throttleKeyPressed

bool throttleKeyPressed {false}
readwrite

◆ throttleValue

QString throttleValue
readwrite

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