8 #ifndef logger_types_telem_pokecenter_hpp
9 #define logger_types_telem_pokecenter_hpp
11 #include "generated/telem_pokecenter_generated.h"
38 const float & pupil_x,
39 const float & pupil_y,
40 const std::vector<float> & poke_x,
41 const std::vector<float> & poke_y
46 Telem_pokecenter_fbBuilder telem_pokecenter_builder(
builder);
47 telem_pokecenter_builder.add_measuring(measuring);
48 auto fb = telem_pokecenter_builder.Finish();
53 auto _poke_xs =
builder.CreateVector(poke_x);
54 auto _poke_ys =
builder.CreateVector(poke_y);
56 auto fb = CreateTelem_pokecenter_fb(
builder, measuring, pupil_x, pupil_y, _poke_xs, _poke_ys);
63 const float & pupil_x,
64 const float & pupil_y,
65 const std::vector<float> & pokes
70 Telem_pokecenter_fbBuilder telem_pokecenter_builder(
builder);
71 telem_pokecenter_builder.add_measuring(measuring);
72 auto fb = telem_pokecenter_builder.Finish();
77 std::vector<float> poke_x(pokes.size()/2);
78 std::vector<float> poke_y(pokes.size()/2);
80 for(
size_t n = 0; n < poke_x.size(); ++n)
82 poke_x[n] = pokes[2*n + 0];
83 poke_y[n] = pokes[2*n + 1];
86 auto _poke_xs =
builder.CreateVector(poke_x);
87 auto _poke_ys =
builder.CreateVector(poke_y);
89 auto fb = CreateTelem_pokecenter_fb(
builder, measuring, pupil_x, pupil_y, _poke_xs, _poke_ys);
100 return VerifyTelem_pokecenter_fbBuffer(verifier);
108 static_cast<void>(len);
110 auto fbs = GetTelem_pokecenter_fb(msgBuffer);
113 if(fbs->measuring() == 0)
115 msg =
"not measuring";
119 if(fbs->measuring() == 1)
130 msg += std::to_string(fbs->pupil_x());
132 msg += std::to_string(fbs->pupil_y());
135 if( fbs->poke_x() && fbs->poke_y() )
137 if(fbs->poke_x()->size() == fbs->poke_y()->size())
139 size_t N = fbs->poke_x()->size();
141 msg +=
" [poke-avg] ";
142 msg += std::to_string(fbs->poke_x()->Get(N-1));
144 msg += std::to_string(fbs->poke_y()->Get(N-1));
147 for(
size_t i=0; i< N-1; ++i)
150 msg += std::to_string(fbs->poke_x()->Get(i));
152 msg += std::to_string(fbs->poke_y()->Get(i));
157 msg +=
" [poke-avg] ? [pokes] ?";
162 msg +=
" [poke-avg] ? [pokes] ?";
The MagAO-X logger flatbuffer log base type.
uint16_t eventCodeT
The type of an event code (16-bit unsigned int).
msgLen2T msgLenT
The type used to refer to the message length, regardless of length.
int8_t logPrioT
The type of the log priority code.
static void * messageBuffer(bufferPtrT &logBuffer)
Get the message buffer address.
std::shared_ptr< char > bufferPtrT
The log entry buffer smart pointer.
constexpr static logPrioT LOG_TELEM
A telemetry recording.
Message type for resolving log messages with a f.b. builder.
flatbuffers::FlatBufferBuilder builder
Base class for logs consisting of a flatbuffer message.
The type of the input message.
messageT(const uint8_t &measuring, const float &pupil_x, const float &pupil_y, const std::vector< float > &pokes)
Construct from components with single vector for pokes.
messageT(const uint8_t &measuring, const float &pupil_x, const float &pupil_y, const std::vector< float > &poke_x, const std::vector< float > &poke_y)
Construct from components.
Log entry recording DM poke centering results.
static const flatlogs::logPrioT defaultLevel
The default level.
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatted for human consumption.
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static const flatlogs::eventCodeT eventCode
The event code.
static timespec lastRecord
The time of the last time this log was recorded. Used by the telemetry system.