mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-25 01:41:43 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "wpi/math/trajectory/Trajectory.hpp"
|
||||
|
||||
using namespace frc;
|
||||
using namespace wpi;
|
||||
|
||||
FieldObject2d::FieldObject2d(FieldObject2d&& rhs) {
|
||||
std::swap(m_name, rhs.m_name);
|
||||
@@ -25,16 +25,16 @@ FieldObject2d& FieldObject2d::operator=(FieldObject2d&& rhs) {
|
||||
return *this;
|
||||
}
|
||||
|
||||
void FieldObject2d::SetPose(const Pose2d& pose) {
|
||||
void FieldObject2d::SetPose(const wpi::math::Pose2d& pose) {
|
||||
SetPoses({pose});
|
||||
}
|
||||
|
||||
void FieldObject2d::SetPose(units::meter_t x, units::meter_t y,
|
||||
Rotation2d rotation) {
|
||||
void FieldObject2d::SetPose(wpi::units::meter_t x, wpi::units::meter_t y,
|
||||
wpi::math::Rotation2d rotation) {
|
||||
SetPoses({{x, y, rotation}});
|
||||
}
|
||||
|
||||
Pose2d FieldObject2d::GetPose() const {
|
||||
wpi::math::Pose2d FieldObject2d::GetPose() const {
|
||||
std::scoped_lock lock(m_mutex);
|
||||
UpdateFromEntry();
|
||||
if (m_poses.empty()) {
|
||||
@@ -43,17 +43,17 @@ Pose2d FieldObject2d::GetPose() const {
|
||||
return m_poses[0];
|
||||
}
|
||||
|
||||
void FieldObject2d::SetPoses(std::span<const Pose2d> poses) {
|
||||
void FieldObject2d::SetPoses(std::span<const wpi::math::Pose2d> poses) {
|
||||
std::scoped_lock lock(m_mutex);
|
||||
m_poses.assign(poses.begin(), poses.end());
|
||||
UpdateEntry();
|
||||
}
|
||||
|
||||
void FieldObject2d::SetPoses(std::initializer_list<Pose2d> poses) {
|
||||
void FieldObject2d::SetPoses(std::initializer_list<wpi::math::Pose2d> poses) {
|
||||
SetPoses({poses.begin(), poses.end()});
|
||||
}
|
||||
|
||||
void FieldObject2d::SetTrajectory(const Trajectory& trajectory) {
|
||||
void FieldObject2d::SetTrajectory(const wpi::math::Trajectory& trajectory) {
|
||||
std::scoped_lock lock(m_mutex);
|
||||
m_poses.clear();
|
||||
m_poses.reserve(trajectory.States().size());
|
||||
@@ -63,14 +63,14 @@ void FieldObject2d::SetTrajectory(const Trajectory& trajectory) {
|
||||
UpdateEntry();
|
||||
}
|
||||
|
||||
std::vector<Pose2d> FieldObject2d::GetPoses() const {
|
||||
std::vector<wpi::math::Pose2d> FieldObject2d::GetPoses() const {
|
||||
std::scoped_lock lock(m_mutex);
|
||||
UpdateFromEntry();
|
||||
return std::vector<Pose2d>(m_poses.begin(), m_poses.end());
|
||||
return std::vector<wpi::math::Pose2d>(m_poses.begin(), m_poses.end());
|
||||
}
|
||||
|
||||
std::span<const Pose2d> FieldObject2d::GetPoses(
|
||||
wpi::SmallVectorImpl<Pose2d>& out) const {
|
||||
std::span<const wpi::math::Pose2d> FieldObject2d::GetPoses(
|
||||
wpi::util::SmallVectorImpl<wpi::math::Pose2d>& out) const {
|
||||
std::scoped_lock lock(m_mutex);
|
||||
UpdateFromEntry();
|
||||
out.assign(m_poses.begin(), m_poses.end());
|
||||
@@ -81,7 +81,7 @@ void FieldObject2d::UpdateEntry(bool setDefault) {
|
||||
if (!m_entry) {
|
||||
return;
|
||||
}
|
||||
wpi::SmallVector<double, 9> arr;
|
||||
wpi::util::SmallVector<double, 9> arr;
|
||||
for (auto&& pose : m_poses) {
|
||||
auto& translation = pose.Translation();
|
||||
arr.push_back(translation.X().value());
|
||||
@@ -107,7 +107,7 @@ void FieldObject2d::UpdateFromEntry() const {
|
||||
m_poses.resize(size / 3);
|
||||
for (size_t i = 0; i < size / 3; ++i) {
|
||||
m_poses[i] =
|
||||
Pose2d{units::meter_t{arr[i * 3 + 0]}, units::meter_t{arr[i * 3 + 1]},
|
||||
units::degree_t{arr[i * 3 + 2]}};
|
||||
wpi::math::Pose2d{wpi::units::meter_t{arr[i * 3 + 0]}, wpi::units::meter_t{arr[i * 3 + 1]},
|
||||
wpi::units::degree_t{arr[i * 3 + 2]}};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user