Servo control

This commit is contained in:
2025-07-15 10:59:48 -04:00
parent cf5be03188
commit d3e42e8dff
20 changed files with 309 additions and 531 deletions

View File

@@ -0,0 +1,11 @@
//
// Created by Johnathon Slightham on 2025-06-30.
//
#include "AngleControlMessageBuilder.h"
namespace Flatbuffers {
const Messaging::AngleControlMessage* AngleControlMessageBuilder::parse_angle_control_message(const uint8_t* buffer) {
return flatbuffers::GetRoot<Messaging::AngleControlMessage>(buffer);
}
}

View File

@@ -1,2 +1,2 @@
idf_component_register(SRCS "MPIMessageBuilder.cpp"
idf_component_register(SRCS "MPIMessageBuilder.cpp" "AngleControlMessageBuilder.cpp"
INCLUDE_DIRS "include")

View File

@@ -0,0 +1,22 @@
//
// Created by Johnathon Slightham on 2025-06-30.
//
#ifndef ANGLECONTROLMESSAGEBUILDER_H_
#define ANGLECONTROLMESSAGEBUILDER_H_
#include <string>
#include <vector>
#include "SerializedMessage.h"
#include "flatbuffers_generated/AngleControlMessage_generated.h"
#include "flatbuffers/flatbuffers.h"
namespace Flatbuffers {
class AngleControlMessageBuilder {
public:
static const Messaging::AngleControlMessage* parse_angle_control_message(const uint8_t* buffer);
};
}
#endif

View File

@@ -0,0 +1,94 @@
// automatically generated by the FlatBuffers compiler, do not modify
#ifndef FLATBUFFERS_GENERATED_ANGLECONTROLMESSAGE_MESSAGING_H_
#define FLATBUFFERS_GENERATED_ANGLECONTROLMESSAGE_MESSAGING_H_
#include "flatbuffers/flatbuffers.h"
// Ensure the included flatbuffers.h is the same version as when this file was
// generated, otherwise it may not be compatible.
//static_assert(FLATBUFFERS_VERSION_MAJOR == 25 &&
//FLATBUFFERS_VERSION_MINOR == 2 &&
//FLATBUFFERS_VERSION_REVISION == 10,
//"Non-compatible flatbuffers version included");
namespace Messaging {
struct AngleControlMessage;
struct AngleControlMessageBuilder;
struct AngleControlMessage FLATBUFFERS_FINAL_CLASS : private ::flatbuffers::Table {
typedef AngleControlMessageBuilder Builder;
enum FlatBuffersVTableOffset FLATBUFFERS_VTABLE_UNDERLYING_TYPE {
VT_ANGLE = 4
};
int16_t angle() const {
return GetField<int16_t>(VT_ANGLE, 0);
}
bool Verify(::flatbuffers::Verifier &verifier) const {
return VerifyTableStart(verifier) &&
VerifyField<int16_t>(verifier, VT_ANGLE, 2) &&
verifier.EndTable();
}
};
struct AngleControlMessageBuilder {
typedef AngleControlMessage Table;
::flatbuffers::FlatBufferBuilder &fbb_;
::flatbuffers::uoffset_t start_;
void add_angle(int16_t angle) {
fbb_.AddElement<int16_t>(AngleControlMessage::VT_ANGLE, angle, 0);
}
explicit AngleControlMessageBuilder(::flatbuffers::FlatBufferBuilder &_fbb)
: fbb_(_fbb) {
start_ = fbb_.StartTable();
}
::flatbuffers::Offset<AngleControlMessage> Finish() {
const auto end = fbb_.EndTable(start_);
auto o = ::flatbuffers::Offset<AngleControlMessage>(end);
return o;
}
};
inline ::flatbuffers::Offset<AngleControlMessage> CreateAngleControlMessage(
::flatbuffers::FlatBufferBuilder &_fbb,
int16_t angle = 0) {
AngleControlMessageBuilder builder_(_fbb);
builder_.add_angle(angle);
return builder_.Finish();
}
inline const Messaging::AngleControlMessage *GetAngleControlMessage(const void *buf) {
return ::flatbuffers::GetRoot<Messaging::AngleControlMessage>(buf);
}
inline const Messaging::AngleControlMessage *GetSizePrefixedAngleControlMessage(const void *buf) {
return ::flatbuffers::GetSizePrefixedRoot<Messaging::AngleControlMessage>(buf);
}
inline bool VerifyAngleControlMessageBuffer(
::flatbuffers::Verifier &verifier) {
return verifier.VerifyBuffer<Messaging::AngleControlMessage>(nullptr);
}
inline bool VerifySizePrefixedAngleControlMessageBuffer(
::flatbuffers::Verifier &verifier) {
return verifier.VerifySizePrefixedBuffer<Messaging::AngleControlMessage>(nullptr);
}
inline void FinishAngleControlMessageBuffer(
::flatbuffers::FlatBufferBuilder &fbb,
::flatbuffers::Offset<Messaging::AngleControlMessage> root) {
fbb.Finish(root);
}
inline void FinishSizePrefixedAngleControlMessageBuffer(
::flatbuffers::FlatBufferBuilder &fbb,
::flatbuffers::Offset<Messaging::AngleControlMessage> root) {
fbb.FinishSizePrefixed(root);
}
} // namespace Messaging
#endif // FLATBUFFERS_GENERATED_ANGLECONTROLMESSAGE_MESSAGING_H_