gym_gz_environments.randomizers#

gym_gz_environments.randomizers.cartpole#

class gym_gz_environments.randomizers.cartpole.CartpoleEnvRandomizer(env, num_physics_rollouts=0)#

Bases: GazeboEnvRandomizer, CartpoleRandomizersMixin

Concrete implementation of cartpole environments randomization.

class gym_gz_environments.randomizers.cartpole.CartpoleRandomizersMixin(randomize_physics_after_rollouts=0)#

Bases: TaskRandomizer, PhysicsRandomizer, ModelDescriptionRandomizer, ABC

Mixin that collects the implementation of task, model and physics randomizations for cartpole environments.

get_engine()#

Return the physics engine to use for the rollout.

Note

Supported physics engines:

Returns:

The desired physics engine to set in the world.

randomize_model_description(task, **kwargs)#

Randomize the model description.

Parameters:

task () – The task that operates on the model description to randomize.

Return type:

Returns:

A string with the randomized model description.

randomize_physics(task, **kwargs)#

Method that insert and configures the physics of a Task’s world.

By default this method loads a plugin that uses DART with no randomizations. Randomizing physics engine parameters or changing physics engine backend could be done by redefining this method and passing it to GazeboRuntime.

Parameters:

task () – A task containing a world object without physics.

Return type:

randomize_task(task, **kwargs)#

Randomize a Task instance.

Parameters:

task () – the task to randomize.

Note

Note that each task has a world property that provides access to the simulated scenario.bindings.core.World.

Return type:

gym_gz_environments.randomizers.cartpole_no_rand#

class gym_gz_environments.randomizers.cartpole_no_rand.CartpoleEnvNoRandomizations(env)#

Bases: GazeboEnvRandomizer

Dummy environment randomizer for cartpole tasks.

Check CartpoleRandomizersMixin for an example that randomizes the task, the physics, and the model.

randomize_task(task, **kwargs)#

Prepare the scene for cartpole tasks. It simply removes the cartpole of the previous rollout and inserts a new one in the default state. Then, the active Task will reset the state of the cartpole depending on the implemented decision-making logic. :rtype: