mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-29 02:21:44 +00:00
SCRIPT namespace replacements
This commit is contained in:
committed by
Peter Johnson
parent
ae6c043632
commit
9aca8e0fd6
@@ -17,7 +17,7 @@
|
||||
#include "wpi/util/SymbolExports.hpp"
|
||||
#include "wpi/util/json_fwd.hpp"
|
||||
|
||||
namespace frc {
|
||||
namespace wpi::math {
|
||||
|
||||
class Transform2d;
|
||||
|
||||
@@ -49,7 +49,7 @@ class WPILIB_DLLEXPORT Pose2d {
|
||||
* @param y The y component of the translational component of the pose.
|
||||
* @param rotation The rotational component of the pose.
|
||||
*/
|
||||
constexpr Pose2d(units::meter_t x, units::meter_t y, Rotation2d rotation)
|
||||
constexpr Pose2d(wpi::units::meter_t x, wpi::units::meter_t y, Rotation2d rotation)
|
||||
: m_translation{x, y}, m_rotation{std::move(rotation)} {}
|
||||
|
||||
/**
|
||||
@@ -110,14 +110,14 @@ class WPILIB_DLLEXPORT Pose2d {
|
||||
*
|
||||
* @return The x component of the pose's translation.
|
||||
*/
|
||||
constexpr units::meter_t X() const { return m_translation.X(); }
|
||||
constexpr wpi::units::meter_t X() const { return m_translation.X(); }
|
||||
|
||||
/**
|
||||
* Returns the Y component of the pose's translation.
|
||||
*
|
||||
* @return The y component of the pose's translation.
|
||||
*/
|
||||
constexpr units::meter_t Y() const { return m_translation.Y(); }
|
||||
constexpr wpi::units::meter_t Y() const { return m_translation.Y(); }
|
||||
|
||||
/**
|
||||
* Returns the underlying rotation.
|
||||
@@ -265,26 +265,26 @@ class WPILIB_DLLEXPORT Pose2d {
|
||||
};
|
||||
|
||||
WPILIB_DLLEXPORT
|
||||
void to_json(wpi::json& json, const Pose2d& pose);
|
||||
void to_json(wpi::util::json& json, const Pose2d& pose);
|
||||
|
||||
WPILIB_DLLEXPORT
|
||||
void from_json(const wpi::json& json, Pose2d& pose);
|
||||
void from_json(const wpi::util::json& json, Pose2d& pose);
|
||||
|
||||
} // namespace frc
|
||||
} // namespace wpi::math
|
||||
|
||||
#include "wpi/math/geometry/proto/Pose2dProto.hpp"
|
||||
#include "wpi/math/geometry/struct/Pose2dStruct.hpp"
|
||||
|
||||
#include "wpi/math/geometry/Transform2d.hpp"
|
||||
|
||||
namespace frc {
|
||||
namespace wpi::math {
|
||||
|
||||
constexpr Transform2d Pose2d::operator-(const Pose2d& other) const {
|
||||
const auto pose = this->RelativeTo(other);
|
||||
return Transform2d{pose.Translation(), pose.Rotation()};
|
||||
}
|
||||
|
||||
constexpr Pose2d Pose2d::TransformBy(const frc::Transform2d& other) const {
|
||||
constexpr Pose2d Pose2d::TransformBy(const wpi::math::Transform2d& other) const {
|
||||
return {m_translation + (other.Translation().RotateBy(m_rotation)),
|
||||
other.Rotation() + m_rotation};
|
||||
}
|
||||
@@ -294,4 +294,4 @@ constexpr Pose2d Pose2d::RelativeTo(const Pose2d& other) const {
|
||||
return {transform.Translation(), transform.Rotation()};
|
||||
}
|
||||
|
||||
} // namespace frc
|
||||
} // namespace wpi::math
|
||||
|
||||
Reference in New Issue
Block a user