Skip to content

PointRobot-misc

PointRobot

Bases: Environment[EnvState, EnvParams]

Navigate a 2D point robot to a hidden goal on a semi-circle.

2D semi-circle point robot environment as in Dorfman et al. (2021). At every reset the goal is sampled uniformly on the upper semi-circle of radius params.circle_radius and stays fixed for the whole episode. The robot starts at a position sampled within the semi-circle, or at the origin if params.center_init. Each step adds the clipped action to the position. When the robot is within params.goal_radius of the goal at the start of a step, it is moved to a new start position at the end of that step. Supports differentiable transitions via with_transition_gradients().

  • Observation: Box of shape (6,) with the robot position, the last reward, the last action and the time step (normalized if params.normalize_time).
  • Actions: Box of shape (2,) with the displacement in x and y, clipped to [-params.max_force, params.max_force].
  • Reward: 1 if the robot is within params.goal_radius of the goal at the start of the step, otherwise 0. If params.dense_reward, the negative distance to the goal at the start of the step instead.
  • Termination: never.
  • Truncation: after params.max_steps_in_episode steps (100 by default).
References

Parameters and state

EnvParams

Bases: EnvParams

Parameters of the PointRobot environment.

Attributes:

  • max_force (float) –

    Bound to which each action component is clipped (+/-).

  • circle_radius (float) –

    Radius of the semi-circle on which the goal is sampled.

  • dense_reward (bool) –

    Whether the reward is the negative distance to the goal at every step instead of a sparse reward for being within the goal radius.

  • goal_radius (float) –

    Distance to the goal within which the goal counts as reached.

  • center_init (bool) –

    Whether the robot starts at (0, 0) instead of a position sampled within the semi-circle.

  • normalize_time (bool) –

    Whether the time step in the observation is rescaled so that steps 0 and 100 map to -1 and 1, instead of given as a raw step count.

  • max_steps_in_episode (int) –

    Number of steps after which the episode is truncated.

EnvState

Bases: EnvState

State of the PointRobot environment.

Attributes:

  • last_action (Array) –

    Action passed to the previous step, before clipping (zeros after a reset).

  • last_reward (Array) –

    Reward received in the previous step (0 after a reset).

  • pos (Array) –

    Position of the robot as (x, y).

  • goal (Array) –

    Position of the goal as (x, y) on the semi-circle.

  • goals_reached (int) –

    Number of times the goal was reached in the current episode.

  • time (float) –

    Number of steps taken in the current episode.