Skyward boardcore
Loading...
Searching...
No Matches
Boardcore::HILTransceiver< FlightPhases, SimulatorData, ActuatorData > Class Template Reference

HILTransceiver is a Singleton and provides an easy interface for the control algorithms to send and receive data during a simulation. More...

#include <HILTransceiver.h>

Inheritance diagram for Boardcore::HILTransceiver< FlightPhases, SimulatorData, ActuatorData >:
Collaboration diagram for Boardcore::HILTransceiver< FlightPhases, SimulatorData, ActuatorData >:

Public Member Functions

 HILTransceiver (USART &hilSerial, HILPhasesManager< FlightPhases, SimulatorData, ActuatorData > *hilPhasesManager)
 Construct a serial connection attached to a control algorithm.
 
void setActuatorData (ActuatorData actuatorData)
 sets the actuator data and then wakes up the MatlabTransceiver thread in order to send the data back to the simulator (called by the control algorithm)
 
const SimulatorData * getSensorData () const
 returns the reference of the SimulatorData
 
- Public Member Functions inherited from Boardcore::HILTransceiverBase
 HILTransceiverBase (USART &hilSerial)
 Construct a serial connection attached to a control algorithm.
 
int getLostUpdates () const
 Returns the number of lost updates.
 
int64_t getTimestampSimulatorData () const
 Returns the value in ns of the timestamp of the last received simulatorData.
 
- Public Member Functions inherited from Boardcore::ActiveObject
 ActiveObject (unsigned int stacksize=miosix::STACK_DEFAULT_FOR_PTHREAD, miosix::Priority priority=miosix::MAIN_PRIORITY)
 
virtual ~ActiveObject ()
 
virtual bool start ()
 Start the thread associated with this active object.
 
virtual void stop ()
 Signals the runner thread to terminate and joins the thread.
 
bool isRunning ()
 

Additional Inherited Members

- Protected Member Functions inherited from Boardcore::HILTransceiverBase
void waitActuatorData ()
 Waits for the control algorithm(s) to update actuatorData.
 
- Protected Member Functions inherited from Boardcore::ActiveObject
bool shouldStop ()
 Tells whether or not the ActiveObject should stop its execution.
 
- Protected Attributes inherited from Boardcore::HILTransceiverBase
USARThilSerial
 
bool receivedFirstPacket = false
 
bool updated = false
 
int nLostUpdates = 0
 
int64_t timestampSimulatorData = 0
 
miosix::FastMutex mutex
 
miosix::ConditionVariable condVar
 
PrintLogger logger = Logging::getLogger("HILTransceiver")
 
- Protected Attributes inherited from Boardcore::ActiveObject
miosix::Thread * thread = nullptr
 Gives access to the thread object.
 
std::atomic< bool > stopFlag {false}
 
std::atomic< bool > running {false}
 

Detailed Description

template<class FlightPhases, class SimulatorData, class ActuatorData>
class Boardcore::HILTransceiver< FlightPhases, SimulatorData, ActuatorData >

HILTransceiver is a Singleton and provides an easy interface for the control algorithms to send and receive data during a simulation.

Definition at line 88 of file HILTransceiver.h.

Constructor & Destructor Documentation

◆ HILTransceiver()

template<class FlightPhases , class SimulatorData , class ActuatorData >
Boardcore::HILTransceiver< FlightPhases, SimulatorData, ActuatorData >::HILTransceiver ( USART & hilSerial,
HILPhasesManager< FlightPhases, SimulatorData, ActuatorData > * hilPhasesManager )
inlineexplicit

Construct a serial connection attached to a control algorithm.

Parameters
hilSerialSerial port for the HIL communication.

Definition at line 96 of file HILTransceiver.h.

Member Function Documentation

◆ getSensorData()

template<class FlightPhases , class SimulatorData , class ActuatorData >
const SimulatorData * Boardcore::HILTransceiver< FlightPhases, SimulatorData, ActuatorData >::getSensorData ( ) const
inline

returns the reference of the SimulatorData

Returns
reference to the data simulated by matlab

Definition at line 129 of file HILTransceiver.h.

◆ setActuatorData()

template<class FlightPhases , class SimulatorData , class ActuatorData >
void Boardcore::HILTransceiver< FlightPhases, SimulatorData, ActuatorData >::setActuatorData ( ActuatorData actuatorData)
inline

sets the actuator data and then wakes up the MatlabTransceiver thread in order to send the data back to the simulator (called by the control algorithm)

Parameters
actuatorDatasets the data that will be sent to the simulator

Definition at line 111 of file HILTransceiver.h.


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