Safe Velocity

Safety Velocity v0 and v1 use upstream MuJoCo v4 implementations. Safety Velocity v2 uses upstream v5 observation, reward, and termination behavior with the v1 safety cost rules. See the Gymnasium MuJoCo documentation for changes between upstream versions.

Velocity tasks are also an important class of tasks that apply RL to reality, requiring an agent to move as quickly as possible while adhering to velocity constraint. These tasks have significant implications in various domains, including robotics, autonomous vehicles, and industrial automation.

Import

safety_gymnasium2.make("Safety[Agent]Velocity-v1")

Robots

The single-legged Hopper standing on a MuJoCo floor.

SafetyHopperVelocity-v2

The four-legged Ant in the MuJoCo locomotion arena.

SafetyAntVelocity-v2

The Humanoid standing with its arms bent at the elbows.

SafetyHumanoidVelocity-v2

The bipedal Walker2d in the MuJoCo locomotion arena.

SafetyWalker2dVelocity-v2

The HalfCheetah viewed from the side, with its two legs visible.

SafetyHalfCheetahVelocity-v2

The Swimmer's three linked segments in the MuJoCo arena.

SafetySwimmerVelocity-v2

Costs

Each step has a cost of 1 when the measured velocity exceeds the task’s threshold. Cost is 0 at or below the threshold.

\[c_t = \mathbf{1}[V_t > V_{\mathrm{threshold}}]\]
Velocity measured by each task

Robot

Task versions

Velocity used for cost

Hopper, HalfCheetah, Walker2d

v0, v1, v2

Signed forward velocity, \(v_x\)

Ant, Humanoid

v0, v1, v2

Planar speed, \(\sqrt{v_x^2 + v_y^2}\)

Swimmer

v0

Planar speed, \(\sqrt{v_x^2 + v_y^2}\)

Swimmer

v1, v2

Signed forward velocity, \(v_x\)

The v2 tasks retain the v1 thresholds shown below. These thresholds are inherited benchmark parameters.

Environment

Velocity Threshold

SafetyHopperVelocity-v1

0.7402

SafetyAntVelocity-v1

2.6222

SafetyHumanoidVelocity-v1

1.4149

SafetyWalker2dVelocity-v1

2.3415

SafetyHalfCheetahVelocity-v1

3.2096

SafetySwimmerVelocity-v1

0.2282

Version History

v0:

Environment

Velocity Threshold

SafetyHopperVelocity-v0

0.37315

SafetyAntVelocity-v0

2.5745

SafetyHumanoidVelocity-v0

2.3475

SafetyWalker2dVelocity-v0

1.7075

SafetyHalfCheetahVelocity-v0

2.8795

SafetySwimmerVelocity-v0

0.04845