RobWorkProject  23.9.11-
Public Types | Signals | Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
Player Class Reference

This is the core functionality of the playback plugin. The controls in PlayBack is forwarded to this utility. More...

#include <Player.hpp>

Inherits QObject.

Public Types

typedef rw::core::Ptr< PlayerPtr
 Smart pointer type for Player.
 

Signals

void relativePositionChanged (double val)
 Emitted during playback. More...
 

Public Member Functions

 Player (rw::trajectory::TimedStatePath statePath, rw::core::Ptr< StateDraw > drawer, double tickInterval, rws::RobWorkStudio *rwstudio)
 Construct a new player. More...
 
 Player (rw::trajectory::TimedStatePath::Ptr statePath, rw::core::Ptr< StateDraw > drawer, double tickInterval, rws::RobWorkStudio *rwstudio)
 Construct a new player. More...
 
 Player (double tickInterval, rws::RobWorkStudio *rwstudio)
 Construct a new player that can be used only for recording. More...
 
void forward ()
 Start the playback in forward direction.
 
void backward ()
 Start the playback in backward direction.
 
void pauseOrResume ()
 Pause or resume the playback.
 
void toStart ()
 Move to start of path.
 
void toEnd ()
 Move to end of path.
 
void step (bool forward)
 Take a single step. More...
 
void setRelativePosition (double relative)
 Move to a relative position. More...
 
void setRelativeSpeed (double speed)
 Scale the speed. More...
 
std::string getInfoLabel () const
 Get the current status of the player. More...
 
void setLoopPlayback (bool loop)
 Whether to loop the playback or not. More...
 
void setTickInterval (double interval)
 Set up the interval between ticks. More...
 
void startRecording ()
 Starts recording.
 
void setupRecording (const QString filename, const QString &type)
 Sets up recording to save files as filename of type type. More...
 
void stopRecording ()
 Stops recording.
 
void setInterpolate (bool interpolate)
 Enable/disable interpolation for a more smooth playback. More...
 
int getPlayDirection ()
 get the current play direction More...
 

Static Public Member Functions

static Player::Ptr makeEmptyPlayer ()
 Construct an empty player. More...
 
static Player::Ptr makePlayer (const rw::trajectory::TimedStatePath &statePath, rw::core::Ptr< StateDraw > drawer, double tickInterval, rws::RobWorkStudio *rwstudio)
 Construct a new player. More...
 
static Player::Ptr makePlayer (const rw::trajectory::TimedStatePath::Ptr statePath, rw::core::Ptr< StateDraw > drawer, double tickInterval, rws::RobWorkStudio *rwstudio)
 Construct a new player. More...
 

Public Attributes

rw::trajectory::StateTrajectory::Ptr _trajectory
 The interpolated trajectory.
 
rw::trajectory::TimedStatePath::Ptr _path
 The original trajectory.
 
bool _recordingOnly
 Indicates whether a trajectory is loaded, or the Player is in recording-only mode.
 

Detailed Description

This is the core functionality of the playback plugin. The controls in PlayBack is forwarded to this utility.

Constructor & Destructor Documentation

◆ Player() [1/3]

Player ( rw::trajectory::TimedStatePath  statePath,
rw::core::Ptr< StateDraw drawer,
double  tickInterval,
rws::RobWorkStudio rwstudio 
)

Construct a new player.

Parameters
statePath[in] the path of timed states.
drawer[in] the drawer to invoke for displaying a new state in the path.
tickInterval[in] the rendering rate.
rwstudio[in] the RobWorkStudio instance (used for saving to file during recordings).

◆ Player() [2/3]

Player ( rw::trajectory::TimedStatePath::Ptr  statePath,
rw::core::Ptr< StateDraw drawer,
double  tickInterval,
rws::RobWorkStudio rwstudio 
)

Construct a new player.

Parameters
statePath[in] the path of timed states.
drawer[in] the drawer to invoke for displaying a new state in the path.
tickInterval[in] the rendering rate.
rwstudio[in] the RobWorkStudio instance (used for saving to file during recordings).

◆ Player() [3/3]

Player ( double  tickInterval,
rws::RobWorkStudio rwstudio 
)

Construct a new player that can be used only for recording.

Notice that the state in RobWorkStudio must be updated through other means, for instance by the user.

Parameters
tickInterval[in] the recording rate.
rwstudio[in] the RobWorkStudio instance (used for saving to file during recordings).

Member Function Documentation

◆ getInfoLabel()

std::string getInfoLabel ( ) const

Get the current status of the player.

Returns
a status string.

◆ getPlayDirection()

int getPlayDirection ( )

get the current play direction

Returns
the play direction 1 = forward, -1 = backward.

◆ makeEmptyPlayer()

static Player::Ptr makeEmptyPlayer ( )
static

Construct an empty player.

Returns
empty player.

◆ makePlayer() [1/2]

static Player::Ptr makePlayer ( const rw::trajectory::TimedStatePath statePath,
rw::core::Ptr< StateDraw drawer,
double  tickInterval,
rws::RobWorkStudio rwstudio 
)
static

Construct a new player.

Parameters
statePath[in] the path of timed states.
drawer[in] the drawer to invoke for displaying a new state in the path.
tickInterval[in] the rendering rate.
rwstudio[in] the RobWorkStudio instance (used for saving to file during recordings).

◆ makePlayer() [2/2]

static Player::Ptr makePlayer ( const rw::trajectory::TimedStatePath::Ptr  statePath,
rw::core::Ptr< StateDraw drawer,
double  tickInterval,
rws::RobWorkStudio rwstudio 
)
static

Construct a new player.

Parameters
statePath[in] the path of timed states.
drawer[in] the drawer to invoke for displaying a new state in the path.
tickInterval[in] the rendering rate.
rwstudio[in] the RobWorkStudio instance (used for saving to file during recordings).

◆ relativePositionChanged

void relativePositionChanged ( double  val)
signal

Emitted during playback.

Parameters
val[in] the current playback position as a value between 0 and 1.

◆ setInterpolate()

void setInterpolate ( bool  interpolate)
inline

Enable/disable interpolation for a more smooth playback.

Parameters
interpolate[in] true to do interpolation.

◆ setLoopPlayback()

void setLoopPlayback ( bool  loop)

Whether to loop the playback or not.

Parameters
loop[in] true will loop the playback.

◆ setRelativePosition()

void setRelativePosition ( double  relative)

Move to a relative position.

Parameters
relative[in] a value between 0 and 1.

◆ setRelativeSpeed()

void setRelativeSpeed ( double  speed)

Scale the speed.

Parameters
speed[in] the velocity scale.

◆ setTickInterval()

void setTickInterval ( double  interval)

Set up the interval between ticks.

Parameters
interval[in] the interval.

◆ setupRecording()

void setupRecording ( const QString  filename,
const QString &  type 
)

Sets up recording to save files as filename of type type.

Parameters
filename[in] the filename to save to.
type[in] the filetype.

◆ step()

void step ( bool  forward)

Take a single step.

Parameters
forward[in] true to move one step forward, false to move backwards.

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