8#ifndef logger_types_telem_pokecenter_hpp
9#define logger_types_telem_pokecenter_hpp
39 const std::vector<float> &
poke_x,
40 const std::vector<float> &
poke_y
47 auto fb = telem_pokecenter_builder.
Finish();
64 const std::vector<float> &pokes
71 auto fb = telem_pokecenter_builder.
Finish();
76 std::vector<float>
poke_x( pokes.size() / 2 );
77 std::vector<float>
poke_y( pokes.size() / 2 );
79 for(
size_t n = 0; n <
poke_x.size(); ++n )
81 poke_x[n] = pokes[2 * n + 0];
82 poke_y[n] = pokes[2 * n + 1];
99 static_cast<size_t>( len ) );
108 static_cast<void>( len );
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] ?";
171 return fbs->measuring();
177 return fbs->pupil_x();
183 return fbs->pupil_y();
186 static std::vector<float>
poke_x(
void *msgBuffer )
188 std::vector<float> p;
192 if( fbs->poke_x() !=
nullptr )
194 for(
auto it = fbs->poke_x()->begin(); it != fbs->poke_x()->end(); ++it )
202 static std::vector<float>
poke_y(
void *msgBuffer )
204 std::vector<float> p;
208 if( fbs->poke_y() !=
nullptr )
210 for(
auto it = fbs->poke_y()->begin(); it != fbs->poke_y()->end(); ++it )
225 if( member ==
"measuring" )
232 else if( member ==
"pupil_x" )
237 reinterpret_cast<void *
>( &
pupil_x ),
239 else if( member ==
"pupil_y" )
244 reinterpret_cast<void *
>( &
pupil_y ),
246 else if( member ==
"poke_x" )
248 "actuator poke x, last is avg",
251 reinterpret_cast<void *
>( &
poke_x ),
253 else if( member ==
"poke_y" )
255 "actuator poke y, last is avg",
258 reinterpret_cast<void *
>( &
poke_y ),
262 std::cerr <<
"No member " << member <<
" in telem_pokecenter\n";
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.
static constexpr flatlogs::eventCodeT TELEM_POKECENTER
const MagAOX::logger::Telem_pokecenter_fb * GetTelem_pokecenter_fb(const void *buf)
inline ::flatbuffers::Offset< Telem_pokecenter_fb > CreateTelem_pokecenter_fb(::flatbuffers::FlatBufferBuilder &_fbb, uint8_t measuring=0, float pupil_x=0.0f, float pupil_y=0.0f, ::flatbuffers::Offset<::flatbuffers::Vector< float > > poke_x=0, ::flatbuffers::Offset<::flatbuffers::Vector< float > > poke_y=0)
bool VerifyTelem_pokecenter_fbBuffer(::flatbuffers::Verifier &verifier)
static constexpr logPrioT LOG_TELEM
A telemetry recording.
::flatbuffers::Offset< Telem_pokecenter_fb > Finish()
void add_measuring(uint8_t measuring)
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 float pupil_x(void *msgBuffer)
static std::string msgString(void *msgBuffer, flatlogs::msgLenT len)
Get the message formatted for human consumption.
static logMetaDetail getAccessor(const std::string &member)
Get the logMetaDetail for a member by name.
static float pupil_y(void *msgBuffer)
static bool verify(flatlogs::bufferPtrT &logBuff, flatlogs::msgLenT len)
static std::vector< float > poke_x(void *msgBuffer)
static std::vector< float > poke_y(void *msgBuffer)
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.
static bool measuring(void *msgBuffer)