HiveMind
Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
Interloc Class Reference

#include <Interloc.h>

Inheritance diagram for Interloc:
Inheritance graph
Collaboration diagram for Interloc:
Collaboration graph

Public Member Functions

 Interloc (ILogger &logger, IInterlocManager &interlocManager, IInterlocMessageHandler &messageHandler, ICircularQueue< uint16_t > &positionUpdateOutputQueue, INotificationQueue< InterlocUpdate > &positionUpdateInputQueue)
 
virtual ~Interloc ()=default
 
std::optional< RelativePositiongetRobotPosition (uint16_t robotId) const override
 Returns the last known relative position of a given robot. More...
 
bool isLineOfSight (uint16_t robotId) const override
 Tells if a robot is in line of sight. More...
 
const PositionsTablegetPositionsTable () const override
 Returns the position table for all robots in the swarm. More...
 
void process ()
 Spins the interloc task checking if any updates happened. Processing them and pushing update values to the output queue. More...
 

Static Public Attributes

static constexpr uint8_t INTERLOC_UDPATES_QUEUE_SIZE = 5
 

Private Member Functions

std::optional< uint8_t > getRobotArrayIndex (uint16_t robotId) const
 
void processPositionUpdate (const InterlocUpdate &positionUpdate)
 
void dumpUpdatesHistory ()
 

Static Private Member Functions

static void updateRobotPosition (RelativePosition &positionToUpdate, InterlocUpdate update)
 
static constexpr float filterValue (float oldValue, float newValue, float alpha)
 

Private Attributes

ILoggerm_logger
 
IInterlocManagerm_interlocManager
 
IInterlocMessageHandlerm_messageHandler
 
PositionsTable m_positionsTable
 
ICircularQueue< uint16_t > & m_positionUpdateOutputQueue
 
INotificationQueue< InterlocUpdate > & m_positionUpdateInputQueue
 
std::array< InterlocUpdate, InterlocDumpDTO::MAX_UPDATES_SIZE > m_updatesHistory
 
uint8_t m_updateHistoryIdx
 

Constructor & Destructor Documentation

◆ Interloc()

Interloc::Interloc ( ILogger logger,
IInterlocManager interlocManager,
IInterlocMessageHandler messageHandler,
ICircularQueue< uint16_t > &  positionUpdateOutputQueue,
INotificationQueue< InterlocUpdate > &  positionUpdateInputQueue 
)

◆ ~Interloc()

virtual Interloc::~Interloc ( )
virtualdefault

Member Function Documentation

◆ dumpUpdatesHistory()

void Interloc::dumpUpdatesHistory ( )
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ filterValue()

constexpr float Interloc::filterValue ( float  oldValue,
float  newValue,
float  alpha 
)
staticconstexprprivate
Here is the caller graph for this function:

◆ getPositionsTable()

const PositionsTable & Interloc::getPositionsTable ( ) const
overridevirtual

Returns the position table for all robots in the swarm.

Returns
The position table

Implements IInterloc.

◆ getRobotArrayIndex()

std::optional< uint8_t > Interloc::getRobotArrayIndex ( uint16_t  robotId) const
private
Here is the caller graph for this function:

◆ getRobotPosition()

std::optional< RelativePosition > Interloc::getRobotPosition ( uint16_t  robotId) const
overridevirtual

Returns the last known relative position of a given robot.

Parameters
robotIdThe ID of the robot to get the position
Returns
The relative position of the robot

Implements IInterloc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isLineOfSight()

bool Interloc::isLineOfSight ( uint16_t  robotId) const
overridevirtual

Tells if a robot is in line of sight.

Parameters
robotIdThe ID of the robot to get
Returns
Is in line of sight

Implements IInterloc.

Here is the call graph for this function:

◆ process()

void Interloc::process ( )
virtual

Spins the interloc task checking if any updates happened. Processing them and pushing update values to the output queue.

Implements IInterloc.

Here is the call graph for this function:

◆ processPositionUpdate()

void Interloc::processPositionUpdate ( const InterlocUpdate positionUpdate)
private
Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateRobotPosition()

void Interloc::updateRobotPosition ( RelativePosition positionToUpdate,
InterlocUpdate  update 
)
staticprivate
Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ INTERLOC_UDPATES_QUEUE_SIZE

constexpr uint8_t Interloc::INTERLOC_UDPATES_QUEUE_SIZE = 5
staticconstexpr

◆ m_interlocManager

IInterlocManager& Interloc::m_interlocManager
private

◆ m_logger

ILogger& Interloc::m_logger
private

◆ m_messageHandler

IInterlocMessageHandler& Interloc::m_messageHandler
private

◆ m_positionsTable

PositionsTable Interloc::m_positionsTable
private

◆ m_positionUpdateInputQueue

INotificationQueue<InterlocUpdate>& Interloc::m_positionUpdateInputQueue
private

◆ m_positionUpdateOutputQueue

ICircularQueue<uint16_t>& Interloc::m_positionUpdateOutputQueue
private

◆ m_updateHistoryIdx

uint8_t Interloc::m_updateHistoryIdx
private

◆ m_updatesHistory

std::array<InterlocUpdate, InterlocDumpDTO::MAX_UPDATES_SIZE> Interloc::m_updatesHistory
private

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