Go to the documentation of this file. 1 #ifndef __IINTERLOC_H__
2 #define __IINTERLOC_H__
5 #include "InterlocSettings.h"
11 std::array<RelativePosition, MAX_AGENTS_IN_SWARM>
m_positions;
22 virtual std::optional<RelativePosition>
getRobotPosition(uint16_t robotId)
const = 0;
44 #endif //__IINTERLOC_H__
~LedTest() override=default
uint8_t m_readBackBuffer[40]
Definition: DecawaveTests.cpp:99
tf2_ros::Buffer m_tfBuffer
Definition: InterlocManager.h:39
void setHexDisplay(uint8_t value) override
Sets the hex display to a given 8 bit value (not available on the HiveSight)
Definition: UserInterface.cpp:92
BaseTask< 2 *configMINIMAL_STACK_SIZE > m_rosWatchTask
Definition: BSP.h:24
Definition: IInterlocManager.h:16
Definition: InterlocManager.h:12
float log10(float x)
Calculates the logarithm base 10.
Definition: Math.cpp:32
Definition: IInterloc.h:10
void sqrt()
Calculates the square root Signature sqrt(arg1)
Definition: BittyBuzzMathFunctions.cpp:156
int printLine(const char *format,...) override
Provides an interface to print a line to the console or serial port. Flushes the input and adds a new...
Definition: UserInterface.cpp:70
virtual uint16_t getUUId() const =0
Returns the unique id associated with the board.
std::optional< TCPClient > createTCPClient(const char *address, uint32_t port, ILogger &logger)
Definition: SocketFactory.cpp:8
void log()
Calculates the natural logarithm (ln) Signature log(arg1)
Definition: BittyBuzzMathFunctions.cpp:91
ConnectionType getType() const override
Tells the type of the connection interface.
Definition: TCPServer.cpp:93
virtual std::optional< RelativePosition > getRobotPosition(uint16_t robotId) const =0
Returns the last known relative position of a given robot.
Definition: TCPServer.h:43
bool isConnected() const override
Tells if interface is connected and functionning.
Definition: TCPClient.cpp:21
float ln(float x)
Calculates the natural logarithm.
Definition: Math.cpp:30
bool receive(uint8_t *data, uint16_t length) override
Definition: TCPClient.cpp:9
char ** m_argv
Definition: IBSP.h:31
int main(int argc, char **argv)
Definition: HardwareTests.cpp:8
std::optional< bool > m_isInLineOfSight
Definition: InterlocUpdate.h:20
static tf2::Stamped< tf2::Transform > getHiveboardTf(const geometry_msgs::Pose &poseWorldFrame, const geometry_msgs::TransformStamped &hiveboardToRobotTf)
Definition: InterlocManager.cpp:28
virtual const PositionsTable & getPositionsTable() const =0
Returns the position table for all robots in the swarm.
float fmin(float x, float y)
Return the minimum of it's arguments, either x or y.
Definition: Math.cpp:48
std::mt19937 m_rng
Definition: BSP.h:26
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)
ConnectionType
Definition: ICommInterface.h:6
void flush() override
Adds a newline and flushes the input to the serial port.
Definition: UserInterface.cpp:37
LedTest(const char *taskName, UBaseType_t priority)
Definition: DecawaveTests.cpp:137
float fabs(float x)
Return the absolute value.
Definition: Math.cpp:50
DecawaveArray & g_decaArray
Definition: DecawaveTests.cpp:11
IUserInterface & getUserInterface()
Returns an instance of the platform dependent UserInterface.
Definition: BSPContainer.cpp:19
float floor(float x)
Floor x downward.
Definition: Math.cpp:38
LED
LED present on the board.
Definition: IUserInterface.h:22
ILogger & m_logger
Definition: DecawaveTests.cpp:143
uint16_t getUUId() const override
Returns the unique id associated with the board.
Definition: BSP.cpp:40
ILogger & m_logger
Definition: InterlocManager.h:34
ILogger & m_logger
Definition: TCPClient.h:31
BSP()
Definition: BSP.cpp:23
void closeClient()
Definition: TCPServer.cpp:116
void(* interlocRawAngleDataCallbackFunction_t)(void *instance, BspInterlocRawAngleData &rawAngleData)
Definition: IInterlocManager.h:13
~TxTask() override=default
void(* interlocManagerStateChangeCallbackFunction_t)(void *instance, InterlocStateDTO previousState, InterlocStateDTO newState)
Definition: IInterlocManager.h:10
Definition: DecawaveTests.cpp:13
void updateAngleCalculatorParameters(const ConfigureAngleParametersDTO &newParams) override
Definition: InterlocManager.cpp:168
void delay()
wait for a certain delay Signature delay(arg1) Warning this function make the whole VM sleep which ca...
Definition: BittyBuzzUserFunctions.cpp:327
int m_addressLength
Definition: TCPServer.h:42
LogLevel
The log level used for the logger.
Definition: ILogger.h:9
void setInterlocManagerRawAngleDataCallback(interlocRawAngleDataCallbackFunction_t callback, void *context) override
Definition: InterlocManager.cpp:162
float ceil(float x)
Round x upward.
Definition: Math.cpp:36
float tan(float x)
calculate the tangent
Definition: Math.cpp:12
void log2()
Calculates the logarithm base 2 Signature log2(arg1)
Definition: BittyBuzzMathFunctions.cpp:105
void setInterlocManagerState(InterlocStateDTO state) override
Definition: InterlocManager.cpp:150
Definition: DecawaveTests.cpp:48
ros::Subscriber m_sub
Definition: InterlocManager.h:35
void setInterlocManagerStateChangeCallback(interlocManagerStateChangeCallbackFunction_t callback, void *context) override
Definition: InterlocManager.cpp:156
std::string uiStateToString()
Definition: UserInterface.cpp:114
#define ROBOT_CENTER_SUFFIX
Definition: InterlocManager.cpp:10
bool receive(uint8_t *buffer, uint16_t length) override
Definition: TCPServer.cpp:71
uint8_t m_writeBuffer[40]
Definition: DecawaveTests.cpp:98
std::array< ros::Subscriber, g_nbrLED > m_buttonSubscribers
Definition: UserInterface.h:43
int m_numTransmits
Definition: DecawaveTests.cpp:25
std::optional< geometry_msgs::TransformStamped > getHiveBoardTransform(const std::string &agentName)
Definition: InterlocManager.cpp:51
void setLed(LED led, bool state) override
Sets an LED on or off.
Definition: UserInterface.cpp:88
void rosWatcher(void *param)
Task that kills OS when ROS node is stopped.
Definition: BSP.cpp:13
void configureAngleCalibration(uint32_t numberOfFrames) override
Sets the number of frames to accumulate when in angle calibration mode.
Definition: InterlocManager.cpp:154
INotificationQueue< InterlocUpdate > & getInterlocUpdateInputQueue()
Gets a queue in which to insert raw position updates from the BSP layer.
Definition: InterlocContainer.cpp:37
float round(float x)
Round x.
Definition: Math.cpp:42
int m_numWrites
Definition: DecawaveTests.cpp:100
Definition: TCPClient.h:12
void tan()
Calculates the tengent Signature tan(arg1)
Definition: BittyBuzzMathFunctions.cpp:194
Button
Buttons present on the board.
Definition: IUserInterface.h:16
uint8_t m_hexDisplay
Definition: UserInterface.h:19
float asin(float x)
calculate the arc sine
Definition: Math.cpp:16
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
void asin()
Calculates the arc sine Signature asin(arg1)
Definition: BittyBuzzMathFunctions.cpp:206
void abs()
Calculates the absolute value Signature abs(arg1)
Definition: BittyBuzzMathFunctions.cpp:33
std::shared_ptr< ros::NodeHandle > m_rosNodeHandle
Definition: BSP.h:23
float cos(float x)
calculate the cosine
Definition: Math.cpp:8
bool send(const uint8_t *buffer, uint16_t length) override
Definition: TCPServer.cpp:61
void exp()
Calculates e^x Signature exp(x)
Definition: BittyBuzzMathFunctions.cpp:144
RgbColor
Possible colors obtainable with an RGB LED.
Definition: IUserInterface.h:11
int m_port
Definition: TCPServer.h:40
uint16_t m_positionsLength
Definition: IInterloc.h:12
SpiTest(const char *taskName, UBaseType_t priority)
Definition: DecawaveTests.cpp:91
uint16_t m_robotId
Definition: InterlocUpdate.h:8
int m_argc
Definition: IBSP.h:30
int abs(int x)
Return the absolute value.
Definition: Math.cpp:52
ILogger & m_logger
Definition: DecawaveTests.cpp:56
const IBSP & m_bsp
Definition: UserInterface.h:45
bool isConnected() const override
Tells if interface is connected and functionning.
Definition: TCPServer.cpp:82
ILogger & m_logger
Definition: DecawaveTests.cpp:97
Definition: InterlocUpdate.h:7
float fmax(float x, float y)
Return the larger of it's arguments, either x or y.
Definition: Math.cpp:46
#define HIVEBOARD_SUFFIX
Definition: InterlocManager.cpp:11
uint16_t getBBZVMStepDelayMs()
Get the delay between each steps of the vm.
Definition: SettingsContainer.cpp:53
std::string m_accumulatedString
Definition: UserInterface.h:46
const int m_socketFd
Definition: TCPClient.h:32
Definition: DecawaveTests.cpp:89
ILogger & m_logger
Definition: DecawaveTests.cpp:23
char colorToChar(RgbColor color)
Definition: UserInterface.cpp:8
float acos(float x)
calculate the arc cosine
Definition: Math.cpp:14
std::optional< std::reference_wrapper< ICommInterface > > getRemoteCommInterface()
Return an instance of the connected remote comm interface.
Definition: BSPContainer.cpp:65
float fdim(float x, float y)
Returns the positive difference between x and y.
Definition: Math.cpp:44
bool send(const uint8_t *data, uint16_t length) override
Definition: TCPClient.cpp:15
void task() override
Definition: DecawaveTests.cpp:27
Logger & getLogger()
Return a reference to the global logger.
Definition: LoggerContainer.cpp:5
geometry_msgs::TransformStamped convertPoseToTransformStamped(const geometry_msgs::Pose &pose)
Definition: InterlocManager.cpp:17
UWBRxFrame m_rxFrame
Definition: DecawaveTests.cpp:57
float atan2(float y, float x)
calculate the arc of x/y
Definition: Math.cpp:20
bool m_connected
Definition: TCPServer.h:36
std::map< uint16_t, geometry_msgs::TransformStamped > m_baseLinkToHiveBoardTransforms
Definition: InterlocManager.h:37
uint m_interlocRefreshDelayMs
Definition: InterlocManager.h:36
char m_buffer[64]
Definition: DecawaveTests.cpp:24
void atan()
Calculates the arc cosine Signature atan(arg1)
Definition: BittyBuzzMathFunctions.cpp:232
A logger class with basic logging capabilities.
Definition: ILogger.h:35
RxTask(const char *taskName, UBaseType_t priority)
Definition: DecawaveTests.cpp:50
std::optional< std::reference_wrapper< ICommInterface > > getHostCommInterface()
Return an instance of the connected host comm interface.
Definition: BSPContainer.cpp:30
void log10()
Calculates the logarithm base 10 Signature log10(arg1)
Definition: BittyBuzzMathFunctions.cpp:117
RgbColor m_rgbLed
Definition: UserInterface.h:17
INotificationQueue< InterlocUpdate > & m_interlocUpdateQueue
Definition: InterlocManager.h:42
bool close()
Definition: TCPClient.cpp:23
virtual void process()=0
Spins the interloc task checking if any updates happened. Processing them and pushing update values t...
IBSP & getBSP()
Returns an instance of the platform dependent BSP.
Definition: BSPContainer.cpp:13
uint8_t getHostIP(char *buf, uint8_t length)
Copies the host IP address into the given buffer.
Definition: SettingsContainer.cpp:26
void acos()
Calculates the arc cosine Signature acos(arg1)
Definition: BittyBuzzMathFunctions.cpp:219
void task() override
Definition: DecawaveTests.cpp:146
Definition: DecawaveTests.cpp:135
uint16_t getUUID()
Returns the UUID of the board.
Definition: SettingsContainer.cpp:12
virtual void initChip(void *args)=0
Initialise the chip for usage. Needs to be called early in the program.
~RxTask() override=default
std::shared_ptr< ros::NodeHandle > getRosNodeHandle()
Definition: SettingsContainer.cpp:5
Definition: TCPServer.h:12
A structure to wrap command line arguments used for certain BSPs.
Definition: IBSP.h:29
static double getAngleOfArrival(const tf2::Transform &agentToAgentTransform)
Definition: InterlocManager.cpp:47
void setButtonCallback(Button button, buttonCallbackFunction_t callback, void *context) override
Sets the callback associated with a given button press.
Definition: UserInterface.cpp:94
LogLevel getLogLevel()
Get the log level of the application.
Definition: SettingsContainer.cpp:33
static void listenTask(void *param)
Definition: TCPServer.cpp:7
void task() override
Definition: DecawaveTests.cpp:102
UIState m_uiState
Definition: UserInterface.h:48
int print(const char *format,...) override
Provides an interface to print to the console or serial port. The arguments and return values match t...
Definition: UserInterface.cpp:43
#define MAX_IP_LENGTH
Definition: SettingsContainer.h:8
void close()
Definition: TCPServer.cpp:84
Definition: IInterloc.h:15
UserInterface(const IBSP &bsp)
Definition: UserInterface.cpp:33
int main(int argc, char **argv)
Definition: DecawaveTests.cpp:171
std::array< RelativePosition, MAX_AGENTS_IN_SWARM > m_positions
Definition: IInterloc.h:11
float log2(float x)
Calculates the logarithm base 2.
Definition: Math.cpp:34
const float e
Definition: Math.cpp:6
ILogger & m_logger
Definition: TCPServer.h:35
TCPClient(int socket, sockaddr_in address, ILogger &logger)
Definition: TCPClient.cpp:6
void setRGBLed(RgbColor color) override
Sets the RGB LED to a given color.
Definition: UserInterface.cpp:86
void task() override
Definition: DecawaveTests.cpp:59
InterlocManager(ILogger &logger, INotificationQueue< InterlocUpdate > &interlocUpdateQueue)
Definition: InterlocManager.cpp:13
Mutex m_mutex
Definition: UserInterface.h:47
void waitForClient()
Definition: TCPServer.cpp:95
std::shared_ptr< ros::NodeHandle > getRosNodeHandle()
Definition: BSP.cpp:38
float atan(float x)
calculate the arc tangent
Definition: Math.cpp:18
std::uniform_int_distribution< uint32_t > m_distribution
Definition: BSP.h:27
Manages the user interface The user interface can consist of buttons, LED, serial print ports,...
Definition: IUserInterface.h:36
void pow()
Calculates the base raised to the power of the exponent. Signature pow(base, exponent)
Definition: BittyBuzzMathFunctions.cpp:130
int m_serverFd
Definition: TCPServer.h:40
float pow(float base, float exponent)
Calculates the base raised to the power of the exponent.
Definition: Math.cpp:22
static double getDistance(const tf2::Transform &transform)
Definition: InterlocManager.cpp:42
virtual bool isLineOfSight(uint16_t robotId) const =0
Tells if a robot is in line of sight.
std::array< bool, g_nbrLED > m_ledStates
Definition: UserInterface.h:18
TxTask(const char *taskName, UBaseType_t priority)
Definition: DecawaveTests.cpp:15
bool openSocket(int port)
opens the socket on a certain port
Definition: TCPServer.cpp:20
Mutex & getPrintMutex() override
get the mutex for printing. Note that the mutex is not used in any functions, the user needs to lock ...
Definition: UserInterface.cpp:35
void configureTWRCalibration(uint16_t distanceCalibCm) override
Sets the targeted distance for calibration.
Definition: InterlocManager.cpp:152
void gazeboUpdateCallback(const gazebo_msgs::ModelStates &msg)
Definition: InterlocManager.cpp:69
void(* buttonCallbackFunction_t)(void *instance)
Prototype for a callback from a button press.
Definition: IUserInterface.h:28
BaseTask< configMINIMAL_STACK_SIZE *2 > m_listenTask
Definition: TCPServer.h:38
uint32_t generateRandomNumber() override
Returns a positive random number, uses an hardware RNG if available.
Definition: BSP.cpp:42
Definition: UserInterface.h:22
float cbrt(float x)
Calculates the cube root.
Definition: Math.cpp:26
uint32_t getHostPort()
Returns the TCP port on which the host has opened a port.
Definition: SettingsContainer.cpp:19
~TCPServer() override
Definition: TCPServer.cpp:18
UIState()
Definition: UserInterface.cpp:31
void initChip(void *args) override
Initialise the chip for usage. Needs to be called early in the program.
Definition: BSP.cpp:30
void cos()
Calculates the cosine Signature cos(arg1)
Definition: BittyBuzzMathFunctions.cpp:181
const float pi
Definition: Math.cpp:4
ConnectionType getType() const override
Tells the type of the connection interface.
Definition: TCPClient.cpp:30
~SpiTest() override=default
Definition: LoggerContainer.h:6
std::array< DW_LED, 2 > m_ledsToTest
Definition: DecawaveTests.cpp:144
bool m_connected
Definition: TCPClient.h:34
void sin()
Calculates the sine Signature sin(arg1)
Definition: BittyBuzzMathFunctions.cpp:168
float fmod(float numer, float denom)
Calculates the remainder of numer/denom.
Definition: Math.cpp:40
void startInterloc() override
Dummy function to demonstrate working DW1000s.
Definition: InterlocManager.cpp:139
float sin(float x)
calculate the sine
Definition: Math.cpp:10
float sqrt(float x)
Calculates the square root.
Definition: Math.cpp:24
std::optional< int > m_clientFd
Definition: TCPServer.h:41
TCPServer(ILogger &logger)
Definition: TCPServer.cpp:12
float exp(float x)
Calculates the exponent.
Definition: Math.cpp:28