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