pcg_gazebo.generators.engines
pcg_gazebo.generators.engines¶
Pose generator engine definitions that compute the pose of the models according to pre-defined rules.
create_engine¶
create_engine(tag, **kwargs)
LABEL
definition. It returns None
if the engine name
is invalid.
Input parameters
tag
(type:str
): Name of the engine classkwargs
: Inputs for the engine class constructor
Engine¶
Engine(self,
assets_manager=None,
constraints_manager=None,
models=None,
constraints=None,
collision_checker=None,
model_picker=None,
as_model_group=False,
**kwargs)
label¶
str
: Engine name identifier
models¶
List of str
: List of model name tags regarding
the engine's model assets
poses¶
dict
: List of fixed poses associated with model
names.
add_local_constraint¶
Engine.add_local_constraint(model_name, constraint_name)
Input arguments
model_name
(type:str
): Name of the modelconstraint_name
(type:str
): Name of the constraint definition
get_local_constraints_for_model¶
Engine.get_local_constraints_for_model(model_name)
Input arguments
model_name
(type:str
): Name of the model
Returns
List of str
: List of constraint definition names associated
with the model. If the model has no constraints, am empty
list is returned.
apply_local_constraints¶
Engine.apply_local_constraints(model)
Input arguments
model
(type:pcg_gazebo.simulation.SimulationModel
): Model instance
Returns
pcg_gazebo.simulation.SimulationModel
: Model with modified pose.
add_model¶
Engine.add_model(model)
Input arguments
model
(type:str
): Name of the model
set_fixed_pose_model¶
Engine.set_fixed_pose_model(model)
Input arguments
model
(type:simulation.SimulationModel
orsimulation.ModelGroup
): Simulation asset.
Returns
True
, if model could be added to list of
fixed models.
run¶
Engine.run()
FixedPoseEngine¶
FixedPoseEngine(self,
assets_manager,
constraints_manager=None,
models=None,
poses=None,
constraints=None,
collision_checker=None)
callback_fcn_get_constraint
(type:callable
, default:None
): Handle to a function or a lambda function that returns apcg_gazebo.constraints.Constraint
associated with a tag name.models
(type:list
, default:None
): List of models names asstr
relative to the models that the engine will have as assets.constraints
(type:list
, default:None
): List of local constraint configurations that will be applied on to the engine's model assets.poses
(type:list
): List of 6- (position and Euler angles) or 7 element (position and quaternion) poses.
add_pose¶
FixedPoseEngine.add_pose(pose)
Input arguments
pose
(type:list
): 6- (position and Euler angles) or 7 element (position and quaternion) poses.
run¶
FixedPoseEngine.run()
Returns
List of pcg_gazebo.simulation.SimulationModel
: Model instances.
PatternEngine¶
PatternEngine(self,
assets_manager,
constraints_manager=None,
models=None,
constraints=None,
pose=[0, 0, 0, 0, 0, 0],
pattern=None,
collision_checker=None,
**kwargs)
RandomPoseEngine¶
RandomPoseEngine(self,
assets_manager=None,
constraints_manager=None,
is_ground_plane=False,
models=None,
max_num=None,
no_collision=True,
max_area=1,
constraints=None,
policies=None,
model_picker='random',
collision_checker=None,
min_distance=0.0)
Input arguments
assets_manager
(type:pcg_gazebo.generators.AssetsManager
)callback_fcn_get_constraint
(type:callable
, default:None
): Handle to a function or a lambda function that returns apcg_gazebo.constraints.Constraint
associated with a tag name.models
(type:list
, default:None
): List of models names asstr
relative to the models that the engine will have as assets.constraints
(type:list
, default:None
): List of local constraint configurations that will be applied on to the engine's model assets.max_num
(type:dict
, default:None
): Maximum number of instances of the model assets, the key being the model asset's name, and the value the maximum number.no_collision
(type:bool
, default:True
): IfTrue
, the model instances are only added to the world if there are no collisions with the already existing models (except for models flagged as ground plane).max_area
(type:float
, default:1
): Percentage of the allowed area to fill with the models.model_picker
(type:str
, default:random
): Strategy for picking a model from the list of assets for the next placement in the world. Options arerandom
(selecting a random model from the list of assets) orarea
(selecting the models for the biggest to the smallest).policies
(type:dict
, default:None
): The rules for model generation associated with each degree of freedom.
policies:
- models:
- model_1
- model_2
- model_3
config:
- dofs:
- x
- y
policy:
name: workspace
args: area_1 # For more information on
# workspaces, check the
# class definition for
# `pcg_gazebo.constraints.WorkspaceConstraint`
- dofs:
- z
- roll
- pitch
policy:
name: value
args: 0
- dofs:
- yaw
policy:
name: uniform
args:
min: -3.141592653589793
max: 3.141592653589793
reset_counter¶
RandomPoseEngine.reset_counter()
increase_counter¶
RandomPoseEngine.increase_counter(name)
Input arguments
name
(type:str
): Model name
get_num_models¶
RandomPoseEngine.get_num_models(name)
Input arguments
name
(type:str
): Model name
Returns
int
: Number of models
is_model_in_workspace¶
RandomPoseEngine.is_model_in_workspace(model)
Input arguments
footprint
(type:dict
orshapely.geometries.Polygon
): Ashapely
polygon or a dictionary with the values being the footprints for different submodels.
Returns
bool
: True
if the polygon is entirely contained
inside the workspace
get_list_of_footprint_polygons¶
RandomPoseEngine.get_list_of_footprint_polygons(footprint)
footprint
input.
Input arguments
footprint
(type:dict
orshapely.geometries.Polygon
): Ashapely
polygon or a dictionary with the values being the footprints for different submodels.
Returns
List of shapely.geometry.Polygon
: List of footprint polygons
has_collision¶
RandomPoseEngine.has_collision(model)
model
against the current scene of the simulation.
Input arguments
model
(type:pcg_gazebo.simulation.SimulationModel
):
Returns
bool
: True
, if any collision is detected
run¶
RandomPoseEngine.run()
Returns
List of pcg_gazebo.simulation.SimulationModel