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
Sort_Mode Class Reference

Sort only puzzle solving implementation. More...

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

Public Member Functions

def __init__ (self, CfgSolver cfgSolver, int policy)
 Constructor for Sort Solver instance. More...
 
def display_plan (self, Imeas, sortPlan, window_name="Sort Plan", doRotate=False)
 Display the sort plan via sort zone overlay on puzzle piece. More...
 
def display_solution_hint (self, Imeas, sortPlan, window_name="Solution Match", doRotate=False)
 Display the solution as pick/place vector hints. More...
 
def getNextAction (self, ImageRGBD rgbd=None, StatePuzzleScene scene=None)
 Return the next action to execute from current solver state. More...
 
def getSortPlan (self, ImageRGBD rgbd=None, StatePuzzleScene scene=None)
 Return the sort plan with correct piece ordering for robot to execute. More...
 
def reset_solver (self)
 Reset the solver state and mode. More...
 
- Public Member Functions inherited from Base
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 updateSolutionRegEstimate (self, StatePuzzleScene scene)
 Review pieces in solution region and update estimate. More...
 

Public Attributes

 mode
 
 policy
 
 state
 
 zones_to_estimate
 
- Public Attributes inherited from Base
 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 STRUCTURED_ORDERED = 0
 
int STRUCTURED_UNORDERED = 1
 
int UNSTRUCTURED_ORDERED = 2
 
int UNSTRUCTURED_UNORDERED = 3
 
- Static Public Attributes inherited from Base
int NUM_ZONES = 4
 
int SOL = 5
 
int UNORGANIZED = 6
 

Detailed Description

Sort only puzzle solving implementation.

Constructor & Destructor Documentation

◆ __init__()

def __init__ (   self,
CfgSolver  cfgSolver,
int  policy 
)

Constructor for Sort Solver instance.

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

Member Function Documentation

◆ display_plan()

def display_plan (   self,
  Imeas,
  sortPlan,
  window_name = "Sort Plan",
  doRotate = False 
)

Display the sort plan via sort zone overlay on puzzle piece.

Parameters
[in]IMeasThe measured image.
[in]sortPlanRecovered plan.
[in]window_nameOptional window name (default:"Sort Plan")
Note
Quick and dirty solution given that I don't know code well. 2027/07/28 - PAV.

◆ display_solution_hint()

def display_solution_hint (   self,
  Imeas,
  sortPlan,
  window_name = "Solution Match",
  doRotate = False 
)

Display the solution as pick/place vector hints.


Can be messy if applied to too many puzzle pieces. Either pieces should be organized in some manner, or fewer used (can be problematic). For many piece, it is better to synthesize a virtual solve puzzle image and check that it looks good.

Note
Unsure where virtual solve image creation is. We used to have it but code has changed a lot. 2027/07/29 - PAV.
Parameters
[in]IMeasThe measured image.
[in]sortPlanRecovered plan.
[in]window_nameOptional window name (default:"Solution Match")
Note
Quick and dirty solution given that I don't know code well. 2027/07/28 - PAV.

◆ getNextAction()

def getNextAction (   self,
ImageRGBD  rgbd = None,
StatePuzzleScene  scene = None 
)

Return the next action to execute from current solver state.

Parameters
[in]rgbdRGBD image for the current scene.
[in]sceneCurrent scene state.
Returns
Action to take.
Note
Uses a two-mode state machine: PERCEIVE - handles looking (scene estimation) and sort planning. ACT - executes sort operations for pieces in the sort plan. When all pieces are sorted, ends operations.

◆ getSortPlan()

def getSortPlan (   self,
ImageRGBD  rgbd = None,
StatePuzzleScene  scene = None 
)

Return the sort plan with correct piece ordering for robot to execute.

Based on the policy set initially

Parameters
[in]rgbdRGBD image for the current scene.
[in]sceneSegmented puzzle scene state.
Returns
Sort plan for the current solver policy.

◆ reset_solver()

def reset_solver (   self)

Reset the solver state and mode.

Reimplemented from Base.

Member Data Documentation

◆ mode

mode

◆ policy

policy

◆ state

state

◆ STRUCTURED_ORDERED

int STRUCTURED_ORDERED = 0
static

◆ STRUCTURED_UNORDERED

int STRUCTURED_UNORDERED = 1
static

◆ UNSTRUCTURED_ORDERED

int UNSTRUCTURED_ORDERED = 2
static

◆ UNSTRUCTURED_UNORDERED

int UNSTRUCTURED_UNORDERED = 3
static

◆ zones_to_estimate

zones_to_estimate

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