PhotonVision C++ v2027.0.0-alpha-2
Loading...
Searching...
No Matches
CameraTargetRelation.h
Go to the documentation of this file.
1/*
2 * Copyright (C) Photon Vision.
3 *
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
13 *
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <https://www.gnu.org/licenses/>.
16 */
17
18#pragma once
19
20#include <wpi/math/geometry/Pose3d.hpp>
21
22namespace photon {
24 public:
25 const wpi::math::Pose3d camPose;
26 const wpi::math::Transform3d camToTarg;
27 const wpi::units::meter_t camToTargDist;
28 const wpi::units::meter_t camToTargDistXY;
29 const wpi::math::Rotation2d camToTargYaw;
30 const wpi::math::Rotation2d camToTargPitch;
31
32 const wpi::math::Rotation2d camToTargAngle;
33
34 const wpi::math::Transform3d targToCam;
35 const wpi::math::Rotation2d targToCamYaw;
36 const wpi::math::Rotation2d targToCamPitch;
37
38 const wpi::math::Rotation2d targToCamAngle;
39
40 CameraTargetRelation(const wpi::math::Pose3d& cameraPose,
41 const wpi::math::Pose3d& targetPose)
42 : camPose(cameraPose),
43 camToTarg(wpi::math::Transform3d{cameraPose, targetPose}),
44 camToTargDist(camToTarg.Translation().Norm()),
45 camToTargDistXY(wpi::units::math::hypot(camToTarg.Translation().X(),
46 camToTarg.Translation().Y())),
47 camToTargYaw(wpi::math::Rotation2d{camToTarg.X().to<double>(),
48 camToTarg.Y().to<double>()}),
49 camToTargPitch(wpi::math::Rotation2d{camToTargDistXY.to<double>(),
50 -camToTarg.Z().to<double>()}),
51 camToTargAngle(wpi::math::Rotation2d{wpi::units::math::hypot(
52 camToTargYaw.Radians(), camToTargPitch.Radians())}),
53 targToCam(wpi::math::Transform3d{targetPose, cameraPose}),
54 targToCamYaw(wpi::math::Rotation2d{targToCam.X().to<double>(),
55 targToCam.Y().to<double>()}),
56 targToCamPitch(wpi::math::Rotation2d{camToTargDistXY.to<double>(),
57 -targToCam.Z().to<double>()}),
58 targToCamAngle(wpi::math::Rotation2d{wpi::units::math::hypot(
59 targToCamYaw.Radians(), targToCamPitch.Radians())}) {}
60};
61} // namespace photon
Definition CameraTargetRelation.h:23
const wpi::units::meter_t camToTargDistXY
Definition CameraTargetRelation.h:28
const wpi::math::Rotation2d camToTargAngle
Definition CameraTargetRelation.h:32
const wpi::math::Pose3d camPose
Definition CameraTargetRelation.h:25
const wpi::math::Rotation2d camToTargYaw
Definition CameraTargetRelation.h:29
const wpi::math::Rotation2d camToTargPitch
Definition CameraTargetRelation.h:30
const wpi::math::Transform3d targToCam
Definition CameraTargetRelation.h:34
const wpi::units::meter_t camToTargDist
Definition CameraTargetRelation.h:27
const wpi::math::Rotation2d targToCamPitch
Definition CameraTargetRelation.h:36
const wpi::math::Rotation2d targToCamYaw
Definition CameraTargetRelation.h:35
const wpi::math::Rotation2d targToCamAngle
Definition CameraTargetRelation.h:38
CameraTargetRelation(const wpi::math::Pose3d &cameraPose, const wpi::math::Pose3d &targetPose)
Definition CameraTargetRelation.h:40
const wpi::math::Transform3d camToTarg
Definition CameraTargetRelation.h:26
Definition VisionEstimation.h:30
Definition TimeSyncServer.h:32