CTRE Phoenix 6 C++ 26.3.0
Loading...
Searching...
No Matches
SignalLogger.hpp
Go to the documentation of this file.
1/*
2 * Copyright (C) Cross The Road Electronics.  All rights reserved.
3 * License information can be found in CTRE_LICENSE.txt
4 * For support and suggestions contact support@ctr-electronics.com or file
5 * an issue tracker at https://github.com/CrossTheRoadElec/Phoenix-Releases
6 */
7#pragma once
8
11#include <units/time.h>
12#include <array>
13#include <span>
14#include <string>
15
16#if __has_include("wpi/struct/Struct.h")
17#include "wpi/struct/Struct.h"
18#include "wpi/SmallVector.h"
19#endif
20#if __has_include("wpi/protobuf/Protobuf.h")
21#include "wpi/protobuf/Protobuf.h"
22#include "wpi/SmallVector.h"
23#endif
24
25namespace ctre {
26namespace phoenix6 {
27
28/**
29 * \brief Static class for controlling the Phoenix 6 signal logger.
30 *
31 * This logs all the signals from the CAN buses into .hoot files. Each file name starts with the
32 * CANivore serial number or "rio" for the roboRIO CAN bus, followed by the timestamp. In the
33 * header of a hoot file, the CANivore name and firmware version are logged in plain text.
34 *
35 * During an FRC match, the log file will be renamed to include the event name, match type, and
36 * match number at the start of the file name. The match type will be 'P' for practice matches,
37 * 'Q' for qualification matches, and 'E' for elimination matches.
38 *
39 * During Hoot Replay, the signal logger always runs while replay is running. All custom signals
40 * written during replay will be automatically placed under `hoot_replay/`. Additionally, the log
41 * will contain all status signals and custom signals from the original log.
42 */
44public:
45 /**
46 * \brief Sets the destination for logging, restarting logger if the path changed.
47 *
48 * If this is not called or the path is left empty, the default path will be used. The
49 * default path on the roboRIO is a logs folder on the first USB flash drive found, or
50 * /home/lvuser/logs if none is available. The default path on all other platforms is
51 * a logs folder in the current working directory.
52 *
53 * Typical use for this routine is to use a removable USB flash drive for logging.
54 *
55 * This is ignored during Hoot Replay, where the hoot log will always be written to a
56 * subfolder next to the log being replayed.
57 *
58 * \param path Folder path for the log files; path must exist
59 * \returns Status of setting the path and restarting the log
60 */
61 static ctre::phoenix::StatusCode SetPath(const char *path);
62 /**
63 * \brief Starts logging status signals. Starts regardless of auto logging status.
64 *
65 * If using a roboRIO 1, we recommend setting the logging path to an external drive
66 * using #SetPath to avoid running out of internal storage space.
67 *
68 * This is ignored during Hoot Replay, where logging is automatically started when
69 * Hoot Replay starts running or restarts.
70 *
71 * \returns Status of starting the logger
72 */
74 /**
75 * \brief Stops logging status signals. Stops regardless of auto logging status.
76 *
77 * This is ignored during Hoot Replay, where logging is automatically stopped when
78 * Hoot Replay is stopped or reaches the end of the file.
79 *
80 * \returns Status of stopping the logger
81 */
83 /**
84 * \brief Enables or disables auto logging.
85 *
86 * Auto logging is enabled by default on the roboRIO and disabled by default on
87 * other systems. Additionally, on a roboRIO 1, auto logging will only be active
88 * if a USB flash drive is present.
89 *
90 * When auto logging is enabled, logging is started by any of the following
91 * (whichever occurs first):
92 *
93 * - It has been at least 1 second since program startup (allowing for calls to
94 * #SetPath), and the robot is enabled.
95 *
96 * - It has been at least 5 seconds since program startup (allowing for calls to
97 * #SetPath), and the Driver Station is connected to the robot (if on a roboRIO).
98 *
99 * After auto logging has started the log once, logging will not be automatically
100 * stopped or restarted by auto logging.
101 *
102 * \param enable Whether to enable auto logging
103 * \returns Status of auto logging enable/disable
104 */
106
107 /**
108 * \brief Adds the schema to the log file.
109 *
110 * In an FRC robot program, users can call WriteStruct and WriteProtobuf
111 * to directly write schema values instead.
112 *
113 * The schema name should typically exactly match the name of the type
114 * (without any extra prefix or suffix).
115 *
116 * For protobuf, first register all relevant file descriptors by file name
117 * (such as "geometry2d.proto"). Then, for each top-level type being used,
118 * add a separate empty schema with the full name of the type (such as
119 * "wpi.proto.ProtobufPose2d").
120 *
121 * \param name Name of the schema
122 * \param type Type of the schema, such as struct or protobuf
123 * \param schema Schema bytes to write
124 * \returns Status of adding the schema
125 */
126 static ctre::phoenix::StatusCode AddSchema(std::string_view name, HootSchemaType type, std::span<uint8_t const> schema);
127 /**
128 * \brief Adds the schema to the log file.
129 *
130 * In an FRC robot program, users can call WriteStruct and WriteProtobuf
131 * to directly write schema values instead.
132 *
133 * The schema name should typically exactly match the name of the type
134 * (without any extra prefix or suffix).
135 *
136 * For protobuf, first register all relevant file descriptors by file name
137 * (such as "geometry2d.proto"). Then, for each top-level type being used,
138 * add a separate empty schema with the full name of the type (such as
139 * "wpi.proto.ProtobufPose2d").
140 *
141 * \param name Name of the schema
142 * \param type Type of the schema, such as struct or protobuf
143 * \param schema Schema string to write
144 * \returns Status of adding the schema
145 */
146 static ctre::phoenix::StatusCode AddSchema(std::string_view name, HootSchemaType type, std::string_view schema)
147 {
148 return AddSchema(name, type, {(uint8_t const *)schema.data(), schema.size()});
149 }
150
151 /**
152 * \brief Checks if the schema has already been added to the log files.
153 *
154 * \param name Name of the schema
155 * \param type Type of the schema, such as struct or protobuf
156 * \returns Whether the schema has been added to the log files
157 */
158 static bool HasSchema(std::string_view name, HootSchemaType type);
159
160 /**
161 * \brief Writes the schema-serialized bytes to the log file.
162 *
163 * In an FRC robot program, users can call #WriteStruct, #WriteStructArray,
164 * and #WriteProtobuf to directly write schema values instead.
165 *
166 * The name of the associated schema must exactly match the type of the
167 * data (such as "Pose2d" or "wpi.proto.ProtobufPose2d"). Additionally, the
168 * schema name must be registered with #AddSchema before calling this API.
169 *
170 * \param name Name of the signal
171 * \param schema Name of the associated schema
172 * \param type Type of the associated schema, such as struct or protobuf
173 * \param data Span of serialized data bytes
174 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
175 * from the current time to get the timestamp written to the log
176 * \returns Status of writing the data
177 */
178 static ctre::phoenix::StatusCode WriteSchemaValue(std::string_view name, std::string_view schema, HootSchemaType type, std::span<uint8_t const> data, units::time::second_t latencySeconds = 0_s)
179 {
180 return WriteSchemaValue_Impl(name, schema, type, data, latencySeconds.value());
181 }
182
183#if __has_include("wpi/struct/Struct.h") || defined(_CTRE_DOCS_)
184 /**
185 * \brief Writes the WPILib Struct to the log file.
186 *
187 * \param name Name of the signal
188 * \param value Value to write
189 * \param info Optional struct type info
190 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
191 * from the current time to get the timestamp written to the log
192 * \returns Status of writing the data
193 */
194 template <typename T, typename... I>
195 requires wpi::StructSerializable<T, I...>
196 static ctre::phoenix::StatusCode WriteStruct(std::string_view name, T const &value, I const &... info, units::time::second_t latencySeconds = 0_s)
197 {
198 using S = wpi::Struct<T, I...>;
199
200 auto const typeName = S::GetTypeName(info...);
201
202 if (!HasSchema(typeName, HootSchemaType::Struct)) {
203 if constexpr (wpi::HasNestedStruct<T, I...>) {
204 S::ForEachNested([](std::string_view typeName, auto schema) {
205 if (typeName.starts_with("struct:")) {
206 typeName.remove_prefix(7);
207 }
208 if (!HasSchema(typeName, HootSchemaType::Struct)) {
209 AddSchema(typeName, HootSchemaType::Struct, schema);
210 }
211 }, info...);
212 }
213 AddSchema(typeName, HootSchemaType::Struct, S::GetSchema(info...));
214 }
215
216 if constexpr (sizeof...(I) == 0) {
217 if constexpr (wpi::is_constexpr([] { S::GetSize(); })) {
218 std::array<uint8_t, S::GetSize()> data;
219 S::Pack(data, value);
220 return WriteSchemaValue(name, typeName, HootSchemaType::Struct, data, latencySeconds);
221 }
222 }
223
224 wpi::SmallVector<uint8_t, 128> buf;
225 buf.resize_for_overwrite(S::GetSize(info...));
226 S::Pack(buf, value, info...);
227 return WriteSchemaValue(name, typeName, HootSchemaType::Struct, buf, latencySeconds);
228 }
229
230 /**
231 * \brief Writes the array of WPILib Structs to the log file.
232 *
233 * \param name Name of the signal
234 * \param values Values to write
235 * \param info Optional struct type info
236 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
237 * from the current time to get the timestamp written to the log
238 * \returns Status of writing the data
239 */
240 template <typename T, typename... I>
241 requires wpi::StructSerializable<T, I...>
242 static ctre::phoenix::StatusCode WriteStructArray(std::string_view name, std::span<T const> values, I const &... info, units::time::second_t latencySeconds = 0_s)
243 {
244 using S = wpi::Struct<T, I...>;
245
246 auto const typeName = MakeStructArrayTypeName<T, std::dynamic_extent>(info...);
247
248 if (!HasSchema(typeName, HootSchemaType::Struct)) {
249 wpi::ForEachStructSchema<T>([](std::string_view typeName, auto schema) {
250 if (typeName.starts_with("struct:")) {
251 typeName.remove_prefix(7);
252 }
253 if (!HasSchema(typeName, HootSchemaType::Struct)) {
254 AddSchema(typeName, HootSchemaType::Struct, schema);
255 }
256 }, info...);
257 AddSchema(typeName, HootSchemaType::Struct, "");
258 }
259
260 auto const size = S::GetSize(info...);
261 wpi::SmallVector<uint8_t, 256> buf;
262 buf.resize_for_overwrite(size * values.size());
263
264 uint8_t *out = buf.data();
265 for (auto &&val : values) {
266 S::Pack(
267 std::span<uint8_t>{out, size},
268 std::forward<decltype(val)>(val), info...
269 );
270 out += size;
271 }
272 return WriteSchemaValue(name, typeName, HootSchemaType::Struct, buf, latencySeconds);
273 }
274#endif
275
276#if __has_include("wpi/protobuf/Protobuf.h") || defined(_CTRE_DOCS_)
277 /**
278 * \brief Writes the protobuf to the log file.
279 *
280 * \param name Name of the signal
281 * \param value Value to write
282 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
283 * from the current time to get the timestamp written to the log
284 * \returns Status of writing the data
285 */
286 template <wpi::ProtobufSerializable T>
287 static ctre::phoenix::StatusCode WriteProtobuf(std::string_view name, T const &value, units::time::second_t latencySeconds = 0_s)
288 {
289 std::string_view const typeName = wpi::Protobuf<std::remove_cvref_t<T>>::MessageStruct::msg_descriptor()->proto_name;
290
291 wpi::ProtobufMessage<T> proto;
292 if (!HasSchema(typeName, HootSchemaType::Protobuf)) {
293 proto.ForEachProtobufDescriptor(
294 [](std::string_view typeName) {
295 if (typeName.starts_with("proto:")) {
296 typeName.remove_prefix(6);
297 }
298 return HasSchema(typeName, HootSchemaType::Protobuf);
299 },
300 [](std::string_view typeName, auto schema) {
301 if (typeName.starts_with("proto:")) {
302 typeName.remove_prefix(6);
303 }
304 AddSchema(typeName, HootSchemaType::Protobuf, schema);
305 }
306 );
307 AddSchema(typeName, HootSchemaType::Protobuf, "");
308 }
309
310 wpi::SmallVector<uint8_t, 128> buf;
311 proto.Pack(buf, value);
312 return WriteSchemaValue(name, typeName, HootSchemaType::Protobuf, buf, latencySeconds);
313 }
314#endif
315
316 /**
317 * \brief Writes the raw data bytes to the log file.
318 *
319 * \param name Name of the signal
320 * \param data Span of raw data bytes
321 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
322 * from the current time to get the timestamp written to the log
323 * \returns Status of writing the data
324 */
325 static ctre::phoenix::StatusCode WriteRaw(std::string_view name, std::span<uint8_t const> data, units::time::second_t latencySeconds = 0_s)
326 {
327 return WriteRaw_Impl(name, data, latencySeconds.value());
328 }
329 /**
330 * \brief Writes the boolean to the log file.
331 *
332 * \param name Name of the signal
333 * \param value Value to write
334 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
335 * from the current time to get the timestamp written to the log
336 * \returns Status of writing the data
337 */
338 static ctre::phoenix::StatusCode WriteBoolean(std::string_view name, bool value, units::time::second_t latencySeconds = 0_s)
339 {
340 return WriteBoolean_Impl(name, value, latencySeconds.value());
341 }
342 /**
343 * \brief Writes the integer to the log file.
344 *
345 * \param name Name of the signal
346 * \param value Value to write
347 * \param units Units of the signal
348 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
349 * from the current time to get the timestamp written to the log
350 * \returns Status of writing the data
351 */
352 static ctre::phoenix::StatusCode WriteInteger(std::string_view name, int64_t value, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
353 {
354 return WriteInteger_Impl(name, value, units, latencySeconds.value());
355 }
356 /**
357 * \brief Writes the float to the log file.
358 *
359 * \param name Name of the signal
360 * \param value Value to write
361 * \param units Units of the signal
362 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
363 * from the current time to get the timestamp written to the log
364 * \returns Status of writing the data
365 */
366 static ctre::phoenix::StatusCode WriteFloat(std::string_view name, float value, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
367 {
368 return WriteFloat_Impl(name, value, units, latencySeconds.value());
369 }
370 /**
371 * \brief Writes the double to the log file.
372 *
373 * \param name Name of the signal
374 * \param value Value to write
375 * \param units Units of the signal
376 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
377 * from the current time to get the timestamp written to the log
378 * \returns Status of writing the data
379 */
380 static ctre::phoenix::StatusCode WriteDouble(std::string_view name, double value, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
381 {
382 return WriteDouble_Impl(name, value, units, latencySeconds.value());
383 }
384 /**
385 * \brief Writes the string to the log file.
386 *
387 * \param name Name of the signal
388 * \param value Value to write
389 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
390 * from the current time to get the timestamp written to the log
391 * \returns Status of writing the data
392 */
393 static ctre::phoenix::StatusCode WriteString(std::string_view name, std::string_view value, units::time::second_t latencySeconds = 0_s)
394 {
395 return WriteString_Impl(name, value, latencySeconds.value());
396 }
397
398 /**
399 * \brief Writes the unit value to the log file.
400 *
401 * \param name Name of the signal
402 * \param value Value to write
403 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
404 * from the current time to get the timestamp written to the log
405 * \returns Status of writing the data
406 */
407 template <typename U>
408 requires units::traits::is_unit_t_v<U>
409 static ctre::phoenix::StatusCode WriteValue(std::string_view name, U value, units::time::second_t latencySeconds = 0_s)
410 {
411 return WriteDouble(name, value.value(), units::abbreviation(value), latencySeconds);
412 }
413
414 /**
415 * \brief Writes the array of booleans to the log file.
416 *
417 * \param name Name of the signal
418 * \param values Span of values to write
419 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
420 * from the current time to get the timestamp written to the log
421 * \returns Status of writing the data
422 */
423 static ctre::phoenix::StatusCode WriteBooleanArray(std::string_view name, std::span<bool const> values, units::time::second_t latencySeconds = 0_s)
424 {
425 return WriteBooleanArray_Impl(name, values, latencySeconds.value());
426 }
427 /**
428 * \brief Writes the array of booleans to the log file.
429 *
430 * \param name Name of the signal
431 * \param values Span of values to write, passed as a span of bytes
432 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
433 * from the current time to get the timestamp written to the log
434 * \returns Status of writing the data
435 */
436 static ctre::phoenix::StatusCode WriteBooleanArray(std::string_view name, std::span<uint8_t const> values, units::time::second_t latencySeconds = 0_s)
437 {
438 return WriteBooleanArray_Impl(name, values, latencySeconds.value());
439 }
440
441 /**
442 * \brief Writes the array of integers to the log file.
443 *
444 * \param name Name of the signal
445 * \param values Span of values to write
446 * \param units Units of the signals
447 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
448 * from the current time to get the timestamp written to the log
449 * \returns Status of writing the data
450 */
451 static ctre::phoenix::StatusCode WriteIntegerArray(std::string_view name, std::span<int64_t const> values, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
452 {
453 return WriteIntegerArray_Impl(name, values, units, latencySeconds.value());
454 }
455
456 /**
457 * \brief Writes the array of floats to the log file.
458 *
459 * \param name Name of the signal
460 * \param values Span of values to write
461 * \param units Units of the signals
462 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
463 * from the current time to get the timestamp written to the log
464 * \returns Status of writing the data
465 */
466 static ctre::phoenix::StatusCode WriteFloatArray(std::string_view name, std::span<float const> values, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
467 {
468 return WriteFloatArray_Impl(name, values, units, latencySeconds.value());
469 }
470
471 /**
472 * \brief Writes the array of doubles to the log file.
473 *
474 * \param name Name of the signal
475 * \param values Span of values to write
476 * \param units Units of the signals
477 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
478 * from the current time to get the timestamp written to the log
479 * \returns Status of writing the data
480 */
481 static ctre::phoenix::StatusCode WriteDoubleArray(std::string_view name, std::span<double const> values, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
482 {
483 return WriteDoubleArray_Impl(name, values, units, latencySeconds.value());
484 }
485
486 /**
487 * \brief Writes the array of strings to the log file.
488 *
489 * \param name Name of the signal
490 * \param values Span of values to write
491 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
492 * from the current time to get the timestamp written to the log
493 * \returns Status of writing the data
494 */
495 static ctre::phoenix::StatusCode WriteStringArray(std::string_view name, std::span<std::string_view const> values, units::time::second_t latencySeconds = 0_s)
496 {
497 return WriteStringArray_Impl(name, values, latencySeconds.value());
498 }
499 /**
500 * \brief Writes the array of strings to the log file.
501 *
502 * \param name Name of the signal
503 * \param values Span of values to write
504 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
505 * from the current time to get the timestamp written to the log
506 * \returns Status of writing the data
507 */
508 static ctre::phoenix::StatusCode WriteStringArray(std::string_view name, std::span<std::string const> values, units::time::second_t latencySeconds = 0_s)
509 {
510 return WriteStringArray_Impl(name, values, latencySeconds.value());
511 }
512
513private:
514 static ctre::phoenix::StatusCode WriteRaw_Impl(std::string_view name, std::span<uint8_t const> data, double latencySeconds);
515 static ctre::phoenix::StatusCode WriteBoolean_Impl(std::string_view name, bool value, double latencySeconds);
516 static ctre::phoenix::StatusCode WriteInteger_Impl(std::string_view name, int64_t value, std::string_view units, double latencySeconds);
517 static ctre::phoenix::StatusCode WriteFloat_Impl(std::string_view name, float value, std::string_view units, double latencySeconds);
518 static ctre::phoenix::StatusCode WriteDouble_Impl(std::string_view name, double value, std::string_view units, double latencySeconds);
519 static ctre::phoenix::StatusCode WriteString_Impl(std::string_view name, std::string_view value, double latencySeconds);
520
521 static ctre::phoenix::StatusCode WriteBooleanArray_Impl(std::string_view name, std::span<bool const> values, double latencySeconds)
522 {
523 static_assert(sizeof(bool) == sizeof(uint8_t), "bool is not uint8_t");
524 return WriteBooleanArray_Impl(name, std::span{(uint8_t const *)values.data(), values.size()}, latencySeconds);
525 }
526 static ctre::phoenix::StatusCode WriteBooleanArray_Impl(std::string_view name, std::span<uint8_t const> values, double latencySeconds);
527 static ctre::phoenix::StatusCode WriteIntegerArray_Impl(std::string_view name, std::span<int64_t const> values, std::string_view units, double latencySeconds);
528 static ctre::phoenix::StatusCode WriteFloatArray_Impl(std::string_view name, std::span<float const> values, std::string_view units, double latencySeconds);
529 static ctre::phoenix::StatusCode WriteDoubleArray_Impl(std::string_view name, std::span<double const> values, std::string_view units, double latencySeconds);
530 static ctre::phoenix::StatusCode WriteStringArray_Impl(std::string_view name, std::span<std::string_view const> values, double latencySeconds);
531 static ctre::phoenix::StatusCode WriteStringArray_Impl(std::string_view name, std::span<std::string const> values, double latencySeconds);
532
533 static ctre::phoenix::StatusCode WriteSchemaValue_Impl(std::string_view name, std::string_view schema, HootSchemaType type, std::span<uint8_t const> data, double latencySeconds);
534
535#if __has_include("wpi/struct/Struct.h")
536 template <typename T, size_t N, typename... I>
537 requires wpi::StructSerializable<T, I...>
538 static constexpr auto MakeStructArrayTypeName(I const &... info) {
539 using namespace wpi;
541 if constexpr (
542 sizeof...(I) == 0 &&
543 is_constexpr([&info...] { S::GetTypeName(info...); })
544 ) {
545 constexpr auto typeName = S::GetTypeName(info...);
546 using namespace literals;
547 if constexpr (N == std::dynamic_extent) {
548 return Concat(
549 ct_string<char, std::char_traits<char>, typeName.size()>{typeName},
550 "[]"_ct_string
551 );
552 } else {
553 return Concat(
554 ct_string<char, std::char_traits<char>, typeName.size()>{typeName},
555 "["_ct_string, NumToCtString<N>(), "]"_ct_string
556 );
557 }
558 } else {
559 if constexpr (N == std::dynamic_extent) {
560 return fmt::format("{}[]", S::GetTypeName(info...));
561 } else {
562 return fmt::format("{}[{}]", S::GetTypeName(info...), N);
563 }
564 }
565 }
566#endif
567};
568
569}
570}
Static class for controlling the Phoenix 6 signal logger.
Definition SignalLogger.hpp:43
static ctre::phoenix::StatusCode WriteBooleanArray(std::string_view name, std::span< bool const > values, units::time::second_t latencySeconds=0_s)
Writes the array of booleans to the log file.
Definition SignalLogger.hpp:423
static ctre::phoenix::StatusCode WriteValue(std::string_view name, U value, units::time::second_t latencySeconds=0_s)
Writes the unit value to the log file.
Definition SignalLogger.hpp:409
static ctre::phoenix::StatusCode WriteBoolean(std::string_view name, bool value, units::time::second_t latencySeconds=0_s)
Writes the boolean to the log file.
Definition SignalLogger.hpp:338
static ctre::phoenix::StatusCode WriteBooleanArray(std::string_view name, std::span< uint8_t const > values, units::time::second_t latencySeconds=0_s)
Writes the array of booleans to the log file.
Definition SignalLogger.hpp:436
static ctre::phoenix::StatusCode WriteStructArray(std::string_view name, std::span< T const > values, I const &... info, units::time::second_t latencySeconds=0_s)
Writes the array of WPILib Structs to the log file.
Definition SignalLogger.hpp:242
static bool HasSchema(std::string_view name, HootSchemaType type)
Checks if the schema has already been added to the log files.
static ctre::phoenix::StatusCode WriteStringArray(std::string_view name, std::span< std::string const > values, units::time::second_t latencySeconds=0_s)
Writes the array of strings to the log file.
Definition SignalLogger.hpp:508
static ctre::phoenix::StatusCode WriteStruct(std::string_view name, T const &value, I const &... info, units::time::second_t latencySeconds=0_s)
Writes the WPILib Struct to the log file.
Definition SignalLogger.hpp:196
static ctre::phoenix::StatusCode WriteString(std::string_view name, std::string_view value, units::time::second_t latencySeconds=0_s)
Writes the string to the log file.
Definition SignalLogger.hpp:393
static ctre::phoenix::StatusCode SetPath(const char *path)
Sets the destination for logging, restarting logger if the path changed.
static ctre::phoenix::StatusCode AddSchema(std::string_view name, HootSchemaType type, std::string_view schema)
Adds the schema to the log file.
Definition SignalLogger.hpp:146
static ctre::phoenix::StatusCode WriteSchemaValue(std::string_view name, std::string_view schema, HootSchemaType type, std::span< uint8_t const > data, units::time::second_t latencySeconds=0_s)
Writes the schema-serialized bytes to the log file.
Definition SignalLogger.hpp:178
static ctre::phoenix::StatusCode WriteDoubleArray(std::string_view name, std::span< double const > values, std::string_view units="", units::time::second_t latencySeconds=0_s)
Writes the array of doubles to the log file.
Definition SignalLogger.hpp:481
static ctre::phoenix::StatusCode WriteProtobuf(std::string_view name, T const &value, units::time::second_t latencySeconds=0_s)
Writes the protobuf to the log file.
Definition SignalLogger.hpp:287
static ctre::phoenix::StatusCode WriteStringArray(std::string_view name, std::span< std::string_view const > values, units::time::second_t latencySeconds=0_s)
Writes the array of strings to the log file.
Definition SignalLogger.hpp:495
static ctre::phoenix::StatusCode WriteRaw(std::string_view name, std::span< uint8_t const > data, units::time::second_t latencySeconds=0_s)
Writes the raw data bytes to the log file.
Definition SignalLogger.hpp:325
static ctre::phoenix::StatusCode WriteInteger(std::string_view name, int64_t value, std::string_view units="", units::time::second_t latencySeconds=0_s)
Writes the integer to the log file.
Definition SignalLogger.hpp:352
static ctre::phoenix::StatusCode WriteDouble(std::string_view name, double value, std::string_view units="", units::time::second_t latencySeconds=0_s)
Writes the double to the log file.
Definition SignalLogger.hpp:380
static ctre::phoenix::StatusCode Stop()
Stops logging status signals.
static ctre::phoenix::StatusCode WriteFloatArray(std::string_view name, std::span< float const > values, std::string_view units="", units::time::second_t latencySeconds=0_s)
Writes the array of floats to the log file.
Definition SignalLogger.hpp:466
static ctre::phoenix::StatusCode WriteIntegerArray(std::string_view name, std::span< int64_t const > values, std::string_view units="", units::time::second_t latencySeconds=0_s)
Writes the array of integers to the log file.
Definition SignalLogger.hpp:451
static ctre::phoenix::StatusCode WriteFloat(std::string_view name, float value, std::string_view units="", units::time::second_t latencySeconds=0_s)
Writes the float to the log file.
Definition SignalLogger.hpp:366
static ctre::phoenix::StatusCode EnableAutoLogging(bool enable)
Enables or disables auto logging.
static ctre::phoenix::StatusCode Start()
Starts logging status signals.
static ctre::phoenix::StatusCode AddSchema(std::string_view name, HootSchemaType type, std::span< uint8_t const > schema)
Adds the schema to the log file.
Status codes reported by APIs, including OK, warnings, and errors.
Definition StatusCodes.h:28
HootSchemaType
Supported schema types for a hoot user signal.
Definition HootSchemaType.hpp:15
@ Struct
Serialize using the WPILib Struct format.
@ Protobuf
Serialize using the Protobuf format.
Definition motor_constants.h:14