IVALab Python Libraries
Collection of code for computer vision and robotics with specific API.
Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Base Class Reference

Abstract base class for puzzle solver. More...

Inheritance diagram for Base:
Inheritance graph
[legend]
Collaboration diagram for Base:
Collaboration graph
[legend]

Public Member Functions

def __init__ (self, CfgSolver cfgSolver)
 Constructor for the abstract base puzzle solver. More...
 
def checkIDplaceability (self, solID)
 Checks if piece with solID can be placed must have an adjacent placed piece, or should be on an edge/corner. More...
 
def createMeasuredBoard (self, ImageRGBD rgbd, StatePuzzleScene scene, List[int] zones)
 Take in raw inputs and create (generic) board measurement. More...
 
def createSolutionBoard (self, int zone_to_match)
 Create a solution board based on the zone we want to match against. More...
 
def getNextAction (self)
 Return the next action to execute from current solver state. More...
 
def getSequentialPlan (self, measured_board, solution_board, numPieces)
 Generate a sequential placement plan by sorting matched pieces by solution ID. More...
 
def isBoardSolved (self)
 Check if all puzzle pieces are in place. More...
 
def isPieceThere (self, meaPiece, StatePuzzleScene scene)
 Check if the measured piece is actually present in the scene by analyzing the segmentation mask. More...
 
def performMatching (self, Arrangement measured_board, SolutionBoard solution_board)
 Perform correspondence tracking to find a piece to direct place. More...
 
def reset_estimate_board (self)
 Set the estimate board to all pieces unsolved, based on the solution board. More...
 
def reset_solver (self)
 Reset the solver to begin with a new puzzle or start. More...
 
def updateSolutionRegEstimate (self, StatePuzzleScene scene)
 Review pieces in solution region and update estimate. More...
 

Public Attributes

 board_estimate
 Board estimate from state history. More...
 
 cfgMatching
 Correspondences configs. More...
 
 correspondence_tracker
 Puzzle piece correspondence tracker. More...
 
 display
 Debug display. More...
 
 imRegions
 Region definitions for puzzle zones. More...
 
 mode
 Higher level mode regulating activities. More...
 
 puzzle_params
 Puzzle-specific parameters for arrangement building. More...
 
 reference_board
 Solution reference. More...
 
 state
 Internal activity state. More...
 
 verbose
 Verbosity level. More...
 

Static Public Attributes

int NUM_ZONES = 4
 
int SOL = 5
 
int UNORGANIZED = 6
 

Detailed Description

Abstract base class for puzzle solver.

This class collects all of the functional parts needed to solve a puzzle. A reference (solution) board specification, a matching strategy, a description of the piece sort zones, an estimate of the current board, and other gluing elements. All together, these permit an agent to get a sense for the state of progress and plan out how to complete the puzzle.

Naturally, there can be mistaked in the automation.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
CfgSolver  cfgSolver 
)

Constructor for the abstract base puzzle solver.

Parameters
[in]cfgSolverConfiguration for the solver, including reference board and parameters.

Reimplemented in Tending_Solve, Priority_Tending_Solver, Priority_Solver, and Cycle_Place.

Member Function Documentation

◆ checkIDplaceability()

def checkIDplaceability (   self,
  solID 
)

Checks if piece with solID can be placed must have an adjacent placed piece, or should be on an edge/corner.

Parameters
[in]solIDID of piece to check for visibility / graspability.

◆ createMeasuredBoard()

def createMeasuredBoard (   self,
ImageRGBD  rgbd,
StatePuzzleScene  scene,
List[int]  zones 
)

Take in raw inputs and create (generic) board measurement.

Parameters
[in]rgbdRGBD image.
[in]scenePuzzle scene state.
[in]zonesZone listing for assignment during board measurement.

◆ createSolutionBoard()

def createSolutionBoard (   self,
int  zone_to_match 
)

Create a solution board based on the zone we want to match against.

◆ getNextAction()

def getNextAction (   self)

Return the next action to execute from current solver state.

Parameters
[in]thePlanOptional desired action plan.

◆ getSequentialPlan()

def getSequentialPlan (   self,
  measured_board,
  solution_board,
  numPieces 
)

Generate a sequential placement plan by sorting matched pieces by solution ID.

Parameters
[in]measured_boardThe board with measured/detected pieces.
[in]solution_boardThe reference solution board to match against.
[in]numPiecesNumber of pieces to include in the plan.
Returns
List of tuples containing (measured_piece, solution_piece, rotation).

◆ isBoardSolved()

def isBoardSolved (   self)

Check if all puzzle pieces are in place.

This check may not be a hard-core matching based check.

Returns
Boolean flag indicating all pieces placed or at least one missing.

◆ isPieceThere()

def isPieceThere (   self,
  meaPiece,
StatePuzzleScene  scene 
)

Check if the measured piece is actually present in the scene by analyzing the segmentation mask.

Parameters
[in]meaPieceMeasured piece whose presence we want to verify.
[in]sceneCurrent puzzle scene containing the segmentation mask.
Returns
True if the piece is likely present based on the segmentation mask, False otherwise.

◆ performMatching()

def performMatching (   self,
Arrangement  measured_board,
SolutionBoard  solution_board 
)

Perform correspondence tracking to find a piece to direct place.

    @param[in]  measured_board  Latest measured board.
    @param[in]  solution_board  Known solution board.

◆ reset_estimate_board()

def reset_estimate_board (   self)

Set the estimate board to all pieces unsolved, based on the solution board.

◆ reset_solver()

def reset_solver (   self)

Reset the solver to begin with a new puzzle or start.

Resets the board estimate to all pieces unsolved, based on the solution board. Also resets the state.

Reimplemented in Tending_Solve, Sort_Mode, Priority_Tending_Solver, Priority_Solver, Permute_Solver, and Cycle_Place.

◆ updateSolutionRegEstimate()

def updateSolutionRegEstimate (   self,
StatePuzzleScene  scene 
)

Review pieces in solution region and update estimate.

Parameters
[in]scenePuzzle scene state.

Member Data Documentation

◆ board_estimate

board_estimate

Board estimate from state history.

◆ cfgMatching

cfgMatching

Correspondences configs.

◆ correspondence_tracker

correspondence_tracker

Puzzle piece correspondence tracker.

◆ display

display

Debug display.

◆ imRegions

imRegions

Region definitions for puzzle zones.

◆ mode

mode

Higher level mode regulating activities.

Perceive to start.

◆ NUM_ZONES

int NUM_ZONES = 4
static

◆ puzzle_params

puzzle_params

Puzzle-specific parameters for arrangement building.

◆ reference_board

reference_board

Solution reference.

◆ SOL

int SOL = 5
static

◆ state

state

Internal activity state.

◆ UNORGANIZED

int UNORGANIZED = 6
static

◆ verbose

verbose

Verbosity level.


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