CTRE Phoenix 6 C++ 26.0.0-beta-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 <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 wpi::ForEachStructSchema<T>([](std::string_view typeName, auto schema) {
199 if (typeName.starts_with("struct:")) {
200 typeName.remove_prefix(7);
201 }
202 if (!HasSchema(typeName, HootSchemaType::Struct)) {
203 AddSchema(typeName, HootSchemaType::Struct, schema);
204 }
205 }, info...);
206
207 if constexpr (sizeof...(I) == 0) {
208 if constexpr (wpi::is_constexpr([] { S::GetSize(); })) {
209 std::array<uint8_t, S::GetSize()> data;
210 S::Pack(data, value);
211 return WriteSchemaValue(name, S::GetTypeName(), HootSchemaType::Struct, data, latencySeconds);
212 }
213 }
214
215 wpi::SmallVector<uint8_t, 128> buf;
216 buf.resize_for_overwrite(S::GetSize(info...));
217 S::Pack(buf, value, info...);
218 return WriteSchemaValue(name, S::GetTypeName(), HootSchemaType::Struct, buf, latencySeconds);
219 }
220
221 /**
222 * \brief Writes the array of WPILib Structs to the log file.
223 *
224 * \param name Name of the signal
225 * \param values Values to write
226 * \param info Optional struct type info
227 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
228 * from the current time to get the timestamp written to the log
229 * \returns Status of writing the data
230 */
231 template <typename T, typename... I>
232 requires wpi::StructSerializable<T, I...>
233 static ctre::phoenix::StatusCode WriteStructArray(std::string_view name, std::span<T const> values, I const &... info, units::time::second_t latencySeconds = 0_s)
234 {
235 using S = wpi::Struct<T, I...>;
236
237 auto const typeName = wpi::MakeStructArrayTypeName<T, std::dynamic_extent>(info...);
238
239 if (!HasSchema(typeName, HootSchemaType::Struct)) {
240 wpi::ForEachStructSchema<T>([](std::string_view typeName, auto schema) {
241 if (typeName.starts_with("struct:")) {
242 typeName.remove_prefix(7);
243 }
244 if (!HasSchema(typeName, HootSchemaType::Struct)) {
245 AddSchema(typeName, HootSchemaType::Struct, schema);
246 }
247 }, info...);
248 AddSchema(typeName, HootSchemaType::Struct, "");
249 }
250
251 auto const size = S::GetSize(info...);
252 wpi::SmallVector<uint8_t, 256> buf;
253 buf.resize_for_overwrite(size * values.size());
254
255 uint8_t *out = buf.data();
256 for (auto &&val : values) {
257 S::Pack(
258 std::span<uint8_t>{out, size},
259 std::forward<decltype(val)>(val), info...
260 );
261 out += size;
262 }
263 return WriteSchemaValue(name, typeName, HootSchemaType::Struct, buf, latencySeconds);
264 }
265#endif
266
267#if __has_include("wpi/protobuf/Protobuf.h") || defined(_CTRE_DOCS_)
268 /**
269 * \brief Writes the protobuf to the log file.
270 *
271 * \param name Name of the signal
272 * \param value Value to write
273 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
274 * from the current time to get the timestamp written to the log
275 * \returns Status of writing the data
276 */
277 template <wpi::ProtobufSerializable T>
278 static ctre::phoenix::StatusCode WriteProtobuf(std::string_view name, T const &value, units::time::second_t latencySeconds = 0_s)
279 {
280 std::string_view const typeName = wpi::Protobuf<std::remove_cvref_t<T>>::MessageStruct::msg_descriptor()->proto_name;
281
282 wpi::ProtobufMessage<T> proto;
283 proto.ForEachProtobufDescriptor(
284 [](std::string_view typeName) {
285 if (typeName.starts_with("proto:")) {
286 typeName.remove_prefix(6);
287 }
288 return HasSchema(typeName, HootSchemaType::Protobuf);
289 },
290 [](std::string_view typeName, auto schema) {
291 if (typeName.starts_with("proto:")) {
292 typeName.remove_prefix(6);
293 }
294 AddSchema(typeName, HootSchemaType::Protobuf, schema);
295 }
296 );
297 AddSchema(typeName, HootSchemaType::Protobuf, "");
298
299 wpi::SmallVector<uint8_t, 128> buf;
300 proto.Pack(buf, value);
301 return WriteSchemaValue(name, typeName, HootSchemaType::Protobuf, buf, latencySeconds);
302 }
303#endif
304
305 /**
306 * \brief Writes the raw data bytes to the log file.
307 *
308 * \param name Name of the signal
309 * \param data Span of raw data bytes
310 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
311 * from the current time to get the timestamp written to the log
312 * \returns Status of writing the data
313 */
314 static ctre::phoenix::StatusCode WriteRaw(std::string_view name, std::span<uint8_t const> data, units::time::second_t latencySeconds = 0_s)
315 {
316 return WriteRaw_Impl(name, data, latencySeconds.value());
317 }
318 /**
319 * \brief Writes the boolean to the log file.
320 *
321 * \param name Name of the signal
322 * \param value Value to write
323 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
324 * from the current time to get the timestamp written to the log
325 * \returns Status of writing the data
326 */
327 static ctre::phoenix::StatusCode WriteBoolean(std::string_view name, bool value, units::time::second_t latencySeconds = 0_s)
328 {
329 return WriteBoolean_Impl(name, value, latencySeconds.value());
330 }
331 /**
332 * \brief Writes the integer to the log file.
333 *
334 * \param name Name of the signal
335 * \param value Value to write
336 * \param units Units of the signal
337 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
338 * from the current time to get the timestamp written to the log
339 * \returns Status of writing the data
340 */
341 static ctre::phoenix::StatusCode WriteInteger(std::string_view name, int64_t value, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
342 {
343 return WriteInteger_Impl(name, value, units, latencySeconds.value());
344 }
345 /**
346 * \brief Writes the float to the log file.
347 *
348 * \param name Name of the signal
349 * \param value Value to write
350 * \param units Units of the signal
351 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
352 * from the current time to get the timestamp written to the log
353 * \returns Status of writing the data
354 */
355 static ctre::phoenix::StatusCode WriteFloat(std::string_view name, float value, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
356 {
357 return WriteFloat_Impl(name, value, units, latencySeconds.value());
358 }
359 /**
360 * \brief Writes the double to the log file.
361 *
362 * \param name Name of the signal
363 * \param value Value to write
364 * \param units Units of the signal
365 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
366 * from the current time to get the timestamp written to the log
367 * \returns Status of writing the data
368 */
369 static ctre::phoenix::StatusCode WriteDouble(std::string_view name, double value, std::string_view units = "", units::time::second_t latencySeconds = 0_s)
370 {
371 return WriteDouble_Impl(name, value, units, latencySeconds.value());
372 }
373 /**
374 * \brief Writes the string to the log file.
375 *
376 * \param name Name of the signal
377 * \param value Value to write
378 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
379 * from the current time to get the timestamp written to the log
380 * \returns Status of writing the data
381 */
382 static ctre::phoenix::StatusCode WriteString(std::string_view name, std::string_view value, units::time::second_t latencySeconds = 0_s)
383 {
384 return WriteString_Impl(name, value, latencySeconds.value());
385 }
386
387 /**
388 * \brief Writes the unit value to the log file.
389 *
390 * \param name Name of the signal
391 * \param value Value to write
392 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
393 * from the current time to get the timestamp written to the log
394 * \returns Status of writing the data
395 */
396 template <typename U>
397 requires units::traits::is_unit_t_v<U>
398 static ctre::phoenix::StatusCode WriteValue(std::string_view name, U value, units::time::second_t latencySeconds = 0_s)
399 {
400 return WriteDouble(name, value.value(), units::abbreviation(value), latencySeconds);
401 }
402
403 /**
404 * \brief Writes the array of booleans to the log file.
405 *
406 * \param name Name of the signal
407 * \param values Span of values to write
408 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
409 * from the current time to get the timestamp written to the log
410 * \returns Status of writing the data
411 */
412 static ctre::phoenix::StatusCode WriteBooleanArray(std::string_view name, std::span<bool const> values, units::time::second_t latencySeconds = 0_s)
413 {
414 return WriteBooleanArray_Impl(name, values, latencySeconds.value());
415 }
416 /**
417 * \brief Writes the array of booleans to the log file.
418 *
419 * \param name Name of the signal
420 * \param values Span of values to write, passed as a span of bytes
421 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
422 * from the current time to get the timestamp written to the log
423 * \returns Status of writing the data
424 */
425 static ctre::phoenix::StatusCode WriteBooleanArray(std::string_view name, std::span<uint8_t const> values, units::time::second_t latencySeconds = 0_s)
426 {
427 return WriteBooleanArray_Impl(name, values, latencySeconds.value());
428 }
429
430 /**
431 * \brief Writes the array of integers to the log file.
432 *
433 * \param name Name of the signal
434 * \param values Span of values to write
435 * \param units Units of the signals
436 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
437 * from the current time to get the timestamp written to the log
438 * \returns Status of writing the data
439 */
440 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)
441 {
442 return WriteIntegerArray_Impl(name, values, units, latencySeconds.value());
443 }
444
445 /**
446 * \brief Writes the array of floats to the log file.
447 *
448 * \param name Name of the signal
449 * \param values Span of values to write
450 * \param units Units of the signals
451 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
452 * from the current time to get the timestamp written to the log
453 * \returns Status of writing the data
454 */
455 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)
456 {
457 return WriteFloatArray_Impl(name, values, units, latencySeconds.value());
458 }
459
460 /**
461 * \brief Writes the array of doubles to the log file.
462 *
463 * \param name Name of the signal
464 * \param values Span of values to write
465 * \param units Units of the signals
466 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
467 * from the current time to get the timestamp written to the log
468 * \returns Status of writing the data
469 */
470 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)
471 {
472 return WriteDoubleArray_Impl(name, values, units, latencySeconds.value());
473 }
474
475 /**
476 * \brief Writes the array of strings to the log file.
477 *
478 * \param name Name of the signal
479 * \param values Span of values to write
480 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
481 * from the current time to get the timestamp written to the log
482 * \returns Status of writing the data
483 */
484 static ctre::phoenix::StatusCode WriteStringArray(std::string_view name, std::span<std::string_view const> values, units::time::second_t latencySeconds = 0_s)
485 {
486 return WriteStringArray_Impl(name, values, latencySeconds.value());
487 }
488 /**
489 * \brief Writes the array of strings to the log file.
490 *
491 * \param name Name of the signal
492 * \param values Span of values to write
493 * \param latencySeconds Latency of the signal in seconds; this value is subtracted
494 * from the current time to get the timestamp written to the log
495 * \returns Status of writing the data
496 */
497 static ctre::phoenix::StatusCode WriteStringArray(std::string_view name, std::span<std::string const> values, units::time::second_t latencySeconds = 0_s)
498 {
499 return WriteStringArray_Impl(name, values, latencySeconds.value());
500 }
501
502private:
503 static ctre::phoenix::StatusCode WriteRaw_Impl(std::string_view name, std::span<uint8_t const> data, double latencySeconds);
504 static ctre::phoenix::StatusCode WriteBoolean_Impl(std::string_view name, bool value, double latencySeconds);
505 static ctre::phoenix::StatusCode WriteInteger_Impl(std::string_view name, int64_t value, std::string_view units, double latencySeconds);
506 static ctre::phoenix::StatusCode WriteFloat_Impl(std::string_view name, float value, std::string_view units, double latencySeconds);
507 static ctre::phoenix::StatusCode WriteDouble_Impl(std::string_view name, double value, std::string_view units, double latencySeconds);
508 static ctre::phoenix::StatusCode WriteString_Impl(std::string_view name, std::string_view value, double latencySeconds);
509
510 static ctre::phoenix::StatusCode WriteBooleanArray_Impl(std::string_view name, std::span<bool const> values, double latencySeconds)
511 {
512 static_assert(sizeof(bool) == sizeof(uint8_t), "bool is not uint8_t");
513 return WriteBooleanArray_Impl(name, std::span{(uint8_t const *)values.data(), values.size()}, latencySeconds);
514 }
515 static ctre::phoenix::StatusCode WriteBooleanArray_Impl(std::string_view name, std::span<uint8_t const> values, double latencySeconds);
516 static ctre::phoenix::StatusCode WriteIntegerArray_Impl(std::string_view name, std::span<int64_t const> values, std::string_view units, double latencySeconds);
517 static ctre::phoenix::StatusCode WriteFloatArray_Impl(std::string_view name, std::span<float const> values, std::string_view units, double latencySeconds);
518 static ctre::phoenix::StatusCode WriteDoubleArray_Impl(std::string_view name, std::span<double const> values, std::string_view units, double latencySeconds);
519 static ctre::phoenix::StatusCode WriteStringArray_Impl(std::string_view name, std::span<std::string_view const> values, double latencySeconds);
520 static ctre::phoenix::StatusCode WriteStringArray_Impl(std::string_view name, std::span<std::string const> values, double latencySeconds);
521
522 static ctre::phoenix::StatusCode WriteSchemaValue_Impl(std::string_view name, std::string_view schema, HootSchemaType type, std::span<uint8_t const> data, double latencySeconds);
523};
524
525}
526}
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:412
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:398
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:327
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:425
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:233
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:497
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:382
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:470
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:278
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:484
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:314
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:341
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:369
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:455
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:440
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:355
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