Docs(gym): add hyperlinks and JSON config examples to functor docs#220
Docs(gym): add hyperlinks and JSON config examples to functor docs#220
Conversation
Add Sphinx cross-reference hyperlinks ({func}/{class}) for every
functor and action term across all five functor documentation pages.
Embed representative JSON configuration snippets (derived from the
pour_water example config) inside each table's description column,
giving users ready-to-copy config examples alongside each functor
description.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
Documentation update to improve the Gym functor reference pages by adding Sphinx cross-reference hyperlinks to implementations and embedding representative JSON configuration snippets for each functor/term.
Changes:
- Added
{func}/{class}cross-references for functors and action terms so readers can click through to source implementations. - Embedded JSON configuration examples inline in the list-table descriptions across the functor docs.
- Adjusted list-table column widths to accommodate the embedded examples.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 14 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/source/overview/gym/event_functors.md | Adds cross-references and JSON examples for event/randomization functors (several examples need to be aligned with actual signatures). |
| docs/source/overview/gym/observation_functors.md | Adds cross-references and JSON examples for observation functors (several examples don’t match required parameters/shape). |
| docs/source/overview/gym/reward_functors.md | Adds cross-references and JSON examples for reward functors (multiple examples use incorrect parameter names/keys). |
| docs/source/overview/gym/action_functors.md | Adds cross-references and JSON snippets for action terms. |
| docs/source/overview/gym/dataset_functors.md | Adds cross-references and a JSON snippet for the dataset recorder functor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
|
||
| ```json | ||
| {"func": "distance_to_target", "weight": 1.0, | ||
| "params": {"entity_cfg": {"uid": "bottle"}, |
There was a problem hiding this comment.
The JSON example for distance_to_target uses entity_cfg, but the reward functor signature expects source_entity_cfg (see embodichain/lab/gym/envs/managers/rewards.py). Update the example params key so it matches the actual config schema.
| "params": {"entity_cfg": {"uid": "bottle"}, | |
| "params": {"source_entity_cfg": {"uid": "bottle"}, |
| "params": {"robot_uid": "CobotMagic", "part_name": "left_arm", | ||
| "object_cfg": {"uid": "bottle"}, | ||
| "target_cfg": {"uid": "cup"}}} |
There was a problem hiding this comment.
The reaching_behind_object JSON snippet lists params (robot_uid, target_cfg) that the functor does not accept; the implementation takes object_cfg, target_pose_key, behind_offset, height_offset, distance_scale, and part_name. Please update the example to only include supported parameters.
| "params": {"robot_uid": "CobotMagic", "part_name": "left_arm", | |
| "object_cfg": {"uid": "bottle"}, | |
| "target_cfg": {"uid": "cup"}}} | |
| "params": {"part_name": "left_arm", | |
| "object_cfg": {"uid": "bottle"}, | |
| "target_pose_key": "goal_pose", | |
| "behind_offset": 0.1, "height_offset": 0.0, | |
| "distance_scale": 10.0}} |
|
|
||
| ```json | ||
| {"func": "joint_limit_penalty", "weight": 0.01, | ||
| "params": {"robot_uid": "CobotMagic", "part_name": "left_arm", |
There was a problem hiding this comment.
joint_limit_penalty does not accept part_name; it expects joint_ids (or uses the default slice) plus margin and robot_uid. The JSON example should be adjusted to use supported keys (or omit joint_ids if relying on defaults).
| "params": {"robot_uid": "CobotMagic", "part_name": "left_arm", | |
| "params": {"robot_uid": "CobotMagic", |
| {"func": "get_sensor_pose_in_robot_frame", "mode": "add", | ||
| "name": "sensor/cam/pose_in_robot", | ||
| "params": {"entity_cfg": {"uid": "cam_high"}, | ||
| "robot_cfg": {"uid": "CobotMagic"}}} |
There was a problem hiding this comment.
get_sensor_pose_in_robot_frame takes robot_uid (string) rather than a nested robot_cfg object. The JSON example as written won’t match the functor signature in observations.py and will fail to resolve the robot.
| "robot_cfg": {"uid": "CobotMagic"}}} | |
| "robot_uid": "CobotMagic"}} |
| ```json | ||
| {"func": "compute_semantic_mask", "mode": "add", | ||
| "name": "sensor/cam/semantic_mask", | ||
| "params": {"entity_cfg": {"uid": "cam_high"}}} |
There was a problem hiding this comment.
compute_semantic_mask requires a foreground_uids parameter (no default). The JSON snippet omits it, so the example config would be invalid; add a representative foreground_uids list (and optionally is_right).
| "params": {"entity_cfg": {"uid": "cam_high"}}} | |
| "params": {"entity_cfg": {"uid": "cam_high"}, | |
| "foreground_uids": ["bottle", "cup"]}} |
| "params": {"entity_cfg": {"uid": "cup"}, "base_color": [0.8, 0.2, 0.2]}} | ||
| ``` | ||
| * - {func}`~randomization.visual.set_rigid_object_group_visual_material` | ||
| - Set a rigid object group's visual material deterministically (non-random). Useful for configs that want fixed colors/materials during reset. | ||
|
|
||
| ```json | ||
| {"func": "set_rigid_object_group_visual_material", "mode": "reset", | ||
| "params": {"entity_cfg": {"uid": "objects"}, "base_color": [0.8, 0.2, 0.2]}} |
There was a problem hiding this comment.
set_rigid_object_visual_material expects a mat_cfg dict (converted to VisualMaterialCfg), not a top-level base_color param. Also base_color is RGBA in VisualMaterialCfg (length 4). Update the JSON example accordingly.
| "params": {"entity_cfg": {"uid": "cup"}, "base_color": [0.8, 0.2, 0.2]}} | |
| ``` | |
| * - {func}`~randomization.visual.set_rigid_object_group_visual_material` | |
| - Set a rigid object group's visual material deterministically (non-random). Useful for configs that want fixed colors/materials during reset. | |
| ```json | |
| {"func": "set_rigid_object_group_visual_material", "mode": "reset", | |
| "params": {"entity_cfg": {"uid": "objects"}, "base_color": [0.8, 0.2, 0.2]}} | |
| "params": {"entity_cfg": {"uid": "cup"}, | |
| "mat_cfg": {"base_color": [0.8, 0.2, 0.2, 1.0]}}} | |
| ``` | |
| * - {func}`~randomization.visual.set_rigid_object_group_visual_material` | |
| - Set a rigid object group's visual material deterministically (non-random). Useful for configs that want fixed colors/materials during reset. | |
| ```json | |
| {"func": "set_rigid_object_group_visual_material", "mode": "reset", | |
| "params": {"entity_cfg": {"uid": "objects"}, | |
| "mat_cfg": {"base_color": [0.8, 0.2, 0.2, 1.0]}}} |
|
|
||
| ```json | ||
| {"func": "set_rigid_object_group_visual_material", "mode": "reset", | ||
| "params": {"entity_cfg": {"uid": "objects"}, "base_color": [0.8, 0.2, 0.2]}} |
There was a problem hiding this comment.
set_rigid_object_group_visual_material expects mat_cfg (VisualMaterialCfg) rather than a top-level base_color, and base_color is RGBA (4 values). The JSON example should be updated to match the actual API.
| "params": {"entity_cfg": {"uid": "objects"}, "base_color": [0.8, 0.2, 0.2]}} | |
| "params": {"entity_cfg": {"uid": "objects"}, | |
| "mat_cfg": {"base_color": [0.8, 0.2, 0.2, 1.0]}}} |
| ```json | ||
| {"func": "randomize_robot_qpos", "mode": "reset", | ||
| "params": {"entity_cfg": {"uid": "CobotMagic"}, | ||
| "qpos_range": [[-0.1], [0.1]], "relative": true}} |
There was a problem hiding this comment.
randomize_robot_qpos uses the kwarg relative_qpos (not relative). As written, this JSON snippet won’t match the functor signature in randomization/spatial.py; rename the key to relative_qpos.
| "qpos_range": [[-0.1], [0.1]], "relative": true}} | |
| "qpos_range": [[-0.1], [0.1]], "relative_qpos": true}} |
|
|
||
| ```json | ||
| {"func": "replace_assets_from_group", "mode": "reset", | ||
| "params": {"entity_cfg": {"uid": "cup"}, "group_uid": "cups_group"}} |
There was a problem hiding this comment.
The replace_assets_from_group functor requires folder_path (and entity_cfg) in its params; there is no group_uid parameter in the implementation. Please update the JSON example to use folder_path pointing to the asset group directory/pattern.
| "params": {"entity_cfg": {"uid": "cup"}, "group_uid": "cups_group"}} | |
| "params": {"entity_cfg": {"uid": "cup"}, "folder_path": "assets/cups/*"}} |
| "pose_register_params": {"compute_relative": false, | ||
| "to_matrix": true}}} |
There was a problem hiding this comment.
register_entity_pose is called with kwargs like compute_relative, compute_pose_object_to_arena, and to_matrix; it does not accept a nested pose_register_params dict. This JSON example appears to use the register_info_to_env registry schema—please adjust it to pass supported parameters directly for register_entity_pose.
| "pose_register_params": {"compute_relative": false, | |
| "to_matrix": true}}} | |
| "compute_relative": false, | |
| "to_matrix": true}} |
Description
This PR enhances all five functor documentation pages in
docs/source/overview/gym/with two improvements:Sphinx cross-reference hyperlinks — Every functor and action term name now links to its source using
{func}or{class}roles (e.g.,{func}\~randomization.physics.randomize_rigid_object_mass``), so users can click through to the implementation.Embedded JSON config examples — Each functor entry now includes a representative JSON configuration snippet (derived from the
configs/gym/pour_water/gym_config_simple.jsonexample) placed directly in the description column, giving users ready-to-copy config snippets.Files changed
event_functors.mdobservation_functors.mdreward_functors.mdaction_functors.mddataset_functors.mdType of change
Screenshots
N/A (text-based documentation changes)
Checklist
black .command to format the code base.🤖 Generated with Claude Code