CTRE Phoenix 6 C++ 26.2.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 only supported on the roboRIO. Additionally, on a roboRIO 1,
87 * auto logging will only be active if a USB flash drive is present.
88 *
89 * When auto logging is enabled, logging is started by any of the following
90 * (whichever occurs first):
91 *
92 * - The robot is enabled.
93 *
94 * - It has been at least 5 seconds since program startup (allowing for calls
95 * to #SetPath), and the Driver Station is connected to the robot.
96 *
97 * After auto logging has started the log once, logging will not be automatically
98 * stopped or restarted by auto logging.
99 *
100 * \param enable Whether to enable auto logging
101 * \returns Status of auto logging enable/disable
102 */
104
105 /**
106 * \brief Adds the schema to the log file.
107 *
108 * In an FRC robot program, users can call WriteStruct and WriteProtobuf
109 * to directly write schema values instead.
110 *
111 * The schema name should typically exactly match the name of the type
112 * (without any extra prefix or suffix).
113 *
114 * For protobuf, first register all relevant file descriptors by file name
115 * (such as "geometry2d.proto"). Then, for each top-level type being used,
116 * add a separate empty schema with the full name of the type (such as
117 * "wpi.proto.ProtobufPose2d").
118 *
119 * \param name Name of the schema
120 * \param type Type of the schema, such as struct or protobuf
121 * \param schema Schema bytes to write
122 * \returns Status of adding the schema
123 */
124 static ctre::phoenix::StatusCode AddSchema(std::string_view name, HootSchemaType type, std::span<uint8_t const> schema);
125 /**
126 * \brief Adds the schema to the log file.
127 *
128 * In an FRC robot program, users can call WriteStruct and WriteProtobuf
129 * to directly write schema values instead.
130 *
131 * The schema name should typically exactly match the name of the type
132 * (without any extra prefix or suffix).
133 *
134 * For protobuf, first register all relevant file descriptors by file name
135 * (such as "geometry2d.proto"). Then, for each top-level type being used,
136 * add a separate empty schema with the full name of the type (such as
137 * "wpi.proto.ProtobufPose2d").
138 *
139 * \param name Name of the schema
140 * \param type Type of the schema, such as struct or protobuf
141 * \param schema Schema string to write
142 * \returns Status of adding the schema
143 */
144 static ctre::phoenix::StatusCode AddSchema(std::string_view name, HootSchemaType type, std::string_view schema)
145 {
146 return AddSchema(name, type, {(uint8_t const *)schema.data(), schema.size()});
147 }
148
149 /**
150 * \brief Checks if the schema has already been added to the log files.
151 *
152 * \param name Name of the schema
153 * \param type Type of the schema, such as struct or protobuf
154 * \returns Whether the schema has been added to the log files
155 */
156 static bool HasSchema(std::string_view name, HootSchemaType type);
157
158 /**
159 * \brief Writes the schema-serialized bytes to the log file.
160 *
161 * In an FRC robot program, users can call #WriteStruct, #WriteStructArray,
162 * and #WriteProtobuf to directly write schema values instead.
163 *
164 * The name of the associated schema must exactly match the type of the
165 * data (such as "Pose2d" or "wpi.proto.ProtobufPose2d"). Additionally, the
166 * schema name must be registered with #AddSchema before calling this API.
167 *
168 * \param name Name of the signal
169 * \param schema Name of the associated schema
170 * \param type Type of the associated schema, such as struct or protobuf
171 * \param data Span of serialized data bytes
172 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
173 * from the current time to get the timestamp written to the log
174 * \returns Status of writing the data
175 */
176 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)
177 {
178 return WriteSchemaValue_Impl(name, schema, type, data, latencySeconds.value());
179 }
180
181#if __has_include("wpi/struct/Struct.h") || defined(_CTRE_DOCS_)
182 /**
183 * \brief Writes the WPILib Struct to the log file.
184 *
185 * \param name Name of the signal
186 * \param value Value to write
187 * \param info Optional struct type info
188 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
189 * from the current time to get the timestamp written to the log
190 * \returns Status of writing the data
191 */
192 template <typename T, typename... I>
193 requires wpi::StructSerializable<T, I...>
194 static ctre::phoenix::StatusCode WriteStruct(std::string_view name, T const &value, I const &... info, units::time::second_t latencySeconds = 0_s)
195 {
196 using S = wpi::Struct<T, I...>;
197
198 auto const typeName = S::GetTypeName(info...);
199
200 if (!HasSchema(typeName, HootSchemaType::Struct)) {
201 if constexpr (wpi::HasNestedStruct<T, I...>) {
202 S::ForEachNested([](std::string_view typeName, auto schema) {
203 if (typeName.starts_with("struct:")) {
204 typeName.remove_prefix(7);
205 }
206 if (!HasSchema(typeName, HootSchemaType::Struct)) {
207 AddSchema(typeName, HootSchemaType::Struct, schema);
208 }
209 }, info...);
210 }
211 AddSchema(typeName, HootSchemaType::Struct, S::GetSchema(info...));
212 }
213
214 if constexpr (sizeof...(I) == 0) {
215 if constexpr (wpi::is_constexpr([] { S::GetSize(); })) {
216 std::array<uint8_t, S::GetSize()> data;
217 S::Pack(data, value);
218 return WriteSchemaValue(name, typeName, HootSchemaType::Struct, data, latencySeconds);
219 }
220 }
221
222 wpi::SmallVector<uint8_t, 128> buf;
223 buf.resize_for_overwrite(S::GetSize(info...));
224 S::Pack(buf, value, info...);
225 return WriteSchemaValue(name, typeName, HootSchemaType::Struct, buf, latencySeconds);
226 }
227
228 /**
229 * \brief Writes the array of WPILib Structs to the log file.
230 *
231 * \param name Name of the signal
232 * \param values Values to write
233 * \param info Optional struct type info
234 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
235 * from the current time to get the timestamp written to the log
236 * \returns Status of writing the data
237 */
238 template <typename T, typename... I>
239 requires wpi::StructSerializable<T, I...>
240 static ctre::phoenix::StatusCode WriteStructArray(std::string_view name, std::span<T const> values, I const &... info, units::time::second_t latencySeconds = 0_s)
241 {
242 using S = wpi::Struct<T, I...>;
243
244 auto const typeName = MakeStructArrayTypeName<T, std::dynamic_extent>(info...);
245
246 if (!HasSchema(typeName, HootSchemaType::Struct)) {
247 wpi::ForEachStructSchema<T>([](std::string_view typeName, auto schema) {
248 if (typeName.starts_with("struct:")) {
249 typeName.remove_prefix(7);
250 }
251 if (!HasSchema(typeName, HootSchemaType::Struct)) {
252 AddSchema(typeName, HootSchemaType::Struct, schema);
253 }
254 }, info...);
255 AddSchema(typeName, HootSchemaType::Struct, "");
256 }
257
258 auto const size = S::GetSize(info...);
259 wpi::SmallVector<uint8_t, 256> buf;
260 buf.resize_for_overwrite(size * values.size());
261
262 uint8_t *out = buf.data();
263 for (auto &&val : values) {
264 S::Pack(
265 std::span<uint8_t>{out, size},
266 std::forward<decltype(val)>(val), info...
267 );
268 out += size;
269 }
270 return WriteSchemaValue(name, typeName, HootSchemaType::Struct, buf, latencySeconds);
271 }
272#endif
273
274#if __has_include("wpi/protobuf/Protobuf.h") || defined(_CTRE_DOCS_)
275 /**
276 * \brief Writes the protobuf to the log file.
277 *
278 * \param name Name of the signal
279 * \param value Value to write
280 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
281 * from the current time to get the timestamp written to the log
282 * \returns Status of writing the data
283 */
284 template <wpi::ProtobufSerializable T>
285 static ctre::phoenix::StatusCode WriteProtobuf(std::string_view name, T const &value, units::time::second_t latencySeconds = 0_s)
286 {
287 std::string_view const typeName = wpi::Protobuf<std::remove_cvref_t<T>>::MessageStruct::msg_descriptor()->proto_name;
288
289 wpi::ProtobufMessage<T> proto;
290 if (!HasSchema(typeName, HootSchemaType::Protobuf)) {
291 proto.ForEachProtobufDescriptor(
292 [](std::string_view typeName) {
293 if (typeName.starts_with("proto:")) {
294 typeName.remove_prefix(6);
295 }
296 return HasSchema(typeName, HootSchemaType::Protobuf);
297 },
298 [](std::string_view typeName, auto schema) {
299 if (typeName.starts_with("proto:")) {
300 typeName.remove_prefix(6);
301 }
302 AddSchema(typeName, HootSchemaType::Protobuf, schema);
303 }
304 );
305 AddSchema(typeName, HootSchemaType::Protobuf, "");
306 }
307
308 wpi::SmallVector<uint8_t, 128> buf;
309 proto.Pack(buf, value);
310 return WriteSchemaValue(name, typeName, HootSchemaType::Protobuf, buf, latencySeconds);
311 }
312#endif
313
314 /**
315 * \brief Writes the raw data bytes to the log file.
316 *
317 * \param name Name of the signal
318 * \param data Span of raw data bytes
319 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
320 * from the current time to get the timestamp written to the log
321 * \returns Status of writing the data
322 */
323 static ctre::phoenix::StatusCode WriteRaw(std::string_view name, std::span<uint8_t const> data, units::time::second_t latencySeconds = 0_s)
324 {
325 return WriteRaw_Impl(name, data, latencySeconds.value());
326 }
327 /**
328 * \brief Writes the boolean to the log file.
329 *
330 * \param name Name of the signal
331 * \param value Value to write
332 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
333 * from the current time to get the timestamp written to the log
334 * \returns Status of writing the data
335 */
336 static ctre::phoenix::StatusCode WriteBoolean(std::string_view name, bool value, units::time::second_t latencySeconds = 0_s)
337 {
338 return WriteBoolean_Impl(name, value, latencySeconds.value());
339 }
340 /**
341 * \brief Writes the integer to the log file.
342 *
343 * \param name Name of the signal
344 * \param value Value to write
345 * \param units Units of the signal
346 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
347 * from the current time to get the timestamp written to the log
348 * \returns Status of writing the data
349 */
350 static ctre::phoenix::StatusCode WriteInteger(std::string_view name, int64_t value, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
351 {
352 return WriteInteger_Impl(name, value, units, latencySeconds.value());
353 }
354 /**
355 * \brief Writes the float to the log file.
356 *
357 * \param name Name of the signal
358 * \param value Value to write
359 * \param units Units of the signal
360 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
361 * from the current time to get the timestamp written to the log
362 * \returns Status of writing the data
363 */
364 static ctre::phoenix::StatusCode WriteFloat(std::string_view name, float value, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
365 {
366 return WriteFloat_Impl(name, value, units, latencySeconds.value());
367 }
368 /**
369 * \brief Writes the double to the log file.
370 *
371 * \param name Name of the signal
372 * \param value Value to write
373 * \param units Units of the signal
374 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
375 * from the current time to get the timestamp written to the log
376 * \returns Status of writing the data
377 */
378 static ctre::phoenix::StatusCode WriteDouble(std::string_view name, double value, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
379 {
380 return WriteDouble_Impl(name, value, units, latencySeconds.value());
381 }
382 /**
383 * \brief Writes the string to the log file.
384 *
385 * \param name Name of the signal
386 * \param value Value to write
387 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
388 * from the current time to get the timestamp written to the log
389 * \returns Status of writing the data
390 */
391 static ctre::phoenix::StatusCode WriteString(std::string_view name, std::string_view value, units::time::second_t latencySeconds = 0_s)
392 {
393 return WriteString_Impl(name, value, latencySeconds.value());
394 }
395
396 /**
397 * \brief Writes the unit value to the log file.
398 *
399 * \param name Name of the signal
400 * \param value Value to write
401 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
402 * from the current time to get the timestamp written to the log
403 * \returns Status of writing the data
404 */
405 template <typename U>
406 requires units::traits::is_unit_t_v<U>
407 static ctre::phoenix::StatusCode WriteValue(std::string_view name, U value, units::time::second_t latencySeconds = 0_s)
408 {
409 return WriteDouble(name, value.value(), units::abbreviation(value), latencySeconds);
410 }
411
412 /**
413 * \brief Writes the array of booleans to the log file.
414 *
415 * \param name Name of the signal
416 * \param values Span of values to write
417 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
418 * from the current time to get the timestamp written to the log
419 * \returns Status of writing the data
420 */
421 static ctre::phoenix::StatusCode WriteBooleanArray(std::string_view name, std::span<bool const> values, units::time::second_t latencySeconds = 0_s)
422 {
423 return WriteBooleanArray_Impl(name, values, latencySeconds.value());
424 }
425 /**
426 * \brief Writes the array of booleans to the log file.
427 *
428 * \param name Name of the signal
429 * \param values Span of values to write, passed as a span of bytes
430 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
431 * from the current time to get the timestamp written to the log
432 * \returns Status of writing the data
433 */
434 static ctre::phoenix::StatusCode WriteBooleanArray(std::string_view name, std::span<uint8_t const> values, units::time::second_t latencySeconds = 0_s)
435 {
436 return WriteBooleanArray_Impl(name, values, latencySeconds.value());
437 }
438
439 /**
440 * \brief Writes the array of integers to the log file.
441 *
442 * \param name Name of the signal
443 * \param values Span of values to write
444 * \param units Units of the signals
445 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
446 * from the current time to get the timestamp written to the log
447 * \returns Status of writing the data
448 */
449 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)
450 {
451 return WriteIntegerArray_Impl(name, values, units, latencySeconds.value());
452 }
453
454 /**
455 * \brief Writes the array of floats to the log file.
456 *
457 * \param name Name of the signal
458 * \param values Span of values to write
459 * \param units Units of the signals
460 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
461 * from the current time to get the timestamp written to the log
462 * \returns Status of writing the data
463 */
464 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)
465 {
466 return WriteFloatArray_Impl(name, values, units, latencySeconds.value());
467 }
468
469 /**
470 * \brief Writes the array of doubles to the log file.
471 *
472 * \param name Name of the signal
473 * \param values Span of values to write
474 * \param units Units of the signals
475 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
476 * from the current time to get the timestamp written to the log
477 * \returns Status of writing the data
478 */
479 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)
480 {
481 return WriteDoubleArray_Impl(name, values, units, latencySeconds.value());
482 }
483
484 /**
485 * \brief Writes the array of strings to the log file.
486 *
487 * \param name Name of the signal
488 * \param values Span of values to write
489 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
490 * from the current time to get the timestamp written to the log
491 * \returns Status of writing the data
492 */
493 static ctre::phoenix::StatusCode WriteStringArray(std::string_view name, std::span<std::string_view const> values, units::time::second_t latencySeconds = 0_s)
494 {
495 return WriteStringArray_Impl(name, values, latencySeconds.value());
496 }
497 /**
498 * \brief Writes the array of strings to the log file.
499 *
500 * \param name Name of the signal
501 * \param values Span of values to write
502 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
503 * from the current time to get the timestamp written to the log
504 * \returns Status of writing the data
505 */
506 static ctre::phoenix::StatusCode WriteStringArray(std::string_view name, std::span<std::string const> values, units::time::second_t latencySeconds = 0_s)
507 {
508 return WriteStringArray_Impl(name, values, latencySeconds.value());
509 }
510
511private:
512 static ctre::phoenix::StatusCode WriteRaw_Impl(std::string_view name, std::span<uint8_t const> data, double latencySeconds);
513 static ctre::phoenix::StatusCode WriteBoolean_Impl(std::string_view name, bool value, double latencySeconds);
514 static ctre::phoenix::StatusCode WriteInteger_Impl(std::string_view name, int64_t value, std::string_view units, double latencySeconds);
515 static ctre::phoenix::StatusCode WriteFloat_Impl(std::string_view name, float value, std::string_view units, double latencySeconds);
516 static ctre::phoenix::StatusCode WriteDouble_Impl(std::string_view name, double value, std::string_view units, double latencySeconds);
517 static ctre::phoenix::StatusCode WriteString_Impl(std::string_view name, std::string_view value, double latencySeconds);
518
519 static ctre::phoenix::StatusCode WriteBooleanArray_Impl(std::string_view name, std::span<bool const> values, double latencySeconds)
520 {
521 static_assert(sizeof(bool) == sizeof(uint8_t), "bool is not uint8_t");
522 return WriteBooleanArray_Impl(name, std::span{(uint8_t const *)values.data(), values.size()}, latencySeconds);
523 }
524 static ctre::phoenix::StatusCode WriteBooleanArray_Impl(std::string_view name, std::span<uint8_t const> values, double latencySeconds);
525 static ctre::phoenix::StatusCode WriteIntegerArray_Impl(std::string_view name, std::span<int64_t const> values, std::string_view units, double latencySeconds);
526 static ctre::phoenix::StatusCode WriteFloatArray_Impl(std::string_view name, std::span<float const> values, std::string_view units, double latencySeconds);
527 static ctre::phoenix::StatusCode WriteDoubleArray_Impl(std::string_view name, std::span<double const> values, std::string_view units, double latencySeconds);
528 static ctre::phoenix::StatusCode WriteStringArray_Impl(std::string_view name, std::span<std::string_view const> values, double latencySeconds);
529 static ctre::phoenix::StatusCode WriteStringArray_Impl(std::string_view name, std::span<std::string const> values, double latencySeconds);
530
531 static ctre::phoenix::StatusCode WriteSchemaValue_Impl(std::string_view name, std::string_view schema, HootSchemaType type, std::span<uint8_t const> data, double latencySeconds);
532
533#if __has_include("wpi/struct/Struct.h")
534 template <typename T, size_t N, typename... I>
535 requires wpi::StructSerializable<T, I...>
536 static constexpr auto MakeStructArrayTypeName(I const &... info) {
537 using namespace wpi;
539 if constexpr (
540 sizeof...(I) == 0 &&
541 is_constexpr([&info...] { S::GetTypeName(info...); })
542 ) {
543 constexpr auto typeName = S::GetTypeName(info...);
544 using namespace literals;
545 if constexpr (N == std::dynamic_extent) {
546 return Concat(
547 ct_string<char, std::char_traits<char>, typeName.size()>{typeName},
548 "[]"_ct_string
549 );
550 } else {
551 return Concat(
552 ct_string<char, std::char_traits<char>, typeName.size()>{typeName},
553 "["_ct_string, NumToCtString<N>(), "]"_ct_string
554 );
555 }
556 } else {
557 if constexpr (N == std::dynamic_extent) {
558 return fmt::format("{}[]", S::GetTypeName(info...));
559 } else {
560 return fmt::format("{}[{}]", S::GetTypeName(info...), N);
561 }
562 }
563 }
564#endif
565};
566
567}
568}
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:421
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:407
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:336
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:434
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:240
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:506
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:194
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:391
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:144
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:176
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:479
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:285
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:493
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:323
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:350
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:378
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:464
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:449
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:364
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