RobWorkProject
24.12.4-
|
A class for simulating multiple grasping tasks. More...
#include <GraspTaskSimulator.hpp>
Classes | |
struct | GraspedObject |
struct | SimState |
Public Types | |
enum | StepState { GRASPING , LIFTING , NEW_GRASP , APPROACH } |
typedef rw::core::Ptr< GraspTaskSimulator > | Ptr |
smart pointer type | |
Public Member Functions | |
GraspTaskSimulator (rwsim::dynamics::DynamicWorkCell::Ptr dwc, int nrThreads=1) | |
constructor More... | |
virtual | ~GraspTaskSimulator () |
destructor | |
void | load (const std::string &filename) |
load tasks | |
void | load (rwlibs::task::GraspTask::Ptr graspTasks) |
rwlibs::task::GraspTask::Ptr | getTasks () |
rwlibs::task::GraspTask::Ptr | getResult () |
size_t | getNrTargets () |
get the number of targets | |
ThreadSimulator::Ptr | getSimulator () |
std::vector< ThreadSimulator::Ptr > | getSimulators () |
void | init (rwsim::dynamics::DynamicWorkCell::Ptr dwc, const rw::kinematics::State &initState, std::string engineID="ODE") |
void | startSimulation (const rw::kinematics::State &initState) |
void | pauseSimulation () |
void | resumeSimulation () |
bool | isRunning () |
bool | isFinished () |
int | getStat (rwlibs::task::GraspResult::TestStatus status) |
get the statistics of the current simulations More... | |
std::vector< int > | getStat () |
get the current statistics. The array is based on the enumeration rwlibs::task::GraspTask::TestStatus | |
std::string | getStatDescription () |
int | getNrTargetsDone () |
get the number of targets that have been simulated until now | |
void | setAlwaysResting (bool alwaysResting) |
void | setStepDelay (int delay) |
add a delay each time the simulation has stepped. usefull for debuging or visualization. More... | |
void | setWallTimeLimit (double limit) |
Sets the limit on wall time required for single grasp simulation. More... | |
void | setSimTimeLimit (double limit) |
Sets the limit on internal simulation time for single grasp simulation. More... | |
void | setStoreTimedStatePaths (bool enabled) |
Enable storing the simulations as TimedStatePaths. More... | |
void | forceSimulateAll (bool enabled) |
force the simulation of all tasks, even those that already have results in specified in the task More... | |
std::map< rwlibs::task::GraspSubTask *, std::map< rwlibs::task::GraspTarget *, rw::trajectory::TimedStatePath > > | getTimedStatePaths () const |
Get the current map of stored TimedStatePaths. More... | |
Protected Member Functions | |
virtual void | graspFinished (SimState &sstate) |
Callback called after each finished grasp. | |
virtual void | printGraspResult (SimState &sstate) |
Prints result after the grasp is finished. | |
virtual void | simulationFinished (SimState &sstate) |
Callback called after simulation is finished. | |
Protected Attributes | |
rwsim::dynamics::DynamicWorkCell::Ptr | _dwc |
bool | _requestSimulationStop |
int | _stepDelayMs |
int | _autoSaveInterval |
double | _maxObjectGripperDistanceThreshold |
std::vector< int > | _stat |
bool | _initialized |
int | _nrOfThreads |
int | _currentTargetIndex |
bool | _alwaysResting |
int | _gripperDim |
int | _failed |
int | _success |
int | _slipped |
int | _collision |
int | _timeout |
int | _simfailed |
int | _skipped |
int | _nrOfExperiments |
int | _lastSaveTaskIndex |
int | _totalNrOfExperiments |
std::vector< rw::core::Ptr< rwsim::dynamics::RigidBody > > | _objects |
rwsim::dynamics::DynamicDevice::Ptr | _dhand |
rw::core::Ptr< rwsim::dynamics::RigidDevice > | _rhand |
rw::models::Device::Ptr | _hand |
rw::core::Ptr< rwsim::dynamics::KinematicBody > | _hbase |
rw::kinematics::MovableFrame * | _mbase |
rwlibs::simulation::SimulatedController::Ptr | _simGraspController |
rw::kinematics::Frame * | _tcp |
rw::kinematics::State | _homeState |
std::map< rwsim::simulator::ThreadSimulator::Ptr, SimState > | _simStates |
std::vector< rwsim::simulator::ThreadSimulator::Ptr > | _simulators |
rwlibs::task::GraspSubTask * | _currentTask |
rwlibs::task::GraspTarget * | _currentTarget |
rwlibs::task::GraspTask::Ptr | _gtask |
std::stack< std::pair< rwlibs::task::GraspSubTask *, rwlibs::task::GraspTarget * > > | _taskQueue |
rw::core::Ptr< rw::proximity::CollisionDetector > | _collisionDetector |
boost::mutex | _nextTargetLock |
double | _wallTimeLimit |
double | _simTimeLimit |
bool | _storeTimedStatePaths |
bool | _forceSimulateAll |
std::map< rwlibs::task::GraspSubTask *, std::map< rwlibs::task::GraspTarget *, rw::trajectory::TimedStatePath > > | _timedStatePaths |
A class for simulating multiple grasping tasks.
A grasping task can be considered as a sequence of the following states
The home and target poses are controlled through a task description file. Which is also used to write back all the results of the simulation.
The configuration of the simulation is setup through properties. These can be set from the command prompt, loaded by file, or edited in the gui. These properties include:
GraspTaskSimulator | ( | rwsim::dynamics::DynamicWorkCell::Ptr | dwc, |
int | nrThreads = 1 |
||
) |
constructor
dwc | [in] the dynamic workcell |
nrThreads | [in] the number of parallel simulations to run |
|
inline |
force the simulation of all tasks, even those that already have results in specified in the task
enabled |
|
inline |
get the statistics of the current simulations
status | [in] |
|
inline |
Get the current map of stored TimedStatePaths.
Note that setStoreTimedStatePaths must be set to enabled before running the simulation or the map will be empty. Please call this function only after simulation is finished.
void load | ( | rwlibs::task::GraspTask::Ptr | graspTasks | ) |
graspTasks |
|
inline |
Sets the limit on internal simulation time for single grasp simulation.
limit | [in] simulation time limit in seconds (default 30.0) |
|
inline |
add a delay each time the simulation has stepped. usefull for debuging or visualization.
delay |
|
inline |
Enable storing the simulations as TimedStatePaths.
enabled | [in] whether or not a TimeStatePath should be stored for each grasp simulation. |
|
inline |
Sets the limit on wall time required for single grasp simulation.
limit | [in] wall time limit in seconds (default 30.0) |