25 #ifndef INCLUDED_TrackedBodyTarget_h_GUID_E4315530_5C4F_4DB4_2497_11686F0F6E0E
26 #define INCLUDED_TrackedBodyTarget_h_GUID_E4315530_5C4F_4DB4_2497_11686F0F6E0E
37 #include <boost/assert.hpp>
47 struct CameraParameters;
53 cv::Point2d measurement = {0, 0};
54 cv::Point2d residual = {0, 0};
62 enum class TargetStatusMeasurement {
68 PosErrorVarianceLimit,
81 Eigen::Vector3d
const &targetToBody,
84 EIGEN_MAKE_ALIGNED_OPERATOR_NEW
86 std::vector<BeaconData>
const &getBeaconDebugData()
const {
87 return m_beaconDebugData;
90 UnderlyingBeaconIdType getNumBeacons()
const {
91 return static_cast<UnderlyingBeaconIdType
>(m_numBeacons);
95 TrackedBody const &getBody()
const {
return m_body; }
135 bool validStateAndTime);
156 Eigen::Quaterniond &quat,
int skipBrightsCutoff = -1,
157 std::size_t iterations = 5);
168 return m_beaconOffset;
172 LedGroup
const &
leds()
const;
186 Eigen::Vector3d
const &getTargetToBody()
const {
187 return m_targetToBody;
193 static Eigen::Vector3d
194 computeTranslationCorrection(Eigen::Vector3d
const &bodyFrameOffset,
195 Eigen::Quaterniond
const &orientation);
197 Eigen::Vector3d computeTranslationCorrectionToBody(
198 Eigen::Quaterniond
const &orientation)
const;
201 std::ostream &msg()
const;
202 void enterKalmanMode();
203 void enterRANSACMode();
204 void enterRANSACKalmanMode();
206 void dumpBeaconsToConsole()
const;
211 void updateUsableLeds();
215 ConfigParams
const &getParams()
const;
216 void m_verifyInvariants()
const {
217 BOOST_ASSERT_MSG(m_beacons.size() ==
218 m_beaconMeasurementVariance.size(),
219 "Must have the same number of beacons as default "
220 "measurement variances.");
222 m_beacons.size() == m_beaconFixed.size(),
223 "Must have the same number of beacons as beacon fixed flags.");
224 BOOST_ASSERT_MSG(m_beacons.size() ==
225 m_beaconEmissionDirection.size(),
226 "Must have the same number of beacons as beacon "
227 "emission directions.");
229 using BeaconState = kalman::PureVectorState<3>;
230 using BeaconStateVec = std::vector<std::unique_ptr<BeaconState>>;
240 Eigen::Vector3d m_targetToBody;
242 const std::size_t m_numBeacons;
247 BeaconStateVec m_beacons;
248 std::vector<double> m_beaconMeasurementVariance;
250 std::vector<bool> m_beaconFixed;
251 Vec3Vector m_beaconEmissionDirection;
254 std::vector<BeaconData> m_beaconDebugData;
256 BeaconStateVec m_origBeacons;
258 Eigen::Vector3d m_beaconOffset;
260 bool m_hasPoseEstimate =
false;
264 std::unique_ptr<Impl> m_impl;
269 #endif // INCLUDED_TrackedBodyTarget_h_GUID_E4315530_5C4F_4DB4_2497_11686F0F6E0E
TargetId getId() const
Get the target id within this body.
bool uncalibratedRANSACPoseEstimateFromLeds(CameraParameters const &camParams, Eigen::Vector3d &xlate, Eigen::Quaterniond &quat, int skipBrightsCutoff=-1, std::size_t iterations=5)
A way for targets to access internals of a tracked body.
Eigen::Vector3d getBeaconAutocalibPosition(ZeroBasedBeaconId i) const
std::size_t processLedMeasurements(LedMeasurementVec const &undistortedLeds)
bool updatePoseEstimateFromLeds(CameraParameters const &camParams, osvr::util::time::TimeValue const &tv, BodyState &bodyState, osvr::util::time::TimeValue const &startingTime, bool validStateAndTime)
LedPtrList const & usableLeds() const
Get a list of pointers to all recognized, in-range beacons/leds.
LedGroup const & leds() const
Get all beacons/leds, including unrecognized ones.
double getInternalStatusMeasurement(TargetStatusMeasurement measurement) const
bool hasPoseEstimate() const
Eigen::Vector3d const & getBeaconOffset() const
Header providing a C++ wrapper around TimeValueC.h.
TrackedBodyTarget(TrackedBody &body, BodyTargetInterface const &bodyIface, Eigen::Vector3d const &targetToBody, TargetSetupData const &setupData, TargetId id)
BodyTargetId getQualifiedId() const
Get a fully-qualified (within a tracking system) id for this target.
std::size_t numTrackingResets() const
Standardized, portable parallel to struct timeval for representing both absolute times and time inter...
Eigen::Vector3d getStateCorrection() const
Get the beacon offset transformed into world space.
void resetBeaconAutocalib()
Reset beacon autocalibration position and variance.
Eigen::Vector3d getBeaconAutocalibVariance(ZeroBasedBeaconId i) const