Definition: IInterlocManager.h:16
void processPositionUpdate(const InterlocUpdate &positionUpdate)
Definition: Interloc.cpp:39
INotificationQueue< InterlocUpdate > & m_positionUpdateInputQueue
Definition: Interloc.h:45
Definition: IInterloc.h:10
virtual uint16_t getUUId() const =0
Returns the unique id associated with the board.
void dumpUpdatesHistory()
Definition: Interloc.cpp:120
virtual void configureTWRCalibration(uint16_t distanceCalibCm)=0
Sets the targeted distance for calibration.
bool isLineOfSight(uint16_t robotId) const override
Tells if a robot is in line of sight.
Definition: Interloc.cpp:29
LogRet
The return value of the logger.
Definition: ILogger.h:23
ThreadSafeQueue< uint16_t > & getInterlocUpdateOutputQueue()
get interloc position update msg queu
Definition: InterlocContainer.cpp:29
PositionsTable m_positionsTable
Definition: Interloc.h:43
std::optional< bool > m_isInLineOfSight
Definition: InterlocUpdate.h:20
float m_angleRealMean
Definition: RelativePosition.h:19
std::optional< float > m_distance
Distance in meters.
Definition: InterlocUpdate.h:13
virtual LogRet log(LogLevel level, const char *format,...)=0
Logs if the provided level is higher than the current log level (Thread-safe)
Definition: IInterlocMessageHandler.h:6
virtual bool sendInterlocDump(InterlocUpdate *updatesHistory, uint8_t updatesLength)=0
Sends a history of interloc updates back to the host.
bool handleMessage(const MessageDTO &dto)
Definition: InterlocMessageHandler.cpp:47
static InterlocRawAngleDataDTO constructRawDataMessage(BspInterlocRawAngleData &data, uint32_t fromId, uint8_t numFrames)
Definition: InterlocMessageHandler.cpp:164
bool m_isInLineOfSight
Definition: RelativePosition.h:22
std::optional< RelativePosition > getRobotPosition(uint16_t robotId) const override
Returns the last known relative position of a given robot.
Definition: Interloc.cpp:19
IInterlocMessageHandler & getInterlocMessageHandler()
Definition: InterlocContainer.cpp:19
bool getDumpEnabled() const override
Retrieves a flag to know if data dumps to the host should be done or not.
Definition: InterlocMessageHandler.cpp:202
Definition: BspInterlocAngleRawData.h:24
std::array< GetNeighborResponseDTO, InterlocDumpDTO::MAX_UPDATES_SIZE > m_updateDtoArray
Definition: InterlocMessageHandler.h:40
void delay()
wait for a certain delay Signature delay(arg1) Warning this function make the whole VM sleep which ca...
Definition: BittyBuzzUserFunctions.cpp:327
#define ALPHA
Definition: Interloc.cpp:4
LogLevel
The log level used for the logger.
Definition: ILogger.h:9
ILogger & m_logger
Definition: InterlocMessageHandler.h:32
Interloc(ILogger &logger, IInterlocManager &interlocManager, IInterlocMessageHandler &messageHandler, ICircularQueue< uint16_t > &positionUpdateOutputQueue, INotificationQueue< InterlocUpdate > &positionUpdateInputQueue)
Definition: Interloc.cpp:6
uint8_t m_updateHistoryIdx
Definition: Interloc.h:48
bool sendInterlocDump(InterlocUpdate *updatesHistory, uint8_t updatesLength) override
Sends a history of interloc updates back to the host.
Definition: InterlocMessageHandler.cpp:204
virtual void setInterlocManagerState(InterlocStateDTO state)=0
#define INVALID_INTERLOC_FLOAT
Definition: InterlocMessageHandler.cpp:6
INotificationQueue< InterlocUpdate > & getInterlocUpdateInputQueue()
Gets a queue in which to insert raw position updates from the BSP layer.
Definition: InterlocContainer.cpp:37
ICircularQueue< MessageDTO > & m_inputQueue
Definition: InterlocMessageHandler.h:35
NotificationQueue< MessageDTO > & getRemoteMsgQueue()
get the remote message queue
Definition: MessageHandlerContainer.cpp:57
Definition: InterlocMessageHandler.h:13
float m_angle
Angle of other agent in current agent frame (in degrees)
Definition: RelativePosition.h:17
static void rawAngleDataCallbackStatic(void *context, BspInterlocRawAngleData &data)
Definition: InterlocMessageHandler.cpp:192
void stateChangeCallback(InterlocStateDTO previousState, InterlocStateDTO newState)
Definition: InterlocMessageHandler.cpp:111
IInterlocManager & getInterlocManager()
Returns an instance of the interloc manager.
Definition: BSPContainer.cpp:24
std::optional< float > m_angleOfArrival
Angle of the distant agent in the frame of the current agent (in degrees)
Definition: InterlocUpdate.h:18
bool m_dumpsEnabled
Definition: InterlocMessageHandler.h:43
uint16_t m_positionsLength
Definition: IInterloc.h:12
ICircularQueue< MessageDTO > & m_remoteQueue
Definition: InterlocMessageHandler.h:37
uint16_t m_robotId
Definition: InterlocUpdate.h:8
void ensureSendMessage(MessageDTO &msg)
Definition: InterlocMessageHandler.cpp:156
virtual void updateAngleCalculatorParameters(const ConfigureAngleParametersDTO &newParams)=0
Definition: InterlocUpdate.h:7
void process()
Spins the interloc task checking if any updates happened. Processing them and pushing update values t...
Definition: Interloc.cpp:98
virtual void configureAngleCalibration(uint32_t numberOfFrames)=0
Sets the number of frames to accumulate when in angle calibration mode.
Logger & getLogger()
Return a reference to the global logger.
Definition: LoggerContainer.cpp:5
virtual bool getDumpEnabled() const =0
Retrieves a flag to know if data dumps to the host should be done or not.
static void stateChangeCallbackStatic(void *context, InterlocStateDTO previousState, InterlocStateDTO newState)
Definition: InterlocMessageHandler.cpp:197
float atan2(float y, float x)
calculate the arc of x/y
Definition: Math.cpp:20
IInterlocMessageHandler & m_messageHandler
Definition: Interloc.h:41
bool handleStateChangeMessage(const SetInterlocStateDTO dto) const
Definition: InterlocMessageHandler.cpp:75
ILogger & m_logger
Definition: Interloc.h:39
std::array< InterlocUpdate, InterlocDumpDTO::MAX_UPDATES_SIZE > m_updatesHistory
Definition: Interloc.h:47
A logger class with basic logging capabilities.
Definition: ILogger.h:35
uint32_t m_framesLength
Definition: BspInterlocAngleRawData.h:26
ICircularQueue< MessageDTO > & getQueueForDestination(uint16_t destinationId) const
Definition: InterlocMessageHandler.cpp:67
IBSP & getBSP()
Returns an instance of the platform dependent BSP.
Definition: BSPContainer.cpp:13
IInterloc & getInterloc()
Definition: InterlocContainer.cpp:12
std::array< BspInterlocFrameAngleRawData, MAX_ANGLE_FRAMES > m_frames
Definition: BspInterlocAngleRawData.h:27
ICircularQueue< uint16_t > & m_positionUpdateOutputQueue
Definition: Interloc.h:44
Definition: RelativePosition.h:6
bool m_resetDumps
Definition: InterlocUpdate.h:22
NotificationQueue< MessageDTO > & getInterlocMsgQueue()
get the interloc message queue
Definition: MessageHandlerContainer.cpp:70
bool processMessage() override
Processes the next message in the queue.
Definition: InterlocMessageHandler.cpp:29
Definition: Interloc.h:18
ICircularQueue< MessageDTO > & m_hostQueue
Definition: InterlocMessageHandler.h:36
Definition: IInterloc.h:15
void rawAngleDataCallback(BspInterlocRawAngleData &data)
Definition: InterlocMessageHandler.cpp:127
NotificationQueue< MessageDTO > & getHostMsgQueue()
get the host message queue
Definition: MessageHandlerContainer.cpp:44
virtual void setInterlocManagerRawAngleDataCallback(interlocRawAngleDataCallbackFunction_t callback, void *context)=0
std::array< RelativePosition, MAX_AGENTS_IN_SWARM > m_positions
Definition: IInterloc.h:11
std::optional< uint8_t > getRobotArrayIndex(uint16_t robotId) const
Definition: Interloc.cpp:56
uint16_t m_messageSourceId
Definition: InterlocMessageHandler.h:42
uint16_t m_robotId
Definition: RelativePosition.h:7
INotificationQueue< InterlocUpdate > & m_interlocPositionUpdateQueue
Definition: InterlocMessageHandler.h:38
IBSP & m_bsp
Definition: InterlocMessageHandler.h:34
bool handleConfigurationMessage(const InterlocConfigurationDTO &dto)
Definition: InterlocMessageHandler.cpp:85
InterlocMessageHandler(ILogger &logger, IInterlocManager &interlocManager, IBSP &bsp, ICircularQueue< MessageDTO > &inputQueue, ICircularQueue< MessageDTO > &hostQueue, ICircularQueue< MessageDTO > &remoteQueue, INotificationQueue< InterlocUpdate > &interlocPositionUpdateQueue)
Definition: InterlocMessageHandler.cpp:8
const PositionsTable & getPositionsTable() const override
Returns the position table for all robots in the swarm.
Definition: Interloc.cpp:96
float m_angleImaginaryMean
Definition: RelativePosition.h:20
static void updateRobotPosition(RelativePosition &positionToUpdate, InterlocUpdate update)
Definition: Interloc.cpp:67
#define MAX_AGENTS_IN_SWARM
Template file used by CMake to provide default or user-provided values for the settings.
Definition: InterlocSettings.in.h:10
virtual void setInterlocManagerStateChangeCallback(interlocManagerStateChangeCallbackFunction_t callback, void *context)=0
static constexpr float filterValue(float oldValue, float newValue, float alpha)
Definition: Interloc.cpp:130
virtual ~ILogger()=default
void cos()
Calculates the cosine Signature cos(arg1)
Definition: BittyBuzzMathFunctions.cpp:181
float m_distance
Distance in meters.
Definition: RelativePosition.h:12
constexpr uint16_t gc_interlocPosUpdateMaxSize
Definition: InterlocContainer.cpp:10
void sin()
Calculates the sine Signature sin(arg1)
Definition: BittyBuzzMathFunctions.cpp:168
IInterlocManager & m_interlocManager
Definition: InterlocMessageHandler.h:33