gym_gz.utils#

gym_gz.utils.logger#

gym_gz.utils.logger.custom_formatwarning(msg, *args, **kwargs)#

Custom format that overrides warnings.formatwarning().

gym_gz.utils.logger.gym_verbosity(level)#
gym_gz.utils.logger.set_level(level, scenario_level=None)#

Set the verbosity level of both gym and gym_gz.

Accepted values:

  • gym.logger.DEBUG (10)

  • gym.logger.INFO (20)

  • gym.logger.WARN (30)

  • gym.logger.ERROR (40)

  • gym.logger.DISABLED (50)

Parameters:
  • level (int) – The desired verbosity level.

  • scenario_level (Optional[int]) – The desired ScenarIO verbosity level (defaults to level).

Return type:

None

gym_gz.utils.logger.warn(msg, *args)#

Custom definition of gym.logger.warn() function.

Return type:

None

gym_gz.utils.math#

gym_gz.utils.math.denormalize(input, low, high)#
Return type:

Union[Number, ndarray]

gym_gz.utils.math.normalize(input, low, high)#
Return type:

Union[Number, ndarray]

gym_gz.utils.misc#

gym_gz.utils.misc.string_to_file(string)#
Return type:

str

gym_gz.utils.resource_finder#

gym_gz.utils.resource_finder.add_path(data_path)#
Return type:

None

gym_gz.utils.resource_finder.add_path_from_env_var(env_variable)#
Return type:

None

gym_gz.utils.resource_finder.find_resource(file_name)#
Return type:

str

gym_gz.utils.resource_finder.get_search_paths()#
Return type:

List[str]

gym_gz.utils.scenario#

gym_gz.utils.scenario.get_joint_positions_space(model, considered_joints=None)#

Build a Box space from the joint position limits.

Parameters:
  • model (Model) – The model from which generating the joint space.

  • considered_joints (Optional[List[str]]) – List of considered joints. It is helpful to restrict the set of joints and to enforce a custom joint serialization.

Return type:

Box

Returns:

A box space created from the model’s joint position limits.

gym_gz.utils.scenario.get_unique_model_name(world, model_name)#

Get a unique model name given a world configuration.

This function find the first available model name starting from the argument and appending a integer postfix until the resulting name is unique in the world.

Tentatives example: cartpole, cartpole1, cartpole2, …

Parameters:
  • world (World) – An initialized world.

  • model_name (str) – The first model name attempt.

Raises:

ValueError – If the world is not valid.

Return type:

str

Returns:

The unique model name calculated from the original name.

gym_gz.utils.scenario.init_gazebo_sim(step_size=0.001, real_time_factor=1.0, steps_per_run=1)#

Initialize a Gazebo simulation with an empty world and default physics.

Parameters:
  • step_size (float) – Gazebo step size.

  • real_time_factor (float) – The desired real time factor of the simulation.

  • steps_per_run (int) – How many steps should be executed at each Gazebo run.

Raises:

RuntimeError – If the initialization of either the simulator or the world fails.

Return type:

Tuple[GazeboSimulator, Union[World, World]]

Returns:

  • gazebo – The Gazebo simulator.

  • world – The default world.

gym_gz.utils.typing#