PhotonVision C++ dev-v2025.3.1-2-gf92cf62a
Loading...
Searching...
No Matches
casadi_wrapper.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 <Eigen/Core>
21#include <sleipnir/optimization/SolverExitCondition.hpp>
22#include <wpi/expected>
23
25using casadi_real = double;
26/**
27 * Pinhole camera coefficients
28 */
35
36using RobotStateMat = Eigen::Matrix<casadi_real, 3, 1>;
37
38/**
39 * Optimize x, where x is [x, y, theta]^T. Note points must be undistorted prior
40 * to this. The number of columns in field2points and point_observations just be
41 * exactly 4x nTags.
42 */
43wpi::expected<RobotStateMat, sleipnir::SolverExitCondition> do_optimization(
44 bool heading_free, int nTags, CameraCalibration cameraCal,
45 // Note that casadi is column major, apparently
46 Eigen::Matrix<casadi_real, 4, 4, Eigen::ColMajor> robot2camera,
47 RobotStateMat x_guess,
48 Eigen::Matrix<casadi_real, 4, Eigen::Dynamic, Eigen::ColMajor> field2points,
49 Eigen::Matrix<casadi_real, 2, Eigen::Dynamic, Eigen::ColMajor>
50 point_observations,
51 double gyroθ, double gyroErrorScaleFac);
52
53} // namespace constrained_solvepnp
Definition casadi_wrapper.h:24
Eigen::Matrix< casadi_real, 3, 1 > RobotStateMat
Definition casadi_wrapper.h:36
double casadi_real
Definition casadi_wrapper.h:25
wpi::expected< RobotStateMat, sleipnir::SolverExitCondition > do_optimization(bool heading_free, int nTags, CameraCalibration cameraCal, Eigen::Matrix< casadi_real, 4, 4, Eigen::ColMajor > robot2camera, RobotStateMat x_guess, Eigen::Matrix< casadi_real, 4, Eigen::Dynamic, Eigen::ColMajor > field2points, Eigen::Matrix< casadi_real, 2, Eigen::Dynamic, Eigen::ColMajor > point_observations, double gyroθ, double gyroErrorScaleFac)
Optimize x, where x is [x, y, theta]^T.
Pinhole camera coefficients.
Definition casadi_wrapper.h:29
casadi_real fx
Definition casadi_wrapper.h:30
casadi_real cy
Definition casadi_wrapper.h:33
casadi_real cx
Definition casadi_wrapper.h:32
casadi_real fy
Definition casadi_wrapper.h:31