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()
Input arguments
callback_fcn_get_model
(type:callable
): Handle to a function or a lambda function that returns apcg_gazebo.simulation.SimulationModel
associated with a tag name.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.
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_models¶
Engine.set_fixed_pose_models(models)
Input arguments
param
(type:data_type
, default:data
): Parameter description
Returns
Description of return values
run¶
Engine.run()
FixedPoseEngine¶
FixedPoseEngine()
callback_fcn_get_model
(type:callable
): Handle to a function or a lambda function that returns apcg_gazebo.simulation.SimulationModel
associated with a tag name.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()
RandomPoseEngine¶
RandomPoseEngine()
Input arguments
callback_fcn_get_model
(type:callable
): Handle to a function or a lambda function that returns apcg_gazebo.simulation.SimulationModel
associated with a tag name.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
get_max_num_models¶
RandomPoseEngine.get_max_num_models(name)
Input arguments
name
(type:str
): Model name
Returns
int
: Maximum number of instances
choose_model¶
RandomPoseEngine.choose_model()
model_picker
.
In case the model_picker
option was set as random
, a random
model will be chosen from the assets available. If it is area
,
the models will be ordered by footprint size and the models are
chosen by an descending footprint size.
Returns
pcg_gazebo.simulation.SimulationModel
: Chosen model
is_model_in_workspace¶
RandomPoseEngine.is_model_in_workspace(footprint)
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