gym_ignition_environments.randomizers

gym_ignition_environments.randomizers.cartpole

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

Bases: gym_ignition.randomizers.gazebo_env_randomizer.GazeboEnvRandomizer, gym_ignition_environments.randomizers.cartpole.CartpoleRandomizersMixin

Concrete implementation of cartpole environments randomization.

class gym_ignition_environments.randomizers.cartpole.CartpoleRandomizersMixin(randomize_physics_after_rollouts=0)

Bases: gym_ignition.randomizers.abc.TaskRandomizer, gym_ignition.randomizers.abc.PhysicsRandomizer, gym_ignition.randomizers.abc.ModelDescriptionRandomizer, abc.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 (Union[CartPoleDiscreteBalancing, CartPoleContinuousSwingup, CartPoleContinuousBalancing]) – The task that operates on the model description to randomize.

Return type

str

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 (Union[CartPoleDiscreteBalancing, CartPoleContinuousSwingup, CartPoleContinuousBalancing]) – A task containing a world object without physics.

Return type

None

randomize_task(task, **kwargs)

Randomize a Task instance.

Parameters

task (Union[CartPoleDiscreteBalancing, CartPoleContinuousSwingup, CartPoleContinuousBalancing]) – 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

None

gym_ignition_environments.randomizers.cartpole_no_rand

class gym_ignition_environments.randomizers.cartpole_no_rand.CartpoleEnvNoRandomizations(env)

Bases: gym_ignition.randomizers.gazebo_env_randomizer.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.

Return type

None