rmcv  v0.1.0
A library for RoboMaster computer vision based on OpenCV.
mobility.h
Go to the documentation of this file.
1 
10 #ifndef RMCV_MOBILITY_H
11 #define RMCV_MOBILITY_H
12 
13 #include "core/core.h"
14 
15 namespace rm {
17  [[maybe_unused]] typedef enum CompensateMode {
22 
29  void AxisRotateX(double y, double z, double thetaX, double &outY, double &outZ);
30 
37  void AxisRotateY(double x, double z, double thetaY, double &outX, double &outZ);
38 
45  void AxisRotateZ(double x, double y, double thetaZ, double &outX, double &outY);
46 
53  [[maybe_unused]] double
54  DeltaHeight(cv::InputArray translationVector, double motorAngle, const cv::Point2f &offset = {0, 0},
55  double angleOffset = 0);
56 
60  [[maybe_unused]] double Distance(cv::InputArray translationVector);
61 
73  double ProjectileAngle(double v0, double g, double d, double h);
74 
80  [[maybe_unused]] bool
81  SolveCameraPose(cv::InputArray rotationVector, cv::InputArray translationVector, cv::OutputArray pose);
82 
93  [[maybe_unused]] double
94  SolveGEA(cv::InputArray translationVector, cv::OutputArray gimbalErrorAngle, double g, double v0, double h,
95  const cv::Point2f &offset = {0, 0}, double angleOffset = 0, rm::CompensateMode mode = rm::COMPENSATE_NONE);
96 
106  [[maybe_unused]] bool
107  SolvePNP(const std::vector<cv::Point2f> &imagePoints, cv::InputArray cameraMatrix, cv::InputArray distortionFactor,
108  const cv::Size2f &exactSize, cv::OutputArray translationVector, cv::OutputArray rotationVector,
109  const cv::Rect &ROI = {0, 0, 0, 0});
110 }
111 
112 #endif //RMCV_MOBILITY_H
rm::AxisRotateY
void AxisRotateY(double x, double z, double thetaY, double &outX, double &outZ)
Rotate the vector around the y-axis.
Definition: mobility.cpp:16
rm::CompensateMode
CompensateMode
Define witch method is used to calculate the compensation of gravity.
Definition: mobility.h:17
rm::SolveCameraPose
bool SolveCameraPose(cv::InputArray rotationVector, cv::InputArray translationVector, cv::OutputArray pose)
Solve camera pose in pitch, yaw, and roll relative to a target.
Definition: mobility.cpp:73
rm::SolvePNP
bool SolvePNP(const std::vector< cv::Point2f > &imagePoints, cv::InputArray cameraMatrix, cv::InputArray distortionFactor, const cv::Size2f &exactSize, cv::OutputArray translationVector, cv::OutputArray rotationVector, const cv::Rect &ROI={0, 0, 0, 0})
Solve the rotation & translation vector using cv::solvePnP & cv::SOLVEPNP_IPPE_SQUARE.
Definition: mobility.cpp:150
rm::COMPENSATE_CLASSIC
@ COMPENSATE_CLASSIC
Use newtonian's theorem of mechanics.
Definition: mobility.h:19
rm::COMPENSATE_NONE
@ COMPENSATE_NONE
No compensation.
Definition: mobility.h:18
rm::AxisRotateX
void AxisRotateX(double y, double z, double thetaX, double &outY, double &outZ)
Rotate the vector around the x-axis.
Definition: mobility.cpp:8
rm::DeltaHeight
double DeltaHeight(cv::InputArray translationVector, double motorAngle, const cv::Point2f &offset={0, 0}, double angleOffset=0)
Solve height difference between barrel and target.
Definition: mobility.cpp:32
rm::ProjectileAngle
double ProjectileAngle(double v0, double g, double d, double h)
Solve initial angle required for a projectile motion.
Definition: mobility.cpp:55
rm::Distance
double Distance(cv::InputArray translationVector)
Solve the distance between camera and target.
Definition: mobility.cpp:47
rm
Main modules.
Definition: daheng.h:17
rm::COMPENSATE_NI
@ COMPENSATE_NI
Use newton iteration method.
Definition: mobility.h:20
rm::AxisRotateZ
void AxisRotateZ(double x, double y, double thetaZ, double &outX, double &outY)
Rotate the vector around the z-axis.
Definition: mobility.cpp:24
rm::SolveGEA
double SolveGEA(cv::InputArray translationVector, cv::OutputArray gimbalErrorAngle, double g, double v0, double h, const cv::Point2f &offset={0, 0}, double angleOffset=0, rm::CompensateMode mode=rm::COMPENSATE_NONE)
Solve gimbal error angle to target by given method.
Definition: mobility.cpp:114