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