2022-04-08 21:20:53 -07:00
|
|
|
// Copyright (c) FIRST and other WPILib contributors.
|
|
|
|
|
// Open Source Software; you can modify and/or share it under the terms of
|
|
|
|
|
// the WPILib BSD license file in the root directory of this project.
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <wpi/SymbolExports.h>
|
|
|
|
|
|
2022-10-26 22:20:08 -07:00
|
|
|
#include "frc/geometry/Pose3d.h"
|
|
|
|
|
#include "frc/geometry/Transform3d.h"
|
2022-04-08 21:20:53 -07:00
|
|
|
|
|
|
|
|
namespace frc {
|
|
|
|
|
|
|
|
|
|
/**
|
2022-12-06 21:11:27 -08:00
|
|
|
* Returns the robot's pose in the field coordinate system given an object's
|
|
|
|
|
* field-relative pose, the transformation from the camera's pose to the
|
|
|
|
|
* object's pose (obtained via computer vision), and the transformation from the
|
|
|
|
|
* robot's pose to the camera's pose.
|
2022-04-08 21:20:53 -07:00
|
|
|
*
|
2022-12-06 21:11:27 -08:00
|
|
|
* The object could be a target or a fiducial marker.
|
2022-04-08 21:20:53 -07:00
|
|
|
*
|
2022-12-06 21:11:27 -08:00
|
|
|
* @param objectInField An object's field-relative pose.
|
|
|
|
|
* @param cameraToObject The transformation from the camera's pose to the
|
|
|
|
|
* object's pose. This comes from computer vision.
|
|
|
|
|
* @param robotToCamera The transformation from the robot's pose to the camera's
|
|
|
|
|
* pose. This can either be a constant for a rigidly mounted camera, or
|
|
|
|
|
* variable if the camera is mounted to a turret. If the camera was mounted 3
|
|
|
|
|
* inches behind the "origin" (usually physical center) of the robot, this
|
|
|
|
|
* would be frc::Transform3d{3_in, 0_in, 0_in, frc::Rotation3d{}}.
|
|
|
|
|
* @return The robot's field-relative pose.
|
2022-04-08 21:20:53 -07:00
|
|
|
*/
|
|
|
|
|
WPILIB_DLLEXPORT
|
2022-12-06 21:11:27 -08:00
|
|
|
frc::Pose3d ObjectToRobotPose(const frc::Pose3d& objectInField,
|
|
|
|
|
const frc::Transform3d& cameraToObject,
|
|
|
|
|
const frc::Transform3d& robotToCamera);
|
2022-04-08 21:20:53 -07:00
|
|
|
|
|
|
|
|
} // namespace frc
|