[apriltag] Add GetTags to C++ version of AprilTagFieldLayout (#5872)

This commit is contained in:
Drew Williams
2023-11-04 13:26:07 -04:00
committed by GitHub
parent 87a8a1ced4
commit 04a781b4d7
2 changed files with 15 additions and 0 deletions

View File

@@ -49,6 +49,15 @@ units::meter_t AprilTagFieldLayout::GetFieldWidth() const {
return m_fieldWidth;
}
std::vector<AprilTag> AprilTagFieldLayout::GetTags() const {
std::vector<AprilTag> tags;
tags.reserve(m_apriltags.size());
for (const auto& tag : m_apriltags) {
tags.emplace_back(tag.second);
}
return tags;
}
void AprilTagFieldLayout::SetOrigin(OriginPosition origin) {
switch (origin) {
case OriginPosition::kBlueAllianceWallRightSide:

View File

@@ -74,6 +74,12 @@ class WPILIB_DLLEXPORT AprilTagFieldLayout {
*/
units::meter_t GetFieldWidth() const;
/**
* Returns a vector of all the april tags used in this layout.
* @return list of tags
*/
std::vector<AprilTag> GetTags() const;
/**
* Sets the origin based on a predefined enumeration of coordinate frame
* origins. The origins are calculated from the field dimensions.