OSVR-Core
|
This is the class representing a tracked rigid body in the system. More...
#include <TrackedBody.h>
Classes | |
struct | Impl |
Public Member Functions | |
TrackedBody (TrackingSystem &system, BodyId id) | |
Constructor. More... | |
~TrackedBody () | |
Destructor - explicit so we can use unique_ptr for our pimpls. | |
TrackedBody (TrackedBody const &)=delete | |
Noncopyable. | |
TrackedBody & | operator= (TrackedBody const &)=delete |
Non-copy-assignable. | |
BodyId | getId () const |
Gets the body ID within the tracking system. | |
ConfigParams const & | getParams () const |
BodyState const & | getState () const |
bool | hasIMU () const |
Does this tracked body have an IMU? | |
TrackedBodyIMU & | getIMU () |
Get the IMU - only valid if hasIMU is true. | |
TrackedBodyIMU const & | getIMU () const |
Get the IMU - only valid if hasIMU is true. | |
std::size_t | getNumTargets () const |
How many (if any) video-based tracking targets does this tracked body have? | |
TrackedBodyTarget * | getTarget (TargetId id) |
TrackedBodyTarget const * | getTarget (TargetId id) const |
template<typename F > | |
void | forEachTarget (F &&f) |
template<typename F > | |
void | forEachTarget (F &&f) const |
bool | hasPoseEstimate () const |
Do we have a pose estimate for this body in general? More... | |
bool | hasEverHadPoseEstimate () const |
bool | getStateAtOrBefore (osvr::util::time::TimeValue const &desiredTime, osvr::util::time::TimeValue &outTime, BodyState &outState) |
Requests a copy of (a possibly historical snapshot of) body state, as close to desiredTime without being later than it. More... | |
void | replaceStateSnapshot (osvr::util::time::TimeValue const &origTime, osvr::util::time::TimeValue const &newTime, BodyState const &newState) |
This is the counterpart to getStateAtOrBefore() and should only be called subsequent to it. More... | |
void | pruneHistory (OSVR_TimeValue const &videoTime) |
Clean histories of no-longer-needed historical state and measurements. More... | |
osvr::util::time::TimeValue | getStateTime () const |
Get timestamp associated with current state. | |
BodyProcessModel & | getProcessModel () |
BodyState & | getState () |
void | incorporateNewMeasurementFromIMU (util::time::TimeValue const &tv, CannedIMUMeasurement const &meas) |
Incorporates a brand-new measurement from the IMU into the state. More... | |
TrackingSystem & | getSystem () |
TrackingSystem const & | getSystem () const |
Child factories | |
Creates a fully-integrated IMU data source (that is, one that reports a reliable quaternion, and potentially angular velocity) to add to this body.
You do not own the pointer you get back - the tracked body does.
| |
TrackedBodyIMU * | createIntegratedIMU (double orientationVariance, double angularVelocityVariance=1.0) |
TrackedBodyTarget * | createTarget (Eigen::Vector3d const &targetToBody, TargetSetupData const &setupData) |
Creates a video-based tracking target (constellation of beacons) to add to this body. More... | |
This is the class representing a tracked rigid body in the system.
It may be tracked by one (or eventually more) video-based "target" (constellation of beacons in a known pattern with other known traits), and optionally by an IMU/AHRS - an orientation/angular-velocity-only high speed sensor.
This class has overall state
osvr::vbtracker::TrackedBody::TrackedBody | ( | TrackingSystem & | system, |
BodyId | id | ||
) |
Constructor.
Set error covariance matrix diagonal to large values for safety.
TrackedBodyTarget * osvr::vbtracker::TrackedBody::createTarget | ( | Eigen::Vector3d const & | targetToBody, |
TargetSetupData const & | setupData | ||
) |
Creates a video-based tracking target (constellation of beacons) to add to this body.
You do not own the pointer you get back - the tracked body does.
The target will always be target 0...
ConfigParams const & osvr::vbtracker::TrackedBody::getParams | ( | ) | const |
|
inline |
bool osvr::vbtracker::TrackedBody::getStateAtOrBefore | ( | osvr::util::time::TimeValue const & | desiredTime, |
osvr::util::time::TimeValue & | outTime, | ||
BodyState & | outState | ||
) |
Requests a copy of (a possibly historical snapshot of) body state, as close to desiredTime without being later than it.
If no such state is available (primarily because no valid state has been set yet), false will be returned and the out parameters will be untouched.
The purpose is to provide state that is potentially in the past, to integrate delayed measurements (like from video tracking) then later incorporate that state and replay later low-latency measurements.
[in] | desiredTime | The time you'd like state to be at or before
|
[out] | outTime | The timestamp for the state copy you receive - modified only if return value is true. You'll need to retain this to re-submit with your updated state. |
[out] | outState | The copy of the state will be placed here - modified only if return value is true. |
couldn't find such a state.
bool osvr::vbtracker::TrackedBody::hasPoseEstimate | ( | ) | const |
Do we have a pose estimate for this body in general?
void osvr::vbtracker::TrackedBody::incorporateNewMeasurementFromIMU | ( | util::time::TimeValue const & | tv, |
CannedIMUMeasurement const & | meas | ||
) |
Incorporates a brand-new measurement from the IMU into the state.
Called only from the TrackedBodyIMU itself, please!
If room calibration is incomplete, don't handle this locally. If it's an orientation, hand it to the tracking system to hand off to the room calibrator.
If we have ever had a pose estimate, we can apply this IMU measurement. If we haven't yet got a pose from video, toss this or we'll end up getting NaNs.
void osvr::vbtracker::TrackedBody::pruneHistory | ( | OSVR_TimeValue const & | videoTime | ) |
Clean histories of no-longer-needed historical state and measurements.
void osvr::vbtracker::TrackedBody::replaceStateSnapshot | ( | osvr::util::time::TimeValue const & | origTime, |
osvr::util::time::TimeValue const & | newTime, | ||
BodyState const & | newState | ||
) |
This is the counterpart to getStateAtOrBefore() and should only be called subsequent to it.
You provide the timestamp that you originally got with the state from getStateAtOrBefore(), then the updated timestamp and state you got from incorporating your measurement.
In the history of this body, the old state will effectively be replaced (or immediately followed, implementation detail) by this one: classes of newer measurements will be replayed on the state as required to update the current body state to properly incorporate the presumably-dated information you just provided.
origTime | the timestamp originally received from getStateAtOrBefore() as outTime |
newTime | the timestamp currently associated with the state |
newState | the updated state. |
Clear off the state we're about to invalidate.
Put on the new state estimate we just computed.
Replay the IMU measurements timestamped later than our estimate