25 #ifndef INCLUDED_BeaconBasedPoseEstimator_h_GUID_7B983CED_F2C5_4B86_109A_948863B665B1
26 #define INCLUDED_BeaconBasedPoseEstimator_h_GUID_7B983CED_F2C5_4B86_109A_948863B665B1
52 cv::Point2d measurement = {0, 0};
53 cv::Point2d residual = {0, 0};
55 void reset() { *
this = BeaconData{}; }
65 static BeaconIDPredicate getDefaultBeaconFixedPredicate() {
66 return [](
int id) {
return id <= 4; };
81 size_t requiredInliers = 4,
82 size_t permittedOutliers = 2,
84 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
96 std::size_t getNumBeacons()
const {
return m_beacons.size(); }
113 Eigen::Vector3d GetLinearVelocity()
const;
114 Eigen::Vector3d GetAngularVelocity()
const;
121 Vec3Vector
const &emissionDirection,
122 std::vector<double>
const &variance,
123 BeaconIDPredicate
const &autocalibrationFixedPredicate,
124 double beaconAutocalibErrorScale = 1);
128 void dumpBeaconLocationsToStream(std::ostream &os)
const;
130 std::vector<BeaconData>
const &getBeaconDebugData()
const {
131 return m_beaconDebugData;
134 Eigen::Vector3d getBeaconAutocalibPosition(std::size_t i)
const;
136 Eigen::Vector3d getBeaconAutocalibVariance(std::size_t i)
const;
139 void m_updateBeaconCentroid(
const Point3Vector &beacons);
140 void m_updateBeaconDebugInfoArray();
143 Eigen::Vector3d m_convertInternalPositionRepToExternal(
144 Eigen::Vector3d
const &pos)
const;
147 bool m_estimatePoseFromLeds(LedGroup &leds,
OSVR_TimeValue const &tv,
152 bool m_pnpransacEstimator(LedGroup &leds);
156 bool m_kalmanAutocalibEstimator(LedGroup &leds,
double dt);
164 bool m_forceRansacIfKalmanNeedsReset(LedGroup
const &leds);
168 void m_resetState(Eigen::Vector3d
const &xlate,
169 Eigen::Quaterniond
const &quat);
171 using BeaconStateVec = std::vector<std::unique_ptr<BeaconState>>;
172 BeaconStateVec m_beacons;
173 std::vector<double> m_beaconMeasurementVariance;
175 std::vector<bool> m_beaconFixed;
176 Vec3Vector m_beaconEmissionDirection;
178 std::vector<BeaconData> m_beaconDebugData;
181 size_t m_requiredInliers;
182 size_t m_permittedOutliers;
189 Eigen::Vector3d m_centroid;
194 bool m_gotPrev =
false;
196 bool m_permitKalman =
true;
203 bool m_gotPose =
false;
205 bool m_gotMeasurement =
false;
220 std::size_t m_framesInProbation = 0;
223 std::size_t m_framesWithoutUtilizedMeasurements = 0;
225 std::size_t m_framesWithoutIdentifiedBlobs = 0;
232 #endif // INCLUDED_BeaconBasedPoseEstimator_h_GUID_7B983CED_F2C5_4B86_109A_948863B665B1
Header file for class that tracks and identifies LEDs.
bool SetBeacons(const Point3Vector &beacons, Vec3Vector const &emissionDirection, std::vector< double > const &variance, BeaconIDPredicate const &autocalibrationFixedPredicate, double beaconAutocalibErrorScale=1)
General configuration parameters.
BeaconBasedPoseEstimator(CameraParameters const &camParams, size_t requiredInliers=4, size_t permittedOutliers=2, ConfigParams const ¶ms=ConfigParams{})
Constructor that expects its beacons to be set later. It is told the camera matrix and distortion coe...
Class to track an object that has identified LED beacons on it as seen in a camera, where the absolute location of the LEDs with respect to a common frame of reference is known. Returns the transformation that takes points from the model coordinate system to the camera coordinate system.
Header providing a C++ wrapper around TimeValueC.h.
A structure defining a 3D (6DOF) rigid body pose: translation and rotation.
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
bool ProjectBeaconsToImage(std::vector< cv::Point2f > &outPose)
Project the beacons into image space given the most-recent estimation of pose.
void permitKalmanMode(bool permitKalman)
EIGEN_MAKE_ALIGNED_OPERATOR_NEW bool EstimatePoseFromLeds(LedGroup &leds, OSVR_TimeValue const &tv, OSVR_PoseState &out)
Produce an estimate of the pose of the model-space origin in camera space, where the origin is at the...