pcg_gazebo.generators.constraints
pcg_gazebo.generators.constraints¶
Spatial constraints for the placement of simulation entities into the world.
Constraint¶
Constraint(self)
Attributes
LABEL
(type:str
): Name of the constraint class.
TangentConstraint¶
TangentConstraint(self, reference, frame='world')
The input reference types that are supported are
plane
:
To set a reference plane to which models will be placed tangently,
the reference
input must be provided as
reference = dict(
type='plane',
args=dict(
normal=[0, 0, 1], # A 3 element unit vector normal to the plane
origin=[0, 0, 0] # The 3D position of the origin of the plane
)
)
Attributes
LABEL
(type:str
, value:'tangent'
): Name of the constraint class_REFERENCE_TYPES
(type:list
): List of types of references that can be used for the computation_reference
(type:dict
): Arguments of the type of reference used.
Input arguments
reference
(type:dict
): Arguments for the reference used for the tangent computationframe
(type:str
, default:world
): Name of the frame of reference with respect to which the poses are going to be generated (not implemented)
apply_constraint¶
TangentConstraint.apply_constraint(model)
Input arguments
model
(type:pcg_gazebo.simulation.SimulationModel
): Model entity to have its pose adapted so that it is placed tangent to the reference
WorkspaceConstraint¶
WorkspaceConstraint(self,
geometry_type=None,
frame='world',
holes=None,
pose=None,
**kwargs)
geometry
input is a dict
containing all the arguments necessary to
generate the workspace geometry. For now, only 2D workspaces are supported.
The holes
input is a list of dict
with the same geometry description of
the input geometry
and describe exclusion areas inside the workspace.
The supported geometry inputs to represent a workspace are
area
geometry = dict(
type='area'
description=dict(
points=[
[0, 0, 0],
[0, 1, 1],
...
] # List of 3D points that describe the
vertices of the plane area
)
)
line
geometry=dict(
type='line',
description=dict(
points=[
[0, 0, 0],
[0, 1, 1],
...
] # List of 3D points that describe the line
)
)
circle
geometry=dict(
type='circle'
description=dict(
radius=0.0, # Radius of the circle
center=[0, 0, 0] # Center of the circle as a 3D point
)
)
Others are still not implemented
Attributes
LABEL
(type:str
, value:workspace
): Name of the constraint classGEOMETRIES
(type:list
): List of input geometries that can be used to set a workspace
Input arguments
geometry
(type:dict
, default:None
): Input arguments of the geometry to be generatedframe
(type:str
, default:'world'
): Name of the frame of reference of the workspace (not implemented)holes
(type:dict
, default:None
): Geometries that represent exclusion areas inside the workspace
generate_geometry¶
WorkspaceConstraint.generate_geometry(type, **kwargs)
shapely
entity according to the geometry description
provided. The input type
containts the name of the geometry to
be generated and the necessary arguments must be provided in the dict
input description
.
Possible geometries according to the different input
values in type
are:
area
description=dict(
points=[
[0, 0, 0],
[0, 1, 1],
...
] # List of 3D points that describe the
vertices of the plane area
)
line
description=dict(
points=[
[0, 0, 0],
[0, 1, 1],
...
] # List of 3D points that describe the line
)
circle
description=dict(
center=[-6.8, -6.8, 0] # Center of the circle
radius=0.2 # Radius of the circle
)
Others are still not implemented
Input arguments
type
(type:str
): Geometry type. Options are:line
,area
,volume
,multi_line
,multi_point
,circle
description
(type:dict
): Arguments to describe the geometry
get_bounds¶
WorkspaceConstraint.get_bounds()
get_random_position¶
WorkspaceConstraint.get_random_position()
contains_point¶
WorkspaceConstraint.contains_point(point)
point
is part of the workspace.
Input arguments
point
(type:list
ornumpy.ndarray
): 2D point
contains_polygons¶
WorkspaceConstraint.contains_polygons(polygons)
polygons
list are part of the workspace.
Input arguments
polygons
(type: list ofshapely.Polygon
): List of polygons
get_geometry¶
WorkspaceConstraint.get_geometry()