PhotonVision C++ dev-v2025.0.0-beta-8-2-gbd1c5c03
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 <frc/geometry/Pose3d.h>
21
22namespace photon {
24 public:
25 const frc::Pose3d camPose;
26 const frc::Transform3d camToTarg;
27 const units::meter_t camToTargDist;
28 const units::meter_t camToTargDistXY;
29 const frc::Rotation2d camToTargYaw;
30 const frc::Rotation2d camToTargPitch;
31
32 const frc::Rotation2d camToTargAngle;
33
34 const frc::Transform3d targToCam;
35 const frc::Rotation2d targToCamYaw;
36 const frc::Rotation2d targToCamPitch;
37
38 const frc::Rotation2d targToCamAngle;
39
40 CameraTargetRelation(const frc::Pose3d& cameraPose,
41 const frc::Pose3d& targetPose)
42 : camPose(cameraPose),
43 camToTarg(frc::Transform3d{cameraPose, targetPose}),
44 camToTargDist(camToTarg.Translation().Norm()),
45 camToTargDistXY(units::math::hypot(camToTarg.Translation().X(),
46 camToTarg.Translation().Y())),
47 camToTargYaw(frc::Rotation2d{camToTarg.X().to<double>(),
48 camToTarg.Y().to<double>()}),
49 camToTargPitch(frc::Rotation2d{camToTargDistXY.to<double>(),
50 -camToTarg.Z().to<double>()}),
51 camToTargAngle(frc::Rotation2d{units::math::hypot(
52 camToTargYaw.Radians(), camToTargPitch.Radians())}),
53 targToCam(frc::Transform3d{targetPose, cameraPose}),
54 targToCamYaw(frc::Rotation2d{targToCam.X().to<double>(),
55 targToCam.Y().to<double>()}),
56 targToCamPitch(frc::Rotation2d{camToTargDistXY.to<double>(),
57 -targToCam.Z().to<double>()}),
58 targToCamAngle(frc::Rotation2d{units::math::hypot(
59 targToCamYaw.Radians(), targToCamPitch.Radians())}) {}
60};
61} // namespace photon
Definition CameraTargetRelation.h:23
const frc::Transform3d targToCam
Definition CameraTargetRelation.h:34
const units::meter_t camToTargDistXY
Definition CameraTargetRelation.h:28
CameraTargetRelation(const frc::Pose3d &cameraPose, const frc::Pose3d &targetPose)
Definition CameraTargetRelation.h:40
const frc::Rotation2d targToCamYaw
Definition CameraTargetRelation.h:35
const frc::Transform3d camToTarg
Definition CameraTargetRelation.h:26
const frc::Rotation2d camToTargAngle
Definition CameraTargetRelation.h:32
const frc::Rotation2d camToTargPitch
Definition CameraTargetRelation.h:30
const units::meter_t camToTargDist
Definition CameraTargetRelation.h:27
const frc::Pose3d camPose
Definition CameraTargetRelation.h:25
const frc::Rotation2d targToCamPitch
Definition CameraTargetRelation.h:36
const frc::Rotation2d camToTargYaw
Definition CameraTargetRelation.h:29
const frc::Rotation2d targToCamAngle
Definition CameraTargetRelation.h:38
Definition VisionEstimation.h:32