[robotpy] Mirror most other subprojects (#8208)

GitOrigin-RevId: ac60fd3cf4a24023184376687da28373d14b781a

This mirrors the robotpy files for the following projects:
- apriltag
- datalog
- hal
- ntcore
- romiVendordep
- wpilibc
- wpimath
- xrpVendordep

This excludes cscore and the halsim wrappers for at this time.

NOTE: This does not hook these projects up to the build system, just simply mirrors the files. The building will take place in a follow up PR to make it easier to review the changes necessary to build.
This commit is contained in:
PJ Reiniger
2025-10-24 01:28:04 -04:00
committed by GitHub
parent 8992dcdc99
commit 44b9cc1398
545 changed files with 27293 additions and 38 deletions

View File

@@ -0,0 +1,431 @@
# defaults:
# ignore: true
# report_ignored_missing: false
enums:
ControlRecordType:
classes:
wpi::log::DataLog:
attributes:
kBlockSize:
s_defaultMessageLog:
ignore: true
m_msglog:
ignore: true
methods:
DataLog:
ignore: true
Flush:
Pause:
Resume:
Stop:
HasSchema:
AddSchema:
overloads:
std::string_view, std::string_view, std::span<const uint8_t>, int64_t:
std::string_view, std::string_view, std::string_view, int64_t:
AddProtobufSchema:
ignore: true
AddStructSchema:
param_override:
info:
name: type
cpp_code: |
[](DataLog &self, const py::type &t, int64_t timestamp) {
WPyStructInfo info(t);
return self.AddStructSchema<WPyStruct, WPyStructInfo>(info, timestamp);
}
Start:
Finish:
SetMetadata:
AppendRaw:
AppendRaw2:
AppendBoolean:
AppendInteger:
AppendFloat:
AppendDouble:
AppendString:
AppendBooleanArray:
overloads:
int, std::span<const bool>, int64_t:
int, std::span<const int>, int64_t:
ignore: true
int, std::span<const uint8_t>, int64_t:
ignore: true
AppendIntegerArray:
AppendFloatArray:
AppendDoubleArray:
AppendStringArray:
overloads:
int, std::span<const std::string>, int64_t:
ignore: true
int, std::span<const std::string_view>, int64_t:
int, std::span<const struct WPI_String>, int64_t:
ignore: true
StartFile:
FlushBufs:
ignore: true
ReleaseBufs:
ignore: true
BufferHalfFull:
BufferFull:
wpi::log::DataLogEntry:
force_no_trampoline: true
methods:
SetMetadata:
Finish:
wpi::log::DataLogValueEntryImpl:
template_params:
- T
force_no_trampoline: true
attributes:
m_mutex:
ignore: true
m_lastValue:
ignore: true
methods:
HasLastValue:
GetLastValue:
DataLogValueEntryImpl:
overloads:
"":
ignore: true
DataLog&, std::string_view, std::string_view, std::string_view, int64_t:
wpi::log::RawLogEntry:
force_no_trampoline: true
attributes:
kDataType:
methods:
RawLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, std::string_view, int64_t:
Append:
Update:
wpi::log::BooleanLogEntry:
force_no_trampoline: true
attributes:
kDataType:
methods:
BooleanLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
Append:
Update:
wpi::log::IntegerLogEntry:
force_no_trampoline: true
attributes:
kDataType:
methods:
IntegerLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
Append:
Update:
wpi::log::FloatLogEntry:
force_no_trampoline: true
attributes:
kDataType:
methods:
FloatLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
Append:
Update:
wpi::log::DoubleLogEntry:
force_no_trampoline: true
attributes:
kDataType:
methods:
DoubleLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
Append:
Update:
wpi::log::StringLogEntry:
force_no_trampoline: true
attributes:
kDataType:
methods:
StringLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, std::string_view, int64_t:
Append:
Update:
wpi::log::BooleanArrayLogEntry:
force_no_trampoline: true
attributes:
kDataType:
methods:
BooleanArrayLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
Append:
overloads:
std::span<const bool>, int64_t:
std::initializer_list<bool>, int64_t:
ignore: true
std::span<const int>, int64_t:
ignore: true
std::initializer_list<int>, int64_t:
ignore: true
std::span<const uint8_t>, int64_t:
ignore: true
Update:
overloads:
std::span<const bool>, int64_t:
std::initializer_list<bool>, int64_t:
ignore: true
std::span<const int>, int64_t:
std::initializer_list<int>, int64_t:
ignore: true
std::span<const uint8_t>, int64_t:
ignore: true
wpi::log::IntegerArrayLogEntry:
force_no_trampoline: true
attributes:
kDataType:
methods:
IntegerArrayLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
Append:
overloads:
std::span<const int64_t>, int64_t:
std::initializer_list<int64_t>, int64_t:
ignore: true
Update:
overloads:
std::span<const int64_t>, int64_t:
std::initializer_list<int64_t>, int64_t:
ignore: true
wpi::log::FloatArrayLogEntry:
force_no_trampoline: true
attributes:
kDataType:
methods:
FloatArrayLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
Append:
overloads:
std::span<const float>, int64_t:
std::initializer_list<float>, int64_t:
ignore: true
Update:
overloads:
std::span<const float>, int64_t:
std::initializer_list<float>, int64_t:
ignore: true
wpi::log::DoubleArrayLogEntry:
force_no_trampoline: true
attributes:
kDataType:
methods:
DoubleArrayLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
Append:
overloads:
std::span<const double>, int64_t:
std::initializer_list<double>, int64_t:
ignore: true
Update:
overloads:
std::span<const double>, int64_t:
std::initializer_list<double>, int64_t:
ignore: true
wpi::log::StringArrayLogEntry:
force_no_trampoline: true
attributes:
kDataType:
methods:
StringArrayLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
Append:
overloads:
std::span<const std::string>, int64_t:
ignore: true
std::span<const std::string_view>, int64_t:
std::initializer_list<std::string_view>, int64_t:
ignore: true
Update:
overloads:
std::span<const std::string>, int64_t:
ignore: true
std::span<const std::string_view>, int64_t:
std::initializer_list<std::string_view>, int64_t:
ignore: true
wpi::log::StructLogEntry:
force_no_trampoline: true
template_params:
- T
- I
methods:
StructLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, I..., int64_t:
param_override:
info:
name: type
cpp_code: |
[](DataLog &log, std::string_view name, const py::type &t, int64_t timestamp) {
WPyStructInfo info(t);
return std::make_shared<StructLogEntry<WPyStruct, WPyStructInfo>>(log, name, info, timestamp);
}
DataLog&, std::string_view, std::string_view, I..., int64_t:
param_override:
info:
name: type
cpp_code: |
[](DataLog &log, std::string_view name, std::string_view metadata, const py::type &t, int64_t timestamp) {
WPyStructInfo info(t);
return std::make_shared<StructLogEntry<WPyStruct, WPyStructInfo>>(log, name, metadata, info, timestamp);
}
Append:
Update:
HasLastValue:
GetLastValue:
wpi::log::StructArrayLogEntry:
force_no_trampoline: true
template_params:
- T
- I
methods:
StructArrayLogEntry:
overloads:
"":
ignore: true
DataLog&, std::string_view, I..., int64_t:
param_override:
info:
name: type
cpp_code: |
[](DataLog &log, std::string_view name, const py::type &t, int64_t timestamp) {
WPyStructInfo info(t);
return std::make_shared<StructArrayLogEntry<WPyStruct, WPyStructInfo>>(log, name, info, timestamp);
}
DataLog&, std::string_view, std::string_view, I..., int64_t:
param_override:
info:
name: type
cpp_code: |
[](DataLog &log, std::string_view name, std::string_view metadata, const py::type &t, int64_t timestamp) {
WPyStructInfo info(t);
return std::make_shared<StructArrayLogEntry<WPyStruct, WPyStructInfo>>(log, name, metadata, info, timestamp);
}
Append:
overloads:
U&&, int64_t:
ignore: true
std::span<const T>, int64_t:
Update:
HasLastValue:
GetLastValue:
wpi::log::ProtobufLogEntry:
force_no_trampoline: true
ignore: true
methods:
ProtobufLogEntry:
overloads:
"":
DataLog&, std::string_view, int64_t:
DataLog&, std::string_view, std::string_view, int64_t:
Append:
Update:
HasLastValue:
GetLastValue:
templates:
StructLogEntry:
qualname: wpi::log::StructLogEntry
params:
- WPyStruct
- WPyStructInfo
StructArrayLogEntry:
qualname: wpi::log::StructArrayLogEntry
params:
- WPyStruct
- WPyStructInfo
_RawLogEntryImpl:
qualname: wpi::log::DataLogValueEntryImpl
params:
- std::vector<uint8_t>
_BooleanLogEntryImpl:
qualname: wpi::log::DataLogValueEntryImpl
params:
- bool
_IntegerLogEntryImpl:
qualname: wpi::log::DataLogValueEntryImpl
params:
- int64_t
_FloatLogEntryImpl:
qualname: wpi::log::DataLogValueEntryImpl
params:
- float
_DoubleLogEntryImpl:
qualname: wpi::log::DataLogValueEntryImpl
params:
- double
_StringLogEntryImpl:
qualname: wpi::log::DataLogValueEntryImpl
params:
- std::string
_BooleanArrayLogEntryImpl:
qualname: wpi::log::DataLogValueEntryImpl
params:
- std::vector<int>
_IntegerArrayLogEntryImpl:
qualname: wpi::log::DataLogValueEntryImpl
params:
- std::vector<int64_t>
_FloatArrayLogEntryImpl:
qualname: wpi::log::DataLogValueEntryImpl
params:
- std::vector<float>
_DoubleArrayLogEntryImpl:
qualname: wpi::log::DataLogValueEntryImpl
params:
- std::vector<double>
_StringArrayLogEntryImpl:
qualname: wpi::log::DataLogValueEntryImpl
params:
- std::vector<std::string>

View File

@@ -0,0 +1,16 @@
classes:
wpi::log::DataLogBackgroundWriter:
methods:
DataLogBackgroundWriter:
overloads:
std::string_view, std::string_view, double, std::string_view:
wpi::Logger&, std::string_view, std::string_view, double, std::string_view:
ignore: true
std::function<void (std::span<const uint8_t> data)>, double, std::string_view:
wpi::Logger&, std::function<void (std::span<const uint8_t> data)>, double, std::string_view:
ignore: true
SetFilename:
Flush:
Pause:
Resume:
Stop:

View File

@@ -0,0 +1,332 @@
classes:
wpi::log::StartRecordData:
attributes:
entry:
access: readonly
name:
access: readonly
type:
access: readonly
metadata:
access: readonly
wpi::log::MetadataRecordData:
attributes:
entry:
access: readonly
metadata:
access: readonly
wpi::log::DataLogRecord:
methods:
DataLogRecord:
overloads:
"":
ignore: true
int, int64_t, std::span<const uint8_t>:
ignore: true
GetEntry:
GetTimestamp:
GetSize:
GetRaw:
no_release_gil: true
cpp_code: |
[](const DataLogRecord *self) {
auto data = self->GetRaw();
return py::bytes((char*)data.data(), data.size());
}
IsControl:
IsStart:
IsFinish:
IsSetMetadata:
GetStartData:
no_release_gil: true
param_override:
out:
ignore: true
doc: |
Decodes a start control record. Raises TypeError on error.
cpp_code: |
[](const DataLogRecord *self) {
auto ptr = std::make_unique<wpi::log::StartRecordData>();
if (!self->GetStartData(ptr.get())) {
throw py::type_error("not a start record");
}
return ptr;
}
return_value_policy: reference_internal
GetFinishEntry:
no_release_gil: true
param_override:
out:
ignore: true
doc: |
Decodes a finish control record. Raises TypeError on error.
cpp_code: |
[](const DataLogRecord *self) {
int value;
if (!self->GetFinishEntry(&value)) {
throw py::type_error("not a finish entry");
}
return value;
}
GetSetMetadataData:
no_release_gil: true
param_override:
out:
ignore: true
doc: |
Decodes a set metadata control record. Raises TypeError on error.
cpp_code: |
[](const DataLogRecord *self) {
auto ptr = std::make_unique<wpi::log::MetadataRecordData>();
if (!self->GetSetMetadataData(ptr.get())) {
throw py::type_error("not a metadata control record");
}
return ptr;
}
return_value_policy: reference_internal
GetBoolean:
no_release_gil: true
param_override:
value:
ignore: true
doc: |
Decodes a data record as a boolean. Note if the data type (as indicated in
the corresponding start control record for this entry) is not "boolean",
invalid results may be returned or TypeError will be raised.
cpp_code: |
[](const DataLogRecord *self) {
bool value;
if (!self->GetBoolean(&value)) {
throw py::type_error("not a boolean");
}
return value;
}
GetInteger:
no_release_gil: true
param_override:
value:
ignore: true
doc: |
Decodes a data record as an integer. Note if the data type (as indicated in
the corresponding start control record for this entry) is not "int64",
invalid results may be returned or TypeError will be raised.
cpp_code: |
[](const DataLogRecord *self) {
int64_t value;
if (!self->GetInteger(&value)) {
throw py::type_error("not an integer");
}
return value;
}
GetFloat:
no_release_gil: true
param_override:
value:
ignore: true
doc: |
Decodes a data record as a float. Note if the data type (as indicated in
the corresponding start control record for this entry) is not "float",
invalid results may be returned or TypeError will be raised.
cpp_code: |
[](const DataLogRecord *self) {
float value;
if (!self->GetFloat(&value)) {
throw py::type_error("not a float");
}
return value;
}
GetDouble:
no_release_gil: true
param_override:
value:
ignore: true
doc: |
Decodes a data record as a double. Note if the data type (as indicated in
the corresponding start control record for this entry) is not "double",
invalid results may be returned or TypeError will be raised.
cpp_code: |
[](const DataLogRecord *self) {
double value;
if (!self->GetDouble(&value)) {
throw py::type_error("not a double");
}
return value;
}
GetString:
no_release_gil: true
param_override:
value:
ignore: true
doc: |
Decodes a data record as a string. Note if the data type (as indicated in
the corresponding start control record for this entry) is not "string",
invalid results may be returned or TypeError will be raised.
cpp_code: |
[](const DataLogRecord *self) {
std::string_view value;
if (!self->GetString(&value)) {
throw py::type_error("not a string");
}
return value;
}
GetBooleanArray:
no_release_gil: true
param_override:
arr:
ignore: true
doc: |
Decodes a data record as a boolean array. Note if the data type (as
indicated in the corresponding start control record for this entry) is not
"boolean[]", invalid results may be returned or a TypeError may be raised.
cpp_code: |
[](const DataLogRecord *self) {
std::vector<int> arr;
if (!self->GetBooleanArray(&arr)) {
throw py::type_error("not a boolean array");
}
py::list l(arr.size());
for (size_t i = 0; i < arr.size(); i++) {
auto b = py::bool_(arr[i]);
PyList_SET_ITEM(l.ptr(), i, b.release().ptr());
}
return l;
}
GetIntegerArray:
no_release_gil: true
param_override:
arr:
ignore: true
doc: |
Decodes a data record as an integer array. Note if the data type (as
indicated in the corresponding start control record for this entry) is not
"int64[]", invalid results may be returned or a TypeError may be raised.
cpp_code: |
[](const DataLogRecord *self) {
std::vector<int64_t> arr;
if (!self->GetIntegerArray(&arr)) {
throw py::type_error("not an integer array");
}
return arr;
}
GetFloatArray:
no_release_gil: true
param_override:
arr:
ignore: true
doc: |
Decodes a data record as a float array. Note if the data type (as
indicated in the corresponding start control record for this entry) is not
"float[]", invalid results may be returned or a TypeError may be raised.
cpp_code: |
[](const DataLogRecord *self) {
std::vector<float> arr;
if (!self->GetFloatArray(&arr)) {
throw py::type_error("not a float array");
}
return arr;
}
GetDoubleArray:
no_release_gil: true
param_override:
arr:
ignore: true
doc: |
Decodes a data record as a double array. Note if the data type (as
indicated in the corresponding start control record for this entry) is not
"double[]", invalid results may be returned or a TypeError may be raised.
cpp_code: |
[](const DataLogRecord *self) {
std::vector<double> arr;
if (!self->GetDoubleArray(&arr)) {
throw py::type_error("not a double array");
}
return arr;
}
GetStringArray:
no_release_gil: true
param_override:
arr:
ignore: true
doc: |
Decodes a data record as a string array. Note if the data type (as
indicated in the corresponding start control record for this entry) is not
"string[]", invalid results may be returned or a TypeError may be raised.
cpp_code: |
[](const DataLogRecord *self) {
std::vector<std::string_view> arr;
if (!self->GetStringArray(&arr)) {
throw py::type_error("not a string array");
}
return arr;
}
wpi::log::DataLogIterator:
ignore: true
wpi::log::DataLogReader:
typealias:
- wpi::MemoryBuffer
methods:
DataLogReader:
ignore: true
IsValid:
GetVersion:
GetExtraHeader:
GetBufferIdentifier:
begin:
ignore: true
end:
ignore: true
inline_code: |
cls_StartRecordData
.def("__repr__", [](const wpi::log::StartRecordData &data) -> std::string {
return "StartRecordData(entry=" + std::to_string(data.entry) + ", "
"name=\"" + std::string(data.name) + "\", "
"type=\"" + std::string(data.type) + "\", "
"metadata=\"" + std::string(data.metadata) + "\")";
});
cls_MetadataRecordData
.def("__repr__", [](const wpi::log::MetadataRecordData &data) -> std::string {
return "MetadataRecordData(entry=" + std::to_string(data.entry) + ", "
"metadata=\"" + std::string(data.metadata) + "\")";
});
cls_DataLogReader
.def(py::init([](const std::string &filename) {
auto mbuf = wpi::MemoryBuffer::GetFile(filename);
if (!mbuf) {
py::gil_scoped_acquire gil;
#ifdef _WIN32
PyErr_SetFromWindowsErr(mbuf.error().value());
#else
errno = mbuf.error().value();
PyErr_SetFromErrno(PyExc_OSError);
#endif
throw py::error_already_set();
}
return std::make_shared<wpi::log::DataLogReader>(std::move(*mbuf));
}),
release_gil(), py::arg("filename"))
.def(py::init([](const py::buffer &buffer, const std::string &name) {
auto req = buffer.request();
if (req.itemsize != 1) {
throw py::value_error("buffer must only contain bytes");
} else if (req.ndim != 1) {
throw py::value_error("buffer must only have a single dimension");
}
auto mbuf = wpi::MemoryBuffer::GetMemBuffer(std::span((uint8_t*)req.ptr, req.size), name);
{
py::gil_scoped_release gil;
return std::make_shared<wpi::log::DataLogReader>(std::move(mbuf));
}
}),
py::arg("buffer"), py::arg("name") = "",
py::keep_alive<1, 2>())
.def("__iter__", [](wpi::log::DataLogReader * that) {
return py::make_iterator(that->begin(), that->end());
}, py::keep_alive<0,1>());

View File

@@ -0,0 +1,28 @@
classes:
wpi::log::DataLogWriter:
methods:
DataLogWriter:
overloads:
std::string_view, std::error_code&, std::string_view:
cpp_code: |
[](std::string_view filename, std::string_view extraHeader) {
std::error_code ec;
auto writer = std::make_unique<DataLogWriter>(filename, ec, extraHeader);
if (ec) {
throw std::system_error(ec);
}
return writer;
}
param_override:
ec:
ignore: true
wpi::Logger&, std::string_view, std::error_code&, std::string_view:
ignore: true
std::unique_ptr<wpi::raw_ostream>, std::string_view:
ignore: true
wpi::Logger&, std::unique_ptr<wpi::raw_ostream>, std::string_view:
ignore: true
Flush:
Stop:
GetStream:
ignore: true