Fang-Robotics-MCB
Fang Robotics Team Codebase
Loading...
Searching...
No Matches
fang::remote::FlySky Class Reference

#include <fly_sky.hpp>

Inheritance diagram for fang::remote::FlySky:
Collaboration diagram for fang::remote::FlySky:

Public Types

enum class  Channel {
  rightHorizontal = 0 , rightVertical = 1 , leftVertical = 2 , leftHorizontal = 3 ,
  wheelA = 4 , wheelB = 5 , switchC = 6 , switchD = 7 ,
  switchA = 8 , switchB = 9
}
 
enum class  Switch {
  A , B , C , D ,
  wheelA , wheelB
}
 
using TapRemote = tap::communication::serial::Remote
 
using ChannelValues = std::array< double, communication::ibus::kChannelCount >
 

Public Member Functions

 FlySky (tap::control::CommandMapper &commandMapper, coolSerial::ByteQueue &byteQueue)
 
void update ()
 
void channelDataFound (const communication::ibus::ChannelData &channelData)
 
TapRemote::SwitchState getTaprootSwitch (TapRemote::Switch switchId) const
 
TapRemote::SwitchState getSwitch (Switch switchId) const
 
double getChannel (Channel channel) const
 

Detailed Description

Based off of the information here https://github.com/GOFIRST-Robotics/northstar-robomaster/blob/main/northstar-robomaster-project/src/communication/serial/fly_sky.hpp

Note that Switch B updates the commandMappe LEFT_SWICH and Switch C updates the RIGHT_SWITCH WARNING: switch A, B, and D can only be up or down, switch C is the only one that can have a center option.

TODO: Consider combining switch A and B to provide for up, middle, and down, then a 4th default state

Member Typedef Documentation

◆ ChannelValues

using fang::remote::FlySky::ChannelValues = std::array<double, communication::ibus::kChannelCount>

◆ TapRemote

Member Enumeration Documentation

◆ Channel

enum class fang::remote::FlySky::Channel
strong
Enumerator
rightHorizontal 
rightVertical 
leftVertical 
leftHorizontal 
wheelA 
wheelB 
switchC 
switchD 
switchA 
switchB 

◆ Switch

enum class fang::remote::FlySky::Switch
strong

Note: the reason we are breaking away from the normal enum class naming convention is because they are single letters

Switch::A looks clearer than Switch::a

k is not needed for it is an enum class

Switch::switchA just looks redundant

Enumerator
wheelA 
wheelB 

Constructor & Destructor Documentation

◆ FlySky()

fang::remote::FlySky::FlySky ( tap::control::CommandMapper commandMapper,
coolSerial::ByteQueue &  byteQueue 
)

The commandMapper is what listens for remoteStateChanges in order to know what mappings to trigger generally, you are using the one in the Drivers singleton. (As much as taproot locked some architectural elements to use drivers everywhere, requiring a singleton CommandMaper CommandScheduler, this code is designed to use only what it needs for ease of testing and minimizing coupling.)

Member Function Documentation

◆ channelDataFound()

void fang::remote::FlySky::channelDataFound ( const communication::ibus::ChannelData channelData)
virtual

◆ getChannel()

double fang::remote::FlySky::getChannel ( Channel  channel) const

◆ getSwitch()

FlySky::TapRemote::SwitchState fang::remote::FlySky::getSwitch ( Switch  switchId) const

This can access all switches

◆ getTaprootSwitch()

FlySky::TapRemote::SwitchState fang::remote::FlySky::getTaprootSwitch ( TapRemote::Switch  switchId) const

This is required to inform the command mapper of switch state changes.

It can only access switch B and switch C (LEFT_SWITCH and RIGHT_SWITCH) respectively

◆ update()

void fang::remote::FlySky::update ( )

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