trajectory_player.h
Go to the documentation of this file.
1 
26 #ifndef TESSERACT_VISUALIZATION_TRAJECTORY_PLAYER_H
27 #define TESSERACT_VISUALIZATION_TRAJECTORY_PLAYER_H
28 
31 #include <chrono>
32 #include <memory>
34 
35 #include <tesseract_common/fwd.h>
36 
38 {
39 class TrajectoryInterpolator;
40 
43 {
44 public:
47  TrajectoryPlayer(const TrajectoryPlayer&) = delete;
51 
56  void setTrajectory(const tesseract_common::JointTrajectory& trajectory);
57 
62  void setScale(double scale);
63 
70 
77 
83 
89  tesseract_common::JointState getByIndex(long index) const;
90 
95  double currentDuration() const;
96 
101  double trajectoryDurationBegin() const;
102 
107  double trajectoryDurationEnd() const;
108 
113  bool isFinished() const;
114 
119  void enableLoop(bool loop);
120 
125  bool isLoopEnabled() const;
126 
128  void reset();
129 
131  long size() const;
132 
133 private:
134  std::unique_ptr<TrajectoryInterpolator> trajectory_{ nullptr };
137  double current_duration_{ 0 };
138  double scale_{ 1 };
139  bool loop_{ false };
140  bool finished_{ false };
141 
142  std::chrono::time_point<std::chrono::high_resolution_clock> start_time_;
143 };
144 
145 } // namespace tesseract_visualization
146 
147 #endif // TESSERACT_VISUALIZATION_TRAJECTORY_PLAYER_H
tesseract_visualization::TrajectoryPlayer::~TrajectoryPlayer
~TrajectoryPlayer()
duration
std::chrono::system_clock::duration duration
tesseract_visualization::TrajectoryPlayer::trajectoryDurationEnd
double trajectoryDurationEnd() const
Get the trajectory duration at the end state.
Definition: trajectory_player.cpp:136
tesseract_visualization::TrajectoryPlayer::setCurrentDuration
tesseract_common::JointState setCurrentDuration(double duration)
Set the current time for the player by duration.
Definition: trajectory_player.cpp:76
tesseract_visualization::TrajectoryPlayer::current_duration_
double current_duration_
Definition: trajectory_player.h:137
tesseract_visualization::TrajectoryPlayer::enableLoop
void enableLoop(bool loop)
Enable looping playback of the trajectory.
Definition: trajectory_player.cpp:140
tesseract_visualization::TrajectoryPlayer::size
long size() const
The size of the tajectory.
Definition: trajectory_player.cpp:156
tesseract_visualization::TrajectoryPlayer
Enables the ability to play a trajectory provided by the set program.
Definition: trajectory_player.h:42
tesseract_visualization::TrajectoryPlayer::currentDuration
double currentDuration() const
Get the current duration populated by the last call to getNext()
Definition: trajectory_player.cpp:132
tesseract_visualization::TrajectoryPlayer::scale_
double scale_
Definition: trajectory_player.h:138
TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
#define TESSERACT_COMMON_IGNORE_WARNINGS_PUSH
tesseract_visualization::TrajectoryPlayer::reset
void reset()
Reset the state of the trajectory player.
Definition: trajectory_player.cpp:144
tesseract_common::JointState
tesseract_visualization::TrajectoryPlayer::setTrajectory
void setTrajectory(const tesseract_common::JointTrajectory &trajectory)
Set the the trajectory for the trajectory player.
Definition: trajectory_player.cpp:40
tesseract_visualization::TrajectoryPlayer::setCurrentDurationByIndex
tesseract_common::JointState setCurrentDurationByIndex(long index)
Set the current time for the player by index of the input trajectoy.
Definition: trajectory_player.cpp:55
tesseract_common::JointTrajectory
tesseract_visualization::TrajectoryPlayer::finished_
bool finished_
Definition: trajectory_player.h:140
tesseract_visualization::TrajectoryPlayer::isFinished
bool isFinished() const
Check if the player has the reached the end of the trajectory.
Definition: trajectory_player.cpp:138
TESSERACT_COMMON_IGNORE_WARNINGS_POP
tesseract_visualization::TrajectoryPlayer::getByIndex
tesseract_common::JointState getByIndex(long index) const
Get move instruction by index.
Definition: trajectory_player.cpp:127
fwd.h
tesseract_visualization::TrajectoryPlayer::loop_
bool loop_
Definition: trajectory_player.h:139
tesseract_visualization::TrajectoryPlayer::isLoopEnabled
bool isLoopEnabled() const
Get if looping playback is enabled.
Definition: trajectory_player.cpp:142
tesseract_visualization::TrajectoryPlayer::getNext
tesseract_common::JointState getNext()
Get the next move instruction from the player.
Definition: trajectory_player.cpp:100
macros.h
tesseract_visualization::TrajectoryPlayer::setScale
void setScale(double scale)
Set the scale factor for the play back of the trajectory.
Definition: trajectory_player.cpp:53
tesseract_visualization::TrajectoryPlayer::operator=
TrajectoryPlayer & operator=(const TrajectoryPlayer &)=delete
tesseract_visualization::TrajectoryPlayer::trajectoryDurationBegin
double trajectoryDurationBegin() const
Get the trajectory duration at the begin state.
Definition: trajectory_player.cpp:134
tesseract_visualization::TrajectoryPlayer::trajectory_duration_start_
double trajectory_duration_start_
Definition: trajectory_player.h:135
tesseract_visualization::TrajectoryPlayer::trajectory_duration_end_
double trajectory_duration_end_
Definition: trajectory_player.h:136
tesseract_visualization::TrajectoryPlayer::trajectory_
std::unique_ptr< TrajectoryInterpolator > trajectory_
Definition: trajectory_player.h:134
tesseract_visualization::TrajectoryPlayer::start_time_
std::chrono::time_point< std::chrono::high_resolution_clock > start_time_
Definition: trajectory_player.h:142
tesseract_visualization
Definition: fwd.h:4
tesseract_visualization::TrajectoryPlayer::TrajectoryPlayer
TrajectoryPlayer()


tesseract_visualization
Author(s): Levi Armstrong
autogenerated on Wed Apr 9 2025 03:03:25