OpenFrames
Public Types | Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
OpenFrames::TrajectoryFollower Class Reference

Updates FrameTransform objects from Trajectory objects. More...

#include <TrajectoryFollower.hpp>

Inheritance diagram for OpenFrames::TrajectoryFollower:
OpenFrames::TrajectorySubscriber

Public Types

enum  FollowMode { LOOP = 0, LIMIT }
 
enum  FollowData { POSITION = 1, ATTITUDE = 2 }
 

Public Member Functions

 TrajectoryFollower (Trajectory *traj=NULL)
 
 TrajectoryFollower (const TrajectoryFollower &tf, const osg::CopyOp &copyop)
 
 META_Object (OpenFrames, TrajectoryFollower)
 
void setTrajectory (Trajectory *traj)
 
void addTrajectory (Trajectory *traj)
 
void removeTrajectory (Trajectory *traj)
 
void setFollowType (unsigned int data, FollowMode mode)
 
void getFollowType (unsigned int &data, FollowMode &mode) const
 
bool setXData (const Trajectory::DataSource &src)
 
bool setYData (const Trajectory::DataSource &src)
 
bool setZData (const Trajectory::DataSource &src)
 
const Trajectory::DataSourcegetDataSource () const
 
void setDefaultData ()
 
bool getUsingDefaultData ()
 
void setTime (double time)
 
void setOffsetTime (double offsetTime)
 
bool isFollowingTime () const
 
double getLastTime () const
 
TrajectorygetLastTrajectory () const
 
virtual bool run (osg::Object *object, osg::Object *data)
 
virtual void dataCleared (Trajectory *traj)
 
virtual void dataAdded (Trajectory *traj)
 

Protected Types

typedef std::vector< osg::ref_ptr< Trajectory > > TrajList
 

Protected Member Functions

double _computeTime (double time)
 
Trajectory_chooseTrajectory (double time)
 
bool _updateState (double time, FollowData data)
 
bool _verifyDataSources () const
 

Protected Attributes

TrajList _trajList
 
osg::observer_ptr< Trajectory_follow
 
FollowMode _mode
 
unsigned int _data
 
Trajectory::DataSource _dataSource [3]
 
bool _dataValid
 
bool _usingDefaultData
 
bool _needsUpdate
 
bool _followTime
 
double _timeVal
 
double _lastSimTime
 
double _lastAdjustedTime
 
OpenThreads::Mutex _mutex
 

Detailed Description

Updates FrameTransform objects from Trajectory objects.

This class updates a FrameTransform object with the position/attitude of a given set of Trajectory objects. It should be added as an update callback via frameTransformObject->setUpdateCallback(trajectoryFollowerObject). Adjustable parameters are the time scale at which to follow the trajectories, and what to do if the current time is not in the trajectory's time list. If multiple trajectories are specified, then TrajectoryFollower chooses which one to follow based on the current time and follow mode. e.g.: Given trajectory T_i, set of trajectories {T}, and current time t If t not within time of {T}, then wrap t to time of {T} (based on follow mode) If t within time of {T} but not within any T_i, then follow closest T_i If t within time of T_i, then follow T_i.

Member Enumeration Documentation

◆ FollowData

Specifies which of position or attitude we want to follow.

◆ FollowMode

If a trajectory is being followed, the FollowMode specifies how the transform handles the current time being out of range of the followed trajectory's times. If the current time is in the trajectory's time list, then the trajectory's position/attitude is used regardless of the FollowMode setting.

Member Function Documentation

◆ dataAdded()

virtual void OpenFrames::TrajectoryFollower::dataAdded ( Trajectory traj)
inlinevirtual

Called by a trajectory when data is added to it. Must be implemented by derived classes.

Implements OpenFrames::TrajectorySubscriber.

◆ dataCleared()

virtual void OpenFrames::TrajectoryFollower::dataCleared ( Trajectory traj)
inlinevirtual

Inherited from OpenFrames::TrajectorySubscriber Functions that inform about Trajectory changes

Implements OpenFrames::TrajectorySubscriber.

◆ run()

virtual bool OpenFrames::TrajectoryFollower::run ( osg::Object *  object,
osg::Object *  data 
)
virtual

Inherited from osg::Callback, implements the callback.


The documentation for this class was generated from the following file: