pycram.resolver.probabilistic.probabilistic_action

Module Contents

Classes

ProbabilisticAction

Abstract class for probabilistic actions.

GaussianCostmapModel

Class that generates a Gaussian Costmap around the center of an object. The costmap cuts out a square in the middle

MoveAndPickUp

Abstract class for action designator descriptions.

class pycram.resolver.probabilistic.probabilistic_action.ProbabilisticAction(policy: typing_extensions.Optional[probabilistic_model.probabilistic_circuit.probabilistic_circuit.ProbabilisticCircuit] = None)

Abstract class for probabilistic actions.

class Variables

Variables for probabilistic actions.

This inner class serves the purpose to define the variables that are used in a model and make them easily accessible for the user. The user can access the variables by using the dot notation, e.g. self.variables.x.

The members of this class have to be ordered the same way as the variables in the policy. The order of the variables in the policy is most likely alphabetical by name.

policy: probabilistic_model.probabilistic_circuit.probabilistic_circuit.ProbabilisticCircuit

The policy that is used to determine the parameters.

variables: ProbabilisticAction.Variables

The variables of this action.

abstract default_policy() probabilistic_model.probabilistic_circuit.probabilistic_circuit.ProbabilisticCircuit

Create a default policy for the action.

Returns:

The default policy for the action

abstract sample_to_action(sample: typing_extensions.List) pycram.designators.actions.actions.ActionAbstract

Convert a sample from the policy to a performable action. :param sample: The sample :return: The action

class pycram.resolver.probabilistic.probabilistic_action.GaussianCostmapModel(distance_to_center: float = 0.2, variance: float = 0.5)

Class that generates a Gaussian Costmap around the center of an object. The costmap cuts out a square in the middle that has side lengths given by distance_to_center.

distance_to_center: float

The side length of the cut out square.

variance: float

The variance of the distributions involved

relative_x
relative_y
grasp
arm
center_event() random_events.events.Event

Create an event that describes the center of the map.

create_model_with_center() probabilistic_model.probabilistic_circuit.probabilistic_circuit.ProbabilisticCircuit

Create a fully factorized gaussian at the center of the map.

create_model() probabilistic_model.probabilistic_circuit.probabilistic_circuit.ProbabilisticCircuit

Create a gaussian model that assumes mass everywhere besides the center square.

Returns:

The probabilistic circuit

class pycram.resolver.probabilistic.probabilistic_action.MoveAndPickUp(object_designator: pycram.designator.ObjectDesignatorDescription.Object, arms: typing_extensions.List[str], grasps: typing_extensions.List[str], policy: typing_extensions.Optional[probabilistic_model.probabilistic_circuit.probabilistic_circuit.ProbabilisticCircuit] = None)

Bases: pycram.designator.ActionDesignatorDescription, ProbabilisticAction

Abstract class for action designator descriptions. Descriptions hold possible parameter ranges for action designators.

Create a Designator description.

Parameters:

resolver – The grounding method used for the description. The grounding method creates a location instance that matches the description.

class Variables
arm: random_events.variables.Symbolic
grasp: random_events.variables.Symbolic
relative_x: random_events.variables.Continuous
relative_y: random_events.variables.Continuous
variables: MoveAndPickUp.Variables
sample_amount: int = 20

The amount of samples that should be drawn from the policy when iterating over it.

object_designator: pycram.designator.ObjectDesignatorDescription.Object

The object designator that should be picked up.

arms: typing_extensions.List[pycram.datastructures.enums.Arms]

The arms that can be used for the pick up.

grasps: typing_extensions.List[pycram.datastructures.enums.Grasp]

The grasps that can be used for the pick up.

default_policy() probabilistic_model.probabilistic_circuit.probabilistic_circuit.ProbabilisticCircuit

Create a default policy for the action.

Returns:

The default policy for the action

sample_to_action(sample: typing_extensions.List) pycram.designators.actions.actions.MoveAndPickUpPerformable

Convert a sample from the underlying distribution to a performable action. :param sample: The sample :return: The action

events_from_occupancy_and_visibility_costmap() random_events.events.ComplexEvent

Create events from the occupancy and visibility costmap.

Returns:

The events that can be used as evidence for the model.

ground_model(model: typing_extensions.Optional[probabilistic_model.probabilistic_circuit.probabilistic_circuit.ProbabilisticCircuit] = None, event: typing_extensions.Optional[random_events.events.ComplexEvent] = None) probabilistic_model.probabilistic_circuit.probabilistic_circuit.ProbabilisticCircuit

Ground the model to the current evidence.

Parameters:
  • model – The model that should be grounded. If None, the policy is used.

  • event – The events that should be used as evidence. If None, the occupancy costmap is used.

Returns:

The grounded model

iter_with_mode() typing_extensions.Iterator[pycram.designators.actions.actions.MoveAndPickUpPerformable]

Generate actions by sampling from the mode of the policy conditioned on visibility and occupancy.

__iter__() typing_extensions.Iterator[pycram.designators.actions.actions.MoveAndPickUpPerformable]

Generate actions by sampling from the policy conditioned on visibility and occupancy.

iterate_without_occupancy_costmap() typing_extensions.Iterator[pycram.designators.actions.actions.MoveAndPickUpPerformable]

Generate actions by sampling from the policy without conditioning on visibility and occupancy.

static query_for_database()
batch_rollout()

Try the policy without conditioning on visibility and occupancy and count the successful tries.

Amount:

The amount of tries