mirror of
https://github.com/PhotonVision/photonvision
synced 2026-06-23 01:21:40 +00:00
[photonli?b C++] Fix rotation3d constructor (#1553)
Fixes #1552 -- mixed up rpy and a rotation vector After changes: 
This commit is contained in:
@@ -201,9 +201,8 @@ static frc::Rotation3d RVecToRotation(const cv::Mat& rvecInput) {
|
||||
cv::Mat wrapped{rvecInput.rows, rvecInput.cols, CV_32F};
|
||||
rvecInput.convertTo(wrapped, CV_32F);
|
||||
data = wrapped.at<cv::Vec3f>(cv::Point{0, 0});
|
||||
return RotationEDNToNWU(frc::Rotation3d{units::radian_t{data[0]},
|
||||
units::radian_t{data[1]},
|
||||
units::radian_t{data[2]}});
|
||||
return RotationEDNToNWU(
|
||||
frc::Rotation3d{Eigen::Vector3d{data[0], data[1], data[2]}});
|
||||
}
|
||||
|
||||
[[maybe_unused]] static std::optional<photon::PnpResult> SolvePNP_Square(
|
||||
|
||||
@@ -26,11 +26,14 @@
|
||||
namespace photon {
|
||||
class RotTrlTransform3d {
|
||||
public:
|
||||
RotTrlTransform3d(const frc::Rotation3d& rot, const frc::Translation3d& trl)
|
||||
: trl(trl), rot(rot) {}
|
||||
RotTrlTransform3d(const frc::Rotation3d& newRot,
|
||||
const frc::Translation3d& newTrl)
|
||||
: trl{newTrl}, rot{newRot} {}
|
||||
|
||||
RotTrlTransform3d(const frc::Pose3d& initial, const frc::Pose3d& last)
|
||||
: trl(last.Translation() - initial.Translation().RotateBy(rot)),
|
||||
rot(last.Rotation() - initial.Rotation()) {}
|
||||
: trl{last.Translation() - initial.Translation().RotateBy(
|
||||
last.Rotation() - initial.Rotation())},
|
||||
rot{last.Rotation() - initial.Rotation()} {}
|
||||
explicit RotTrlTransform3d(const frc::Transform3d& trf)
|
||||
: RotTrlTransform3d(trf.Rotation(), trf.Translation()) {}
|
||||
RotTrlTransform3d()
|
||||
|
||||
Reference in New Issue
Block a user