RobWorkProject  23.9.11-
Public Types | Public Member Functions | List of all members
EngineTest::TestHandle Class Reference

Handle for a concrete test run, which makes it possible to interact with the test during simulation. More...

#include <EngineTest.hpp>

Public Types

typedef rw::core::Ptr< TestHandlePtr
 Smart pointer.
 

Public Member Functions

 TestHandle ()
 Constructor.
 
virtual ~TestHandle ()
 Destructor.
 
virtual std::string getError () const
 Get description of a simulation error. More...
 
virtual rw::trajectory::TimedStatePath getTimedStatePath () const
 Get the timed state path, which will allow playback of the simulation. More...
 
virtual const std::vector< Result > & getResults () const
 Get a vector of all results from the test run. More...
 
virtual ResultgetResult (const std::string &name)
 Get a reference to a specific result. More...
 
virtual void setError (const std::string &error)
 Set a simulation error. More...
 
virtual void append (const rw::trajectory::TimedState &tstate)
 Append a timed state. More...
 
virtual void append (const Result &result)
 Append with a new Result. More...
 
virtual void addResult (const std::string &name, const std::string &description="")
 Construct a new Result with given name. More...
 
virtual bool isAborted ()
 Check if test has been aborted. More...
 
virtual void abort ()
 Request that the simulation is aborted.
 
virtual bool success () const
 Check if the test was successful. More...
 
void setTimeCallback (TimeCallback cb)
 Set a callback to retrieve the current state of the test run. More...
 
void callback (double time, bool failed, bool done)
 Invoke the callback if it is set. More...
 
void setDynamicWorkCell (const rw::core::Ptr< rwsim::dynamics::DynamicWorkCell > &dwc)
 Set the Dynamic WorkCell used in the test. More...
 
const rw::core::Ptr< rwsim::dynamics::DynamicWorkCell > & getDynamicWorkCell () const
 Get the Dynamic WorkCell used in the test. More...
 

Detailed Description

Handle for a concrete test run, which makes it possible to interact with the test during simulation.

Member Function Documentation

◆ addResult()

virtual void addResult ( const std::string &  name,
const std::string &  description = "" 
)
virtual

Construct a new Result with given name.

Parameters
name[in] the name of the Result.
description[in] the description of the result.

◆ append() [1/2]

virtual void append ( const Result result)
virtual

Append with a new Result.

Parameters
result[in] the result to add.

◆ append() [2/2]

virtual void append ( const rw::trajectory::TimedState tstate)
virtual

Append a timed state.

Parameters
tstate[in] the timed state.

◆ callback()

void callback ( double  time,
bool  failed,
bool  done 
)

Invoke the callback if it is set.

Parameters
time[in] the current simulation time.
failed[in] whether or not simulation has failed.
done[in] whether or not simulation has ended.

◆ getDynamicWorkCell()

const rw::core::Ptr<rwsim::dynamics::DynamicWorkCell>& getDynamicWorkCell ( ) const

Get the Dynamic WorkCell used in the test.

Returns
reference to a DynamicWorkCell smart pointer.

◆ getError()

virtual std::string getError ( ) const
virtual

Get description of a simulation error.

Note
This gives only overall simulation errors. Individual results from the test can still give failures.
Returns
empty string if there was no simulation error, or string giving the error.

◆ getResult()

virtual Result& getResult ( const std::string &  name)
virtual

Get a reference to a specific result.

Parameters
name[in] the name of the result to find.
Returns
the Result object with given name
Exceptions
Exceptionif name is not found.

◆ getResults()

virtual const std::vector<Result>& getResults ( ) const
virtual

Get a vector of all results from the test run.

Returns
a vector of Result objects.

◆ getTimedStatePath()

virtual rw::trajectory::TimedStatePath getTimedStatePath ( ) const
virtual

Get the timed state path, which will allow playback of the simulation.

Returns
a timed state path.

◆ isAborted()

virtual bool isAborted ( )
virtual

Check if test has been aborted.

Returns
true if aborted.

◆ setDynamicWorkCell()

void setDynamicWorkCell ( const rw::core::Ptr< rwsim::dynamics::DynamicWorkCell > &  dwc)

Set the Dynamic WorkCell used in the test.

Parameters
dwc[in] reference to a DynamicWorkCell smart pointer.

◆ setError()

virtual void setError ( const std::string &  error)
virtual

Set a simulation error.

Parameters
error[in] a description of the simulation error.

◆ setTimeCallback()

void setTimeCallback ( TimeCallback  cb)

Set a callback to retrieve the current state of the test run.

Parameters
cb[in] the function to call.

◆ success()

virtual bool success ( ) const
virtual

Check if the test was successful.

Returns
true if there were no simulation failures, and no failures were registered in the results.

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