Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
tap::communication::serial::Remote Class Reference

#include <remote.hpp>

Public Types

enum class  Channel {
  RIGHT_HORIZONTAL , RIGHT_VERTICAL , LEFT_HORIZONTAL , LEFT_VERTICAL ,
  WHEEL
}
 
enum class  Switch { LEFT_SWITCH , RIGHT_SWITCH }
 
enum class  SwitchState { UNKNOWN = 0 , UP = 1 , DOWN = 2 , MID = 3 }
 
enum class  Key {
  W = 0 , S , A , D ,
  SHIFT , CTRL , Q , E ,
  R , F , G , Z ,
  X , C , V , B
}
 

Public Member Functions

 Remote (Drivers *drivers)
 
mockable ~Remote ()=default
 
mockable void initialize ()
 
mockable void read ()
 
mockable bool isConnected () const
 
mockable float getChannel (Channel ch) const
 
mockable SwitchState getSwitch (Switch sw) const
 
mockable int16_t getMouseX () const
 
mockable int16_t getMouseY () const
 
mockable int16_t getMouseZ () const
 
mockable bool getMouseL () const
 
mockable bool getMouseR () const
 
mockable bool keyPressed (Key key) const
 
mockable uint32_t getUpdateCounter () const
 

Detailed Description

A unique UART handler that uses timing in leu of DBUS communication (modm does not support DBUS) to interact with the DR16 receiver.

Information for implementation was translated from a user manual for the DR16 that was only available in Chinese. AI-Translated version of document available here: https://drive.google.com/file/d/1-ZGe4mXVhxP4IEmHccphnzKzYWJyw3C3/view?usp=sharing

Member Enumeration Documentation

◆ Channel

Specifies a particular joystick.

Enumerator
RIGHT_HORIZONTAL 
RIGHT_VERTICAL 
LEFT_HORIZONTAL 
LEFT_VERTICAL 
WHEEL 

◆ Key

A list of the particular keys to interact with, in bit order.

Enumerator
SHIFT 
CTRL 

◆ Switch

Specifies a particular switch.

Enumerator
LEFT_SWITCH 
RIGHT_SWITCH 

◆ SwitchState

Different switch orientations.

Enumerator
UNKNOWN 
UP 
DOWN 
MID 

Constructor & Destructor Documentation

◆ Remote()

tap::communication::serial::Remote::Remote ( Drivers drivers)
inline

◆ ~Remote()

mockable tap::communication::serial::Remote::~Remote ( )
default

Member Function Documentation

◆ getChannel()

float tap::communication::serial::Remote::getChannel ( Channel  ch) const
Returns
The value of the given channel, between [-1, 1].

◆ getMouseL()

mockable bool tap::communication::serial::Remote::getMouseL ( ) const
inline
Returns
The current mouse l value.

◆ getMouseR()

mockable bool tap::communication::serial::Remote::getMouseR ( ) const
inline
Returns
The current mouse r value.

◆ getMouseX()

mockable int16_t tap::communication::serial::Remote::getMouseX ( ) const
inline
Returns
The current mouse x value.

◆ getMouseY()

mockable int16_t tap::communication::serial::Remote::getMouseY ( ) const
inline
Returns
The current mouse y value.

◆ getMouseZ()

mockable int16_t tap::communication::serial::Remote::getMouseZ ( ) const
inline
Returns
The current mouse z value.

◆ getSwitch()

Remote::SwitchState tap::communication::serial::Remote::getSwitch ( Switch  sw) const
Returns
The state of the given switch.

◆ getUpdateCounter()

uint32_t tap::communication::serial::Remote::getUpdateCounter ( ) const
Returns
the number of times remote info has been received.

◆ initialize()

void tap::communication::serial::Remote::initialize ( )

Enables and initializes bound_ports::REMOTE_SERIAL_UART_PORT.

◆ isConnected()

bool tap::communication::serial::Remote::isConnected ( ) const
Returns
true if the remote is connected, false otherwise.
Note
A timer is used to determine if the remote is disconnected, so expect a second or so of delay from disconnecting the remote to this function saying the remote is disconnected.

◆ keyPressed()

mockable bool tap::communication::serial::Remote::keyPressed ( Key  key) const
inline
Returns
true if the given key is pressed, false otherwise.

◆ read()

void tap::communication::serial::Remote::read ( )

Reads/parses the current buffer and updates the current remote info state and CommandMapper state.


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