Skip to content

The first exam for code agents in the physical world: frozen robot tasks from many benchmark suites, each answered with a program and verified in a separate sandbox. Runs on Harbor.

1.8 KB
Raw Blame
{
 "methods": [
  {
   "cls": "Sit",
   "module": "humanoid_bench.envs.basic_locomotion_envs",
   "name": "get_reward",
   "source": "def get_reward(self):\n    sitting = rewards.tolerance(\n        self._env.data.qpos[2], bounds=(0.68, 0.72), margin=0.2\n    )\n    chair_location = self._env.named.data.xpos[\"chair\"]\n    on_chair = rewards.tolerance(\n        self._env.data.qpos[0] - chair_location[0], bounds=(-0.19, 0.19), margin=0.2\n    ) * rewards.tolerance(self._env.data.qpos[1] - chair_location[1], margin=0.1)\n    sitting_posture = rewards.tolerance(\n        self.robot.head_height() - self._env.named.data.site_xpos[\"imu\", \"z\"],\n        bounds=(0.35, 0.45),\n        margin=0.3,\n    )\n    upright = rewards.tolerance(\n        self.robot.torso_upright(),\n        bounds=(0.95, float(\"inf\")),\n        sigmoid=\"linear\",\n        margin=0.9,\n        value_at_margin=0,\n    )\n    sit_reward = (0.5 * sitting + 0.5 * on_chair) * upright * sitting_posture\n    small_control = rewards.tolerance(\n        self.robot.actuator_forces(),\n        margin=10,\n        value_at_margin=0,\n        sigmoid=\"quadratic\",\n    ).mean()\n    small_control = (4 + small_control) / 5\n\n    horizontal_velocity = self.robot.center_of_mass_velocity()[[0, 1]]\n    dont_move = rewards.tolerance(horizontal_velocity, margin=2).mean()\n    return small_control * sit_reward * dont_move, {\n        \"small_control\": small_control,\n        \"sit_reward\": sit_reward,\n        \"dont_move\": dont_move,\n        \"sitting\": sitting,\n        \"upright\": upright,\n        \"sitting_posture\": sitting_posture,\n    }"
  }
 ],
 "module_globals": {
  "humanoid_bench.envs.basic_locomotion_envs": "_CRAWL_HEIGHT = 0.8\n_STAND_HEIGHT = 1.65"
 },
 "task_class": "humanoid_bench.envs.basic_locomotion_envs.Sit"
}