HiveMind
AngleCalculatorParameters.h
Go to the documentation of this file.
1 #ifndef HIVE_MIND_ANGLECALCULATORPARAMETERS_H
2 #define HIVE_MIND_ANGLECALCULATORPARAMETERS_H
3 
4 #include <array>
5 #include <cstdint>
6 
7 #define NUM_ANTENNA_PAIRS (3)
8 #define NUM_PDOA_SLOPES (2)
9 
10 #define ANGLE_PARAMETERS_VALID_SECRET_NUMBER (42)
11 
21  std::array<float, NUM_ANTENNA_PAIRS> m_pdoaNormalizationFactors{};
25  std::array<std::array<float, NUM_PDOA_SLOPES>, NUM_ANTENNA_PAIRS> m_pdoaSlopes{};
30  std::array<std::array<float, NUM_PDOA_SLOPES>, NUM_ANTENNA_PAIRS> m_pdoaIntercepts{};
31 
35  std::array<std::array<uint8_t, 2>, NUM_ANTENNA_PAIRS> m_antennaPairs{};
36 
48  std::array<std::array<uint8_t, NUM_ANTENNA_PAIRS>, NUM_ANTENNA_PAIRS> m_slopeDecisionMatrix{};
49 
54  std::array<uint8_t, NUM_ANTENNA_PAIRS> m_parametersValidSecretNumbers;
55 
61 };
62 
63 #endif // HIVE_MIND_ANGLECALCULATORPARAMETERS_H
BittyBuzzBytecode::getBytecodeLength
uint16_t getBytecodeLength() const override
Get the size of the BittyBuzz byte code.
Definition: BittyBuzzBytecode.cpp:38
BittyBuzzBytecode.h
BittyBuzzFunctionDescription::getFunctionName
const char * getFunctionName() const
get the name of the function
Definition: BittyBuzzFunctionDescription.cpp:15
BittyBuzzMessageHandler::handleResponse
bool handleResponse(const ResponseDTO &response)
Definition: BittyBuzzMessageHandler.cpp:221
BittyBuzzClosureRegister::m_closureRegisterMap
HashMapStack< std::string_view, BittyBuzzRegisteredClosure, m_maxSize > m_closureRegisterMap
Definition: BittyBuzzClosureRegister.h:36
BittyBuzzVm::m_bsp
const IBSP & m_bsp
Definition: BittyBuzzVm.h:65
BittyBuzzSystem::g_closureRegister
IBittyBuzzClosureRegister * g_closureRegister
Function register used by the BBVM to register new functions.
Definition: BittyBuzzSystem.cpp:9
Math::log10
float log10(float x)
Calculates the logarithm base 10.
Definition: Math.cpp:32
BBVMRet
BBVMRet
Definition: IBittyBuzzVm.h:10
IUserInterface::flush
virtual void flush()=0
Adds a newline and flushes the input to the serial port.
BittyBuzzMessageHandler::m_remoteQueue
ICircularQueue< MessageDTO > & m_remoteQueue
Definition: BittyBuzzMessageHandler.h:32
BittyBuzzUserFunctions::registerClosure
void registerClosure()
register a new function, exposing it to the remote composant of the swarm Signature register_closure(...
Definition: BittyBuzzUserFunctions.cpp:90
BittyBuzzMathFunctions::sqrt
void sqrt()
Calculates the square root Signature sqrt(arg1)
Definition: BittyBuzzMathFunctions.cpp:156
BittyBuzzVm.h
LogLevel::Error
@ Error
BittyBuzzNeighborsManager
Definition: BittyBuzzNeighborsManager.h:8
BittyBuzzSystem::logVmDump
void logVmDump(LogLevel logLevel)
Logs the vm dump which contains information about the vm state, heap, stack, etc.
Definition: BittyBuzzSystem.cpp:65
BittyBuzzClosureRegister
Definition: BittyBuzzClosureRegister.h:13
BittyBuzzMessageHandler::handleRequest
ResponseDTO handleRequest(const RequestDTO &request)
Definition: BittyBuzzMessageHandler.cpp:162
IBSP::getUUId
virtual uint16_t getUUId() const =0
Returns the unique id associated with the board.
BittyBuzzRegisteredClosure::m_closureHeapIdx
bbzheap_idx_t m_closureHeapIdx
Definition: IBittyBuzzClosureRegister.h:17
BittyBuzzContainer.h
BittyBuzzRegisteredClosure::m_closureId
uint16_t m_closureId
Definition: IBittyBuzzClosureRegister.h:16
BittyBuzzMathFunctions::log
void log()
Calculates the natural logarithm (ln) Signature log(arg1)
Definition: BittyBuzzMathFunctions.cpp:91
BittyBuzzLibMemberRegister::m_strId
uint16_t m_strId
Definition: BittyBuzzLibMemberRegister.h:14
BittyBuzzMathFunctions::min
void min()
Return the min Signature min(arg1, arg2)
Definition: BittyBuzzMathFunctions.cpp:251
IBittyBuzzBytecode::getBytecodeFetchFunction
virtual bbzvm_bcode_fetch_fun getBytecodeFetchFunction() const =0
Obtain the function that fetches the BittyBuzz byte code.
IBittyBuzzClosureRegister::clearClosures
virtual void clearClosures()=0
Clears all the registered closures.
foreachFunctionCallback
void foreachFunctionCallback(bbzheap_idx_t key, bbzheap_idx_t value, void *params)
Definition: BittyBuzzUserFunctions.cpp:17
IInterloc::getRobotPosition
virtual std::optional< RelativePosition > getRobotPosition(uint16_t robotId) const =0
Returns the last known relative position of a given robot.
BittyBuzzMessageHandler.h
BittyBuzzSystem.h
BittyBuzzUserFunctions::isClosure
void isClosure()
Checks if a variable is a function closure Signature isclosure(arg1)
Definition: BittyBuzzUserFunctions.cpp:281
Math::ln
float ln(float x)
Calculates the natural logarithm.
Definition: Math.cpp:30
BittyBuzzLibMemberRegister::m_value
std::variant< bbzvm_funp, float, int16_t > m_value
Definition: BittyBuzzLibMemberRegister.h:15
InterlocContainer::getInterlocUpdateOutputQueue
ThreadSafeQueue< uint16_t > & getInterlocUpdateOutputQueue()
get interloc position update msg queu
Definition: InterlocContainer.cpp:29
IBittyBuzzClosureRegister
A class to register buzz function/closures id and associate them with a string.
Definition: IBittyBuzzClosureRegister.h:24
BittyBuzzContainer::getBBZClosureRegister
BittyBuzzClosureRegister & getBBZClosureRegister()
return an instance of a bittybuzz function register
Definition: BittyBuzzContainer.cpp:16
IBittyBuzzNeighborsManager::updateNeighbors
virtual void updateNeighbors()=0
BittyBuzzSystem::getStateString
const char * getStateString(bbzvm_state state)
Definition: BittyBuzzSystem.cpp:143
BittyBuzzClosureRegister::getRegisteredClosure
std::optional< std::reference_wrapper< const BittyBuzzRegisteredClosure > > getRegisteredClosure(const char *functionName) const override
get the id of a stored function by it's associated name
Definition: BittyBuzzClosureRegister.cpp:55
isBuzzToBuzzUserCallRequest
bool isBuzzToBuzzUserCallRequest(const RequestDTO &request)
Definition: BittyBuzzMessageHandler.cpp:239
BittyBuzzUserFunctions::g_vmStepDelayMs
int16_t g_vmStepDelayMs
The delay between each call of the step function in buzz.
Definition: BittyBuzzUserFunctions.cpp:8
BSPContainer.h
BittyBuzzFunctionDescription::m_argumentDescriptions
std::array< std::tuple< const char *, FunctionDescriptionArgumentTypeDTO >, FunctionDescriptionDTO::ARGUMENTS_MAX_SIZE > m_argumentDescriptions
Definition: BittyBuzzFunctionDescription.h:47
BittyBuzzNeighborsManager::m_posUpdateQueue
ICircularQueue< uint16_t > & m_posUpdateQueue
Definition: BittyBuzzNeighborsManager.h:17
BittyBuzzMessageHandler::handleGenericResponse
static bool handleGenericResponse(const GenericResponseDTO &response)
Definition: BittyBuzzMessageHandler.cpp:184
BittyBuzzMessageHandler::m_inputQueue
ICircularQueue< MessageDTO > & m_inputQueue
Definition: BittyBuzzMessageHandler.h:30
ILogger::log
virtual LogRet log(LogLevel level, const char *format,...)=0
Logs if the provided level is higher than the current log level (Thread-safe)
BittyBuzzVm::start
bool start() override
Starts the vm.
Definition: BittyBuzzVm.cpp:64
BittyBuzzMessageService::queueBuzzMessages
bool queueBuzzMessages() override
queues the buzz messages
Definition: BittyBuzzMessageService.cpp:66
BittyBuzzUserFunctions::callHostFunction
void callHostFunction()
calls a function to a host Signature call_host_function(agent_id, fname, params)
Definition: BittyBuzzUserFunctions.cpp:180
BittyBuzzBytecode::BittyBuzzBytecode
BittyBuzzBytecode(ILogger &logger, const uint8_t *bytecode, uint16_t bytecodeLength)
Definition: BittyBuzzBytecode.cpp:25
Math::fabs
float fabs(float x)
Return the absolute value.
Definition: Math.cpp:50
BittyBuzzSystem::errorReceiver
void errorReceiver(bbzvm_error errcode)
Callback to handle errors on bittybuzz vm.
Definition: BittyBuzzSystem.cpp:29
BittyBuzzFactory::createBittyBuzzStringResolver
BittyBuzzStringResolver createBittyBuzzStringResolver(ILogger &logger)
Creates a BittyBuzzStringResolver with the main.bzz bytecode.
Definition: BittyBuzzFactory.cpp:16
isNumber
bool isNumber(bbzobj_t *obj)
Definition: BittyBuzzMathFunctions.cpp:7
LoggerContainer.h
AngleCalculatorParameters::m_pdoaSlopes
std::array< std::array< float, NUM_PDOA_SLOPES >, NUM_ANTENNA_PAIRS > m_pdoaSlopes
Definition: AngleCalculatorParameters.h:25
UserSegment::F
@ F
BittyBuzzMessageService::m_remoteQueue
ICircularQueue< MessageDTO > & m_remoteQueue
Definition: BittyBuzzMessageService.h:37
BittyBuzzContainer::getBBZMessageHandler
BittyBuzzMessageHandler & getBBZMessageHandler()
return an instance of a bittybuzz message handler
Definition: BittyBuzzContainer.cpp:8
BittyBuzzRegisteredClosure::m_selfHeapIdx
bbzheap_idx_t m_selfHeapIdx
Definition: IBittyBuzzClosureRegister.h:18
bbz_bcodeFetcher
const uint8_t * bbz_bcodeFetcher(bbzpc_t offset, uint8_t size)
Definition: BittyBuzzBytecode.cpp:10
Math::floor
float floor(float x)
Floor x downward.
Definition: Math.cpp:38
BittyBuzzUserFunctions::log
void log()
Logs to the default output Signature log(args...)
Definition: BittyBuzzUserFunctions.cpp:67
AngleCalculatorParameters::m_pdoaNormalizationFactors
std::array< float, NUM_ANTENNA_PAIRS > m_pdoaNormalizationFactors
Definition: AngleCalculatorParameters.h:21
MessageHandlerContainer::getBuzzMsgQueue
ThreadSafeQueue< MessageDTO > & getBuzzMsgQueue()
get the buzz message queue
Definition: MessageHandlerContainer.cpp:35
BittyBuzzFactory::createBittyBuzzMathLib
BittyBuzzLib< std::array< BittyBuzzLibMemberRegister, 24 > > createBittyBuzzMathLib()
Creates a the math table library for the bvm.
Definition: BittyBuzzFactory.cpp:46
BittyBuzzClosureRegister::clearClosures
void clearClosures() override
Clears all the registered closures.
Definition: BittyBuzzClosureRegister.cpp:49
AngleCalculatorParameters::m_parametersValidSecretNumbers
std::array< uint8_t, NUM_ANTENNA_PAIRS > m_parametersValidSecretNumbers
Definition: AngleCalculatorParameters.h:54
callIfNumber
void callIfNumber(uint16_t argPos, callbackFloatArg callback)
Definition: BittyBuzzMathFunctions.cpp:24
BittyBuzzMessageService::BittyBuzzMessageService
BittyBuzzMessageService(ICircularQueue< MessageDTO > &hostQueue, ICircularQueue< MessageDTO > &remoteQueue, ICircularQueue< MessageDTO > &buzzQueue, IBSP &bsp, ILogger &logger)
Definition: BittyBuzzMessageService.cpp:6
BittyBuzzMessageService
Definition: BittyBuzzMessageService.h:10
BittyBuzzMathFunctions::ceili
void ceili()
Ceil a value Signature ceili(arg1)
Definition: BittyBuzzMathFunctions.cpp:63
BittyBuzzUserFunctions::isLambdaClosure
void isLambdaClosure()
Checks if a variable is a lambda, unamed closure Signature islambda_closure(arg1)
Definition: BittyBuzzUserFunctions.cpp:290
BittyBuzzStringResolver::BittyBuzzStringResolver
BittyBuzzStringResolver(const std::pair< const uint16_t, const char * > *stringArray, uint16_t arrayLength, uint16_t stringIdOffset, ILogger &logger)
Definition: BittyBuzzStringResolver.cpp:3
BittyBuzzClosureRegister::m_closureNameRegisters
HashMapStack< uint16_t, const char *, m_maxSize > m_closureNameRegisters
Definition: BittyBuzzClosureRegister.h:35
IBittyBuzzClosureRegister::registerClosure
virtual bool registerClosure(const char *functionName, bbzheap_idx_t closureHeapIdx, bbzheap_idx_t selfHeapIdx, const BittyBuzzFunctionDescription &description)=0
register a closure to the list
IBittyBuzzMessageHandler::processMessage
virtual bool processMessage()=0
process a message and sends a response if needed. A response is sent to the appropriate queue on a re...
BittyBuzzContainer::getBBZNeighborsManager
BittyBuzzNeighborsManager & getBBZNeighborsManager()
return an instance of a bittybuzz neighbors manager
Definition: BittyBuzzContainer.cpp:29
BittyBuzzVm::terminate
void terminate() override
Terminate the virtual machine and removes all messages that were supposed to be processed.
Definition: BittyBuzzVm.cpp:80
BittyBuzzStringResolver::m_stringArray
const std::pair< const uint16_t, const char * > * m_stringArray
Definition: BittyBuzzStringResolver.h:22
BittyBuzzSystem::getErrorString
const char * getErrorString(bbzvm_error error)
Definition: BittyBuzzSystem.cpp:160
BittyBuzzMessageHandler::handleVmMessage
bool handleVmMessage(const VmMessageDTO &vmMsg)
Definition: BittyBuzzMessageHandler.cpp:190
BittyBuzzFunctionDescription::m_argumentDescriptionsLength
uint16_t m_argumentDescriptionsLength
Definition: BittyBuzzFunctionDescription.h:48
perm
char perm(bbzobj_t *obj)
Definition: BittyBuzzSystem.cpp:43
BittyBuzzVm::m_bbzVm
bbzvm_t m_bbzVm
Definition: BittyBuzzVm.h:73
BittyBuzzMathFunctions::max
void max()
Return the max Signature max(arg1, arg2)
Definition: BittyBuzzMathFunctions.cpp:267
AngleCalculatorParameters::m_boardOrientationOffset
float m_boardOrientationOffset
Definition: AngleCalculatorParameters.h:60
BittyBuzzSystem::g_messageService
IBittyBuzzMessageService * g_messageService
Message service used by the BBVM to send requests to host and remote.
Definition: BittyBuzzSystem.cpp:10
BittyBuzzLibMemberRegister::BittyBuzzLibMemberRegister
BittyBuzzLibMemberRegister(uint16_t strId, std::variant< bbzvm_funp, float, int16_t > value)
Definition: BittyBuzzLibMemberRegister.cpp:3
BittyBuzzFactory::createBittyBuzzUILib
BittyBuzzLib< std::array< BittyBuzzLibMemberRegister, 2 > > createBittyBuzzUILib()
Creates a the ui table library for the bvm.
Definition: BittyBuzzFactory.cpp:76
BittyBuzzFunctionDescription::addArgument
bool addArgument(const char *argumentName, FunctionDescriptionArgumentTypeDTO argumentType)
add an argument to the list of the description
Definition: BittyBuzzFunctionDescription.cpp:17
callbackFloatArg
void(* callbackFloatArg)(float arg)
Definition: BittyBuzzMathFunctions.cpp:23
BittyBuzzMessageService.h
BittyBuzzMessageHandler::handleBuzzMessages
bool handleBuzzMessages(const BuzzMessagesDTO &msg)
Definition: BittyBuzzMessageHandler.cpp:201
BittyBuzzMessageHandler::handleFunctionCallRequest
FunctionCallResponseDTO handleFunctionCallRequest(const FunctionCallRequestDTO &functionRequest)
Definition: BittyBuzzMessageHandler.cpp:74
BittyBuzzUserFunctions::delay
void delay()
wait for a certain delay Signature delay(arg1) Warning this function make the whole VM sleep which ca...
Definition: BittyBuzzUserFunctions.cpp:327
VM_DUMP_LOG_WAIT_TIME_MS
static constexpr uint16_t VM_DUMP_LOG_WAIT_TIME_MS
Definition: BittyBuzzSystem.cpp:14
InterlocContainer.h
BBVMRet::Stopped
@ Stopped
LogLevel
LogLevel
The log level used for the logger.
Definition: ILogger.h:9
AngleCalculatorParameters::m_pdoaIntercepts
std::array< std::array< float, NUM_PDOA_SLOPES >, NUM_ANTENNA_PAIRS > m_pdoaIntercepts
Definition: AngleCalculatorParameters.h:30
BittyBuzzMessageService::m_bsp
IBSP & m_bsp
Definition: BittyBuzzMessageService.h:40
BittyBuzzVm::init
bool init(const std::reference_wrapper< IBittyBuzzLib > *bbzLibs, uint32_t bbzLibsLength) override
Init the virtual machine.
Definition: BittyBuzzVm.cpp:38
BittyBuzzClosureRegister.h
Math::ceil
float ceil(float x)
Round x upward.
Definition: Math.cpp:36
Math::tan
float tan(float x)
calculate the tangent
Definition: Math.cpp:12
AngleCalculatorParameters
Definition: AngleCalculatorParameters.h:16
BittyBuzzMathFunctions::log2
void log2()
Calculates the logarithm base 2 Signature log2(arg1)
Definition: BittyBuzzMathFunctions.cpp:105
IUserUI
Manages the UI available to the user.
Definition: IUserUI.h:7
BittyBuzzUIFunctions.h
IBittyBuzzNeighborsManager
Definition: IBittyBuzzNeighborsManager.h:4
BittyBuzzUserFunctions::isString
void isString()
Checks if a variable is a float Signature istable(arg1)
Definition: BittyBuzzUserFunctions.cpp:263
BittyBuzzClosureRegister::registerClosure
bool registerClosure(const char *functionName, bbzheap_idx_t closureHeapIdx, bbzheap_idx_t selfHeapIdx, const BittyBuzzFunctionDescription &description) override
register a closure to the list
Definition: BittyBuzzClosureRegister.cpp:16
BittyBuzzFactory::createBittyBuzzGlobalLib
BittyBuzzLib< std::array< BittyBuzzLibMemberRegister, 15 > > createBittyBuzzGlobalLib(int16_t vmStepDelay)
Creates an array of FunctionRegister associated with the code from main.bzz.
Definition: BittyBuzzFactory.cpp:21
BittyBuzzClosureRegister::getRegisteredClosureLength
uint16_t getRegisteredClosureLength() const override
get the length/number of the registered closures
Definition: BittyBuzzClosureRegister.cpp:68
ArgNameAndType::m_key
bbzheap_idx_t m_key
Definition: BittyBuzzUserFunctions.cpp:45
BittyBuzzMessageHandler::messageQueueLength
uint16_t messageQueueLength() const override
gets the number of message to be processed in the queue
Definition: BittyBuzzMessageHandler.cpp:42
ForeachFunctionContext
Definition: BittyBuzzUserFunctions.cpp:10
BittyBuzzMathFunctions::tan
void tan()
Calculates the tengent Signature tan(arg1)
Definition: BittyBuzzMathFunctions.cpp:194
MessageHandlerContainer::getRemoteMsgQueue
NotificationQueue< MessageDTO > & getRemoteMsgQueue()
get the remote message queue
Definition: MessageHandlerContainer.cpp:57
BittyBuzzMessageHandler::handleUserCallResponse
static bool handleUserCallResponse(const UserCallResponseDTO &response)
Definition: BittyBuzzMessageHandler.cpp:178
AngleCalculatorParameters::m_slopeDecisionMatrix
std::array< std::array< uint8_t, NUM_ANTENNA_PAIRS >, NUM_ANTENNA_PAIRS > m_slopeDecisionMatrix
Definition: AngleCalculatorParameters.h:48
RelativePosition::m_angle
float m_angle
Angle of other agent in current agent frame (in degrees)
Definition: RelativePosition.h:17
LogLevel::Warn
@ Warn
Math::asin
float asin(float x)
calculate the arc sine
Definition: Math.cpp:16
BittyBuzzMathFunctions::ceilf
void ceilf()
Ceil a value Signature ceilf(arg1)
Definition: BittyBuzzMathFunctions.cpp:70
BittyBuzzMathFunctions::asin
void asin()
Calculates the arc sine Signature asin(arg1)
Definition: BittyBuzzMathFunctions.cpp:206
BittyBuzzMathFunctions::abs
void abs()
Calculates the absolute value Signature abs(arg1)
Definition: BittyBuzzMathFunctions.cpp:33
BittyBuzzFactory::createBittyBuzzBytecode
BittyBuzzBytecode createBittyBuzzBytecode(ILogger &logger)
Creates a BittyBuzzBytecode with the main.bzz bytecode.
Definition: BittyBuzzFactory.cpp:12
Math::cos
float cos(float x)
calculate the cosine
Definition: Math.cpp:8
NUM_ANTENNA_PAIRS
#define NUM_ANTENNA_PAIRS
Definition: AngleCalculatorParameters.h:7
BittyBuzzVm::m_closureRegister
IBittyBuzzClosureRegister & m_closureRegister
Definition: BittyBuzzVm.h:69
BittyBuzzMathFunctions::exp
void exp()
Calculates e^x Signature exp(x)
Definition: BittyBuzzMathFunctions.cpp:144
ArgNameAndType::m_value
bbzheap_idx_t m_value
Definition: BittyBuzzUserFunctions.cpp:46
BittyBuzzBytecode::getBytecodeFetchFunction
bbzvm_bcode_fetch_fun getBytecodeFetchFunction() const override
Obtain the function that fetches the BittyBuzz byte code.
Definition: BittyBuzzBytecode.cpp:34
IBittyBuzzStringResolver::getString
virtual std::optional< const char * > getString(uint16_t stringId) const =0
Get the string from the stringId.
BittyBuzzFunctionDescription
Description for a function, used for the FunctionDescriptionRequest/Response.
Definition: BittyBuzzFunctionDescription.h:11
BittyBuzzStringResolver::getString
std::optional< const char * > getString(uint16_t stringId) const override
Get the string from the stringId.
Definition: BittyBuzzStringResolver.cpp:13
Math.h
IBSP
Definition: IBSP.h:6
BittyBuzzLibMemberRegister.h
BittyBuzzRegisteredClosure::m_description
BittyBuzzFunctionDescription m_description
Definition: IBittyBuzzClosureRegister.h:19
BittyBuzzSystem::g_logger
ILogger * g_logger
Logger used for error reception or user functions.
Definition: BittyBuzzSystem.cpp:6
Math::abs
int abs(int x)
Return the absolute value.
Definition: Math.cpp:52
BittyBuzzMessageHandler::processMessage
bool processMessage() override
process a message and sends a response if needed. A response is sent to the appropriate queue on a re...
Definition: BittyBuzzMessageHandler.cpp:20
BittyBuzzMessageHandler::m_logger
ILogger & m_logger
Definition: BittyBuzzMessageHandler.h:34
IBittyBuzzStringResolver
Class that resolves a string from the bittybuzz virtual machine.
Definition: IBittyBuzzStringResolver.h:10
g_bittyBuzzBytecode
static const uint8_t * g_bittyBuzzBytecode
Definition: BittyBuzzBytecode.cpp:7
BittyBuzzVm::m_messageService
IBittyBuzzMessageService & m_messageService
Definition: BittyBuzzVm.h:67
BittyBuzzVm::getInstruction
bbzvm_instr getInstruction() const override
Get the current instruction of the VM.
Definition: BittyBuzzVm.cpp:126
BittyBuzzContainer::getBBZMessageService
BittyBuzzMessageService & getBBZMessageService()
return an instance of a bittybuzz message service
Definition: BittyBuzzContainer.cpp:21
ArgNameAndType
Definition: BittyBuzzUserFunctions.cpp:44
Math::acos
float acos(float x)
calculate the arc cosine
Definition: Math.cpp:14
BittyBuzzFactory.h
BittyBuzzStringResolver
Definition: BittyBuzzStringResolver.h:9
BittyBuzzFunctionDescription::BittyBuzzFunctionDescription
BittyBuzzFunctionDescription(const char *functionName)
Definition: BittyBuzzFunctionDescription.cpp:3
BittyBuzzUserFunctions::toInt
void toInt()
Casts a type to int Signature int(arg1)
Definition: BittyBuzzUserFunctions.cpp:299
BittyBuzzVm::m_logger
ILogger & m_logger
Definition: BittyBuzzVm.h:70
LoggerContainer::getLogger
Logger & getLogger()
Return a reference to the global logger.
Definition: LoggerContainer.cpp:5
getFloatArg
std::optional< float > getFloatArg(uint16_t stackAt)
Definition: BittyBuzzMathFunctions.cpp:9
Math::atan2
float atan2(float y, float x)
calculate the arc of x/y
Definition: Math.cpp:20
BittyBuzzVm::getState
bbzvm_state getState() const override
Get the state of the vm.
Definition: BittyBuzzVm.cpp:122
BittyBuzzMathFunctions::atan
void atan()
Calculates the arc cosine Signature atan(arg1)
Definition: BittyBuzzMathFunctions.cpp:232
BittyBuzzFunctionDescription.h
BittyBuzzLibMemberRegister::getValue
std::variant< bbzvm_funp, float, int16_t > getValue() const
Definition: BittyBuzzLibMemberRegister.cpp:9
BittyBuzzUserFunctions.h
IBittyBuzzBytecode::getBytecodeLength
virtual uint16_t getBytecodeLength() const =0
Get the size of the BittyBuzz byte code.
ILogger
A logger class with basic logging capabilities.
Definition: ILogger.h:35
BittyBuzzMessageHandler::m_hostQueue
ICircularQueue< MessageDTO > & m_hostQueue
Definition: BittyBuzzMessageHandler.h:31
BittyBuzzMathFunctions::log10
void log10()
Calculates the logarithm base 10 Signature log10(arg1)
Definition: BittyBuzzMathFunctions.cpp:117
IUserUI::setLed
virtual void setLed(bool state)=0
Set the led on or off.
BittyBuzzRegisteredClosure
a class containing info of a registered closure
Definition: IBittyBuzzClosureRegister.h:9
IBSP::generateRandomNumber
virtual uint32_t generateRandomNumber()=0
Returns a positive random number, uses an hardware RNG if available.
BBVMRet::OutMsgErr
@ OutMsgErr
BittyBuzzVm::step
BBVMRet step() override
Does one execution step in the virtual machine. Thus execute the buzz code in the step function.
Definition: BittyBuzzVm.cpp:90
BittyBuzzStringResolver::m_arrayLength
const uint16_t m_arrayLength
Definition: BittyBuzzStringResolver.h:23
BSPContainer::getBSP
IBSP & getBSP()
Returns an instance of the platform dependent BSP.
Definition: BSPContainer.cpp:13
AngleCalculatorParameters::m_antennaPairs
std::array< std::array< uint8_t, 2 >, NUM_ANTENNA_PAIRS > m_antennaPairs
Definition: AngleCalculatorParameters.h:35
InterlocContainer::getInterloc
IInterloc & getInterloc()
Definition: InterlocContainer.cpp:12
BittyBuzzSystem::g_stringResolver
const IBittyBuzzStringResolver * g_stringResolver
String resolver used for user functions.
Definition: BittyBuzzSystem.cpp:8
BittyBuzzMathFunctions::acos
void acos()
Calculates the arc cosine Signature acos(arg1)
Definition: BittyBuzzMathFunctions.cpp:219
BittyBuzzMathFunctions::E
const float E
The euleur number as a constant note that since buzz approximates ln(e) may not equal 1.
Definition: BittyBuzzMathFunctions.h:15
g_bittyBuzzBytecodeLength
static uint16_t g_bittyBuzzBytecodeLength
Definition: BittyBuzzBytecode.cpp:8
BittyBuzzBytecode
Definition: BittyBuzzBytecode.h:9
BittyBuzzMessageService::flush
bool flush()
Definition: BittyBuzzMessageService.cpp:105
BittyBuzzMessageHandler::clearMessages
void clearMessages() override
clears all the pending messages in the input queue without processing them
Definition: BittyBuzzMessageHandler.cpp:40
ForeachFunctionContext::m_err
bool m_err
Definition: BittyBuzzUserFunctions.cpp:11
BittyBuzzSystem::functionCall
void functionCall(uint16_t stringId)
Call a bittybuzz function that takes not arguments (init, step, etc),.
Definition: BittyBuzzSystem.cpp:17
BittyBuzzVm::stop
void stop() override
Stops the vm, can be called in another thread or in an interrupt.
Definition: BittyBuzzVm.cpp:73
RelativePosition
Definition: RelativePosition.h:6
BittyBuzzUIFunctions::setHex
void setHex()
Sets the user sevent segment to a value Signature set_hex(arg1)
Definition: BittyBuzzUIFunctions.cpp:22
BittyBuzzMessageHandler::handleFunctionListLengthRequest
FunctionListLengthResponseDTO handleFunctionListLengthRequest(const FunctionListLengthRequestDTO &functionLengthRequest)
Definition: BittyBuzzMessageHandler.cpp:44
BittyBuzzFunctionDescription::getArgumentsLength
uint16_t getArgumentsLength() const
get the length of the array
Definition: BittyBuzzFunctionDescription.cpp:12
BittyBuzzUtils::logObj
int logObj(bbzobj_t *obj, char *str, uint16_t maxSize)
Logs an bittybuzz object to a human readable format.
Definition: BittyBuzzUtils.cpp:3
BittyBuzzLib
A buzz library, can register on the global scope or on a table.
Definition: BittyBuzzLib.h:11
BittyBuzzUserFunctions::callBuzzFunction
void callBuzzFunction()
calls a function to a buzz Signature call_buzz_function(agent_id, fname, params)
Definition: BittyBuzzUserFunctions.cpp:208
BittyBuzzMessageHandler
Definition: BittyBuzzMessageHandler.h:11
BittyBuzzMessageService::callBuzzFunction
bool callBuzzFunction(uint16_t agentId, const char *functionName, const FunctionCallArgumentDTO *args, uint16_t argsLength) override
call a function to a buzz vm
Definition: BittyBuzzMessageService.cpp:42
BittyBuzzMathFunctions::floori
void floori()
Floor a value Signature floori(arg1)
Definition: BittyBuzzMathFunctions.cpp:49
BittyBuzzUserFunctions::isInt
void isInt()
Checks if a variable is an int Signature isint(arg1)
Definition: BittyBuzzUserFunctions.cpp:245
BittyBuzzStringResolver::m_logger
ILogger & m_logger
Definition: BittyBuzzStringResolver.h:21
BittyBuzzNeighborsManager::BittyBuzzNeighborsManager
BittyBuzzNeighborsManager(const IInterloc &interloc, ICircularQueue< uint16_t > &posUpdateQueue)
Definition: BittyBuzzNeighborsManager.cpp:5
BittyBuzzVm::m_messageHandler
IBittyBuzzMessageHandler & m_messageHandler
Definition: BittyBuzzVm.h:66
BittyBuzzStringResolver::m_stringIdOffset
const uint16_t m_stringIdOffset
Definition: BittyBuzzStringResolver.h:24
IBittyBuzzMessageService::queueBuzzMessages
virtual bool queueBuzzMessages()=0
queues the buzz messages
ForeachFunctionContext::m_arguments
std::array< FunctionCallArgumentDTO, FunctionCallRequestDTO::FUNCTION_CALL_ARGUMENTS_MAX_LENGTH > m_arguments
Definition: BittyBuzzUserFunctions.cpp:13
BittyBuzzSystem::g_userUI
IUserUI * g_userUI
User interface (LED, Hex display, etc) available to the user via buzz.
Definition: BittyBuzzSystem.cpp:12
BittyBuzzMessageService::m_hostQueue
ICircularQueue< MessageDTO > & m_hostQueue
Definition: BittyBuzzMessageService.h:36
BittyBuzzMathFunctions::roundf
void roundf()
Rounds a value Signature roundf(arg1)
Definition: BittyBuzzMathFunctions.cpp:84
BittyBuzzMessageService::m_messages
BuzzMessagesDTO m_messages
Definition: BittyBuzzMessageService.h:39
BittyBuzzMathFunctions::roundi
void roundi()
Rounds a value Signature roundi(arg1)
Definition: BittyBuzzMathFunctions.cpp:77
IBittyBuzzMessageHandler::clearMessages
virtual void clearMessages()=0
clears all the pending messages in the input queue without processing them
IBittyBuzzMessageService::callBuzzFunction
virtual bool callBuzzFunction(uint16_t agentId, const char *functionName, const FunctionCallArgumentDTO *args, uint16_t argsLength)=0
call a function to a buzz vm
IInterloc
Definition: IInterloc.h:15
IBittyBuzzClosureRegister::getRegisteredClosureLength
virtual uint16_t getRegisteredClosureLength() const =0
get the length/number of the registered closures
MessageHandlerContainer::getHostMsgQueue
NotificationQueue< MessageDTO > & getHostMsgQueue()
get the host message queue
Definition: MessageHandlerContainer.cpp:44
BittyBuzzNeighborsManager.h
IBittyBuzzMessageService
message service use by the BBVM. Constructs the messages and dispatches it at the appropriate place (...
Definition: IBittyBuzzMessageService.h:9
BittyBuzzMessageService::callHostFunction
bool callHostFunction(uint16_t agentId, const char *functionName, const FunctionCallArgumentDTO *args, uint16_t argsLength) override
call a function to a host
Definition: BittyBuzzMessageService.cpp:17
BittyBuzzMessageHandler::BittyBuzzMessageHandler
BittyBuzzMessageHandler(const IBittyBuzzClosureRegister &closureRegister, ICircularQueue< MessageDTO > &inputQueue, ICircularQueue< MessageDTO > &hostQueue, ICircularQueue< MessageDTO > &remoteQueue, const IBSP &bsp, ILogger &logger)
Definition: BittyBuzzMessageHandler.cpp:7
ForeachFunctionContext::m_length
uint16_t m_length
Definition: BittyBuzzUserFunctions.cpp:14
Math::log2
float log2(float x)
Calculates the logarithm base 2.
Definition: Math.cpp:34
BittyBuzzSystem::g_bsp
IBSP * g_bsp
BSP used by the bbvm for random numbers.
Definition: BittyBuzzSystem.cpp:11
intToUserSegment
UserSegment intToUserSegment(int16_t i)
Definition: BittyBuzzUIFunctions.cpp:4
BittyBuzzRegisteredClosure::BittyBuzzRegisteredClosure
BittyBuzzRegisteredClosure(uint16_t closureId, BittyBuzzFunctionDescription description, bbzheap_idx_t closureHeapIdx, bbzheap_idx_t selfHeapIdx)
Definition: BittyBuzzClosureRegister.cpp:6
IUserInterface::print
virtual int print(const char *format,...)=0
Provides an interface to print to the console or serial port. The arguments and return values match t...
logObj
void logObj(ILogger &logger, LogLevel logLevel, bbzheap_idx_t heapIdx)
Definition: BittyBuzzSystem.cpp:50
BittyBuzzMessageHandler::m_bsp
const IBSP & m_bsp
Definition: BittyBuzzMessageHandler.h:33
BittyBuzzMathFunctions.h
BittyBuzzUtils.h
BBVMRet::Ok
@ Ok
SettingsContainer.h
BittyBuzzMessageService::getNextMessage
std::optional< std::reference_wrapper< BuzzMessageDTO > > getNextMessage()
Definition: BittyBuzzMessageService.cpp:91
getbbzObjType
FunctionDescriptionArgumentTypeDTO getbbzObjType(bbzobj_t *bbzObj)
Definition: BittyBuzzUserFunctions.cpp:56
BittyBuzzMessageHandler::handleUserCallRequest
UserCallResponseDTO handleUserCallRequest(const UserCallRequestDTO &userRequest)
Definition: BittyBuzzMessageHandler.cpp:135
BittyBuzzLibMemberRegister::getStringId
uint16_t getStringId() const
Definition: BittyBuzzLibMemberRegister.cpp:7
BittyBuzzNeighborsManager::updateNeighbors
void updateNeighbors() override
Definition: BittyBuzzNeighborsManager.cpp:9
BittyBuzzFunctionDescription::m_functionName
const char * m_functionName
Definition: BittyBuzzFunctionDescription.h:44
BittyBuzzUserFunctions::isTable
void isTable()
Checks if a variable is a table Signature istable(arg1)
Definition: BittyBuzzUserFunctions.cpp:272
BittyBuzzVm::logDump
void logDump(LogLevel logLevel) override
Logs the virtual machine state, stack, heap and table segments.
Definition: BittyBuzzVm.cpp:78
BittyBuzzSystem::getInstructionString
const char * getInstructionString(bbzvm_instr instruction)
Definition: BittyBuzzSystem.cpp:197
BittyBuzzVm::m_bytecode
const IBittyBuzzBytecode & m_bytecode
Definition: BittyBuzzVm.h:64
IUserInterface
Manages the user interface The user interface can consist of buttons, LED, serial print ports,...
Definition: IUserInterface.h:36
BittyBuzzVm::m_neighborsManager
IBittyBuzzNeighborsManager & m_neighborsManager
Definition: BittyBuzzVm.h:68
BittyBuzzMathFunctions::pow
void pow()
Calculates the base raised to the power of the exponent. Signature pow(base, exponent)
Definition: BittyBuzzMathFunctions.cpp:130
UserSegment
UserSegment
Definition: UserStates.h:4
BittyBuzzMathFunctions::PI
const float PI
The value of PI as a constant note that since it approximates cos(pi) may not equal 0.
Definition: BittyBuzzMathFunctions.h:22
Math::pow
float pow(float base, float exponent)
Calculates the base raised to the power of the exponent.
Definition: Math.cpp:22
BittyBuzzMessageHandler::handleFunctionDescriptionRequest
FunctionDescriptionResponseDTO handleFunctionDescriptionRequest(const FunctionDescriptionRequestDTO &functionDescRequest)
Definition: BittyBuzzMessageHandler.cpp:50
IBittyBuzzBytecode
Manages the BittyBuzz byte code.
Definition: IBittyBuzzBytecode.h:9
IBittyBuzzMessageHandler
Handles messages destined to the bbvm.
Definition: IBittyBuzzMessageHandler.h:8
BittyBuzzUserFunctions::toFloat
void toFloat()
Casts a type to float Signature float(arg1)
Definition: BittyBuzzUserFunctions.cpp:313
UserSegment::Zero
@ Zero
BittyBuzzMathFunctions::rng_uniform
void rng_uniform()
Return a number with a uniform distribution Signature rng_uniform()
Definition: BittyBuzzMathFunctions.cpp:283
IBittyBuzzMessageHandler::messageQueueLength
virtual uint16_t messageQueueLength() const =0
gets the number of message to be processed in the queue
BittyBuzzMessageHandler::m_closureRegister
const IBittyBuzzClosureRegister & m_closureRegister
Definition: BittyBuzzMessageHandler.h:29
IUserUI::setSegment
virtual void setSegment(UserSegment segment)=0
Set the user seven segment to a value.
BittyBuzzVm::BittyBuzzVm
BittyBuzzVm(const IBittyBuzzBytecode &bytecode, const IBittyBuzzStringResolver &stringResolver, IBittyBuzzMessageHandler &messageHandler, IBittyBuzzClosureRegister &closureRegister, IBittyBuzzMessageService &messageService, IBittyBuzzNeighborsManager &neighborsManager, IUserUI &userUI, IBSP &bsp, ILogger &logger, IUserInterface &ui)
The constructor of the bbvm.
Definition: BittyBuzzVm.cpp:9
BittyBuzzUserFunctions::isNil
void isNil()
Checks if a variable is nil Signature isnil(arg1)
Definition: BittyBuzzUserFunctions.cpp:236
BittyBuzzStringResolver.h
BittyBuzzUserFunctions::isFloat
void isFloat()
Checks if a variable is a float.
Definition: BittyBuzzUserFunctions.cpp:254
BittyBuzzMathFunctions::floorf
void floorf()
Floor a value Signature floorf(arg1)
Definition: BittyBuzzMathFunctions.cpp:56
BittyBuzzSystem::g_ui
IUserInterface * g_ui
UserInterface used by the bbvm for printing user logs.
Definition: BittyBuzzSystem.cpp:7
IBittyBuzzMessageService::callHostFunction
virtual bool callHostFunction(uint16_t agentId, const char *functionName, const FunctionCallArgumentDTO *args, uint16_t argsLength)=0
call a function to a host
IBittyBuzzClosureRegister::getRegisteredClosure
virtual std::optional< std::reference_wrapper< const BittyBuzzRegisteredClosure > > getRegisteredClosure(const char *functionName) const =0
get the id of a stored function by it's associated name
BittyBuzzMathFunctions::cos
void cos()
Calculates the cosine Signature cos(arg1)
Definition: BittyBuzzMathFunctions.cpp:181
BittyBuzzMessageHandler::handleMessage
bool handleMessage(const MessageDTO &message)
Definition: BittyBuzzMessageHandler.cpp:247
g_logger
static ILogger * g_logger
Definition: BittyBuzzBytecode.cpp:6
Math::pi
const float pi
Definition: Math.cpp:4
RelativePosition::m_distance
float m_distance
Distance in meters.
Definition: RelativePosition.h:12
BittyBuzzMessageService::m_buzzQueue
ICircularQueue< MessageDTO > & m_buzzQueue
Definition: BittyBuzzMessageService.h:38
BittyBuzzBytecode::m_bytecodeLength
const uint16_t m_bytecodeLength
Definition: BittyBuzzBytecode.h:22
BittyBuzzNeighborsManager::m_interloc
const IInterloc & m_interloc
Definition: BittyBuzzNeighborsManager.h:16
BittyBuzzVm::getError
bbzvm_error getError() const override
Get the error state of the VM.
Definition: BittyBuzzVm.cpp:124
foreachNameAndType
void foreachNameAndType(bbzheap_idx_t key, bbzheap_idx_t value, void *params)
Definition: BittyBuzzUserFunctions.cpp:50
MessageHandlerContainer.h
ILogger.h
BittyBuzzMathFunctions::sin
void sin()
Calculates the sine Signature sin(arg1)
Definition: BittyBuzzMathFunctions.cpp:168
BittyBuzzFunctionDescription::getArguments
const std::array< std::tuple< const char *, FunctionDescriptionArgumentTypeDTO >, FunctionDescriptionDTO::ARGUMENTS_MAX_SIZE > & getArguments() const
get the array of arguments description
Definition: BittyBuzzFunctionDescription.cpp:8
Math::sin
float sin(float x)
calculate the sine
Definition: Math.cpp:10
Math::sqrt
float sqrt(float x)
Calculates the square root.
Definition: Math.cpp:24
BittyBuzzUIFunctions::setLed
void setLed()
Sets the user LED on or off Signature set_led(arg1)
Definition: BittyBuzzUIFunctions.cpp:14
BBVMRet::VmErr
@ VmErr
Math::exp
float exp(float x)
Calculates the exponent.
Definition: Math.cpp:28