Simox  2.3.74.0
VirtualRobot::WorkspaceGrid Class Reference

Data Structures

struct  Extends
 
struct  Size
 

Public Types

enum  CellUpdateMode { MIN, MAX }
 

Public Member Functions

EIGEN_MAKE_ALIGNED_OPERATOR_NEW WorkspaceGrid (float minX, float maxX, float minY, float maxY, float discretizeSize, bool checkNeighbors=false)
 
 ~WorkspaceGrid ()
 
int getEntry (float x, float y)
 returns entry of position in x/y plane (in world coords) More...
 
bool getEntry (float x, float y, int &storeEntry, GraspPtr &storeGrasp)
 
bool getEntry (float x, float y, int &nStoreEntry, std::vector< GraspPtr > &storeGrasps)
 
int getCellEntry (int cellX, int cellY)
 returns entry of discretized square (x/y) More...
 
bool getCellEntry (int cellX, int cellY, int &nStoreEntry, GraspPtr &storeGrasp)
 
bool getCellEntry (int cellX, int cellY, int &nStoreEntry, std::vector< GraspPtr > &storeGrasps)
 
void setEntry (float x, float y, int value, GraspPtr grasp)
 
void setCellEntry (int cellX, int cellY, int value, GraspPtr pGrasp)
 
int getMaxEntry ()
 
void setEntryCheckNeighbors (float x, float y, int value, GraspPtr grasp)
 
bool getRandomPos (int minEntry, float &storeXGlobal, float &storeYGlobal, GraspPtr &storeGrasp, int maxLoops=50, int *entries=NULL)
 tries to find a random position with a entry >= minEntry More...
 
bool getRandomPos (int minEntry, float &storeXGlobal, float &storeYGlobal, std::vector< GraspPtr > &storeGrasps, int maxLoops=50, int *entries=NULL)
 
void reset ()
 
bool fillGridData (WorkspaceRepresentationPtr ws, ManipulationObjectPtr o, GraspPtr g, RobotNodePtr baseRobotNode, float baseOrientation=0, float maxAngle=M_PIf32)
 
bool fillGridData (WorkspaceRepresentationPtr ws, const Eigen::Matrix4f &graspGlobal, GraspPtr g, RobotNodePtr baseRobotNode, float baseOrientation=0, float maxAngle=M_PIf32, float minCenterDistance=0)
 
void setGridPosition (float x, float y)
 
void getExtends (float &storeMinX, float &storeMaxX, float &storeMinY, float &storeMaxY)
 
Extends getExtends () const
 
void setCellUpdateMode (const CellUpdateMode mode)
 
void getCells (int &storeCellsX, int &storeCellsY)
 
Size getCells () const
 
Eigen::Vector2f getPosition (int cellX, int cellY) const
 
float getDiscretizeSize () const
 
Eigen::Vector2f getMin () const
 
Eigen::Vector2f getMax () const
 

Static Public Member Functions

static WorkspaceGridPtr MergeWorkspaceGrids (const std::vector< WorkspaceGridPtr > &reachGrids)
 Creates the intersection between multiple grids into one grid by considering for each x,y position the worst values of all grids. More...
 

Protected Member Functions

void setEntries (std::vector< WorkspaceRepresentation::WorkspaceCut2DTransformationPtr > &wsData, const Eigen::Matrix4f &graspGlobal, GraspPtr grasp)
 
void checkAndReplaceValue (int &val, int newVal)
 
int getDataPos (int x, int y)
 

Protected Attributes

float minX
 
float maxX
 
float minY
 
float maxY
 
float discretizeSize
 
int gridSizeX
 
int gridSizeY
 
float gridExtendX
 
float gridExtendY
 
int * data
 
std::vector< GraspPtr > * graspLink
 
const bool checkNeighbors
 

Detailed Description

A 2D grid which represents a quality distribution (e.g. the reachability) at 2D positions w.r.t. one or multiple grasp(s). Internally the inverse workspace data (

See also
WorkspaceRepresentation), which encodes the transformation between robot's base and grasping position, is used. This data is useful to quickly sample positions from where the probability that a grasp is reachable is high (see getRandomPos).

Member Enumeration Documentation

◆ CellUpdateMode

Enumerator
MIN 
MAX 

Constructor & Destructor Documentation

◆ WorkspaceGrid()

VirtualRobot::WorkspaceGrid::WorkspaceGrid ( float  minX,
float  maxX,
float  minY,
float  maxY,
float  discretizeSize,
bool  checkNeighbors = false 
)

Setup the 2D grid with given extends and discretization parameter.

◆ ~WorkspaceGrid()

VirtualRobot::WorkspaceGrid::~WorkspaceGrid ( )

Member Function Documentation

◆ checkAndReplaceValue()

void VirtualRobot::WorkspaceGrid::checkAndReplaceValue ( int &  val,
int  newVal 
)
protected

◆ fillGridData() [1/2]

bool VirtualRobot::WorkspaceGrid::fillGridData ( WorkspaceRepresentationPtr  ws,
ManipulationObjectPtr  o,
GraspPtr  g,
RobotNodePtr  baseRobotNode,
float  baseOrientation = 0,
float  maxAngle = M_PIf32 
)

Fill the grid with inverse reachability data generated from grasp g and object o.

◆ fillGridData() [2/2]

bool VirtualRobot::WorkspaceGrid::fillGridData ( WorkspaceRepresentationPtr  ws,
const Eigen::Matrix4f &  graspGlobal,
GraspPtr  g,
RobotNodePtr  baseRobotNode,
float  baseOrientation = 0,
float  maxAngle = M_PIf32,
float  minCenterDistance = 0 
)

◆ getCellEntry() [1/3]

int VirtualRobot::WorkspaceGrid::getCellEntry ( int  cellX,
int  cellY 
)

returns entry of discretized square (x/y)

◆ getCellEntry() [2/3]

bool VirtualRobot::WorkspaceGrid::getCellEntry ( int  cellX,
int  cellY,
int &  nStoreEntry,
GraspPtr storeGrasp 
)

◆ getCellEntry() [3/3]

bool VirtualRobot::WorkspaceGrid::getCellEntry ( int  cellX,
int  cellY,
int &  nStoreEntry,
std::vector< GraspPtr > &  storeGrasps 
)

◆ getCells() [1/2]

void VirtualRobot::WorkspaceGrid::getCells ( int &  storeCellsX,
int &  storeCellsY 
)

Number of cells in x and y

◆ getCells() [2/2]

Size VirtualRobot::WorkspaceGrid::getCells ( ) const
inline

◆ getDataPos()

int VirtualRobot::WorkspaceGrid::getDataPos ( int  x,
int  y 
)
inlineprotected

◆ getDiscretizeSize()

float VirtualRobot::WorkspaceGrid::getDiscretizeSize ( ) const

◆ getEntry() [1/3]

int VirtualRobot::WorkspaceGrid::getEntry ( float  x,
float  y 
)

returns entry of position in x/y plane (in world coords)

◆ getEntry() [2/3]

bool VirtualRobot::WorkspaceGrid::getEntry ( float  x,
float  y,
int &  storeEntry,
GraspPtr storeGrasp 
)

Gets the corresponding entry of a world / global 2d position.

Parameters
xThe x coordinate (in global coordinate system)
yThe y coordinate (in global coordinate system)
storeEntryThe corresponding entry is stored.
storeGraspA random grasp of corresponding cell is stored.
Returns
True if x/y is inside this grid and an entry>0 was found, false otherwise.

◆ getEntry() [3/3]

bool VirtualRobot::WorkspaceGrid::getEntry ( float  x,
float  y,
int &  nStoreEntry,
std::vector< GraspPtr > &  storeGrasps 
)

◆ getExtends() [1/2]

void VirtualRobot::WorkspaceGrid::getExtends ( float &  storeMinX,
float &  storeMaxX,
float &  storeMinY,
float &  storeMaxY 
)

Get extends in global coord system.

◆ getExtends() [2/2]

Extends VirtualRobot::WorkspaceGrid::getExtends ( ) const
inline

◆ getMax()

Eigen::Vector2f VirtualRobot::WorkspaceGrid::getMax ( ) const

◆ getMaxEntry()

int VirtualRobot::WorkspaceGrid::getMaxEntry ( )

◆ getMin()

Eigen::Vector2f VirtualRobot::WorkspaceGrid::getMin ( ) const

◆ getPosition()

Eigen::Vector2f VirtualRobot::WorkspaceGrid::getPosition ( int  cellX,
int  cellY 
) const

◆ getRandomPos() [1/2]

bool VirtualRobot::WorkspaceGrid::getRandomPos ( int  minEntry,
float &  storeXGlobal,
float &  storeYGlobal,
GraspPtr storeGrasp,
int  maxLoops = 50,
int *  entries = NULL 
)

tries to find a random position with a entry >= minEntry

◆ getRandomPos() [2/2]

bool VirtualRobot::WorkspaceGrid::getRandomPos ( int  minEntry,
float &  storeXGlobal,
float &  storeYGlobal,
std::vector< GraspPtr > &  storeGrasps,
int  maxLoops = 50,
int *  entries = NULL 
)

◆ MergeWorkspaceGrids()

WorkspaceGridPtr VirtualRobot::WorkspaceGrid::MergeWorkspaceGrids ( const std::vector< WorkspaceGridPtr > &  reachGrids)
static

Creates the intersection between multiple grids into one grid by considering for each x,y position the worst values of all grids.

Parameters
reachGridsgrids for different grasp poses or object poses
Returns
new, merged grid

◆ reset()

void VirtualRobot::WorkspaceGrid::reset ( )

Clear all entries.

◆ setCellEntry()

void VirtualRobot::WorkspaceGrid::setCellEntry ( int  cellX,
int  cellY,
int  value,
GraspPtr  pGrasp 
)

◆ setCellUpdateMode()

void VirtualRobot::WorkspaceGrid::setCellUpdateMode ( const CellUpdateMode  mode)
inline

◆ setEntries()

void VirtualRobot::WorkspaceGrid::setEntries ( std::vector< WorkspaceRepresentation::WorkspaceCut2DTransformationPtr > &  wsData,
const Eigen::Matrix4f &  graspGlobal,
GraspPtr  grasp 
)
protected

Adds data stored in reachability transformations. This data defines transformations from robot base system to grasping pose, so when defining a grasping pose, the inverse reachability can be represented by this grid Therefor the "world coordinates" of the inverse reachability distributions are computed by T_grasp * ReachTransformation^-1

◆ setEntry()

void VirtualRobot::WorkspaceGrid::setEntry ( float  x,
float  y,
int  value,
GraspPtr  grasp 
)

sets the entry to value, if the current value is lower

◆ setEntryCheckNeighbors()

void VirtualRobot::WorkspaceGrid::setEntryCheckNeighbors ( float  x,
float  y,
int  value,
GraspPtr  grasp 
)

This method sets the grid value to nValue and checks if the neighbors have a lower value and in case the value of the neighbors is set to nValue.

◆ setGridPosition()

void VirtualRobot::WorkspaceGrid::setGridPosition ( float  x,
float  y 
)

Move the grid to (x,y), given in global coordinate system. Sets the new center.

Field Documentation

◆ checkNeighbors

const bool VirtualRobot::WorkspaceGrid::checkNeighbors
protected

◆ data

int* VirtualRobot::WorkspaceGrid::data
protected

◆ discretizeSize

float VirtualRobot::WorkspaceGrid::discretizeSize
protected

◆ graspLink

std::vector<GraspPtr>* VirtualRobot::WorkspaceGrid::graspLink
protected

◆ gridExtendX

float VirtualRobot::WorkspaceGrid::gridExtendX
protected

◆ gridExtendY

float VirtualRobot::WorkspaceGrid::gridExtendY
protected

◆ gridSizeX

int VirtualRobot::WorkspaceGrid::gridSizeX
protected

◆ gridSizeY

int VirtualRobot::WorkspaceGrid::gridSizeY
protected

◆ maxX

float VirtualRobot::WorkspaceGrid::maxX
protected

◆ maxY

float VirtualRobot::WorkspaceGrid::maxY
protected

◆ minX

float VirtualRobot::WorkspaceGrid::minX
protected

◆ minY

float VirtualRobot::WorkspaceGrid::minY
protected