Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 8 additions & 13 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ Every source file begins with the Apache 2.0 copyright header:
- Use full type hints on all public APIs.
- Use `from __future__ import annotations` at the top of every file.
- Use `TYPE_CHECKING` guards for circular-import-safe imports.
- Prefer `Union[A, B]` or `A | B` (Python 3.10+ union syntax is acceptable).
- Prefer `A | B` over `Union[A, B]`.

### Configuration Pattern (`@configclass`)

Expand Down Expand Up @@ -265,7 +265,7 @@ def test_edge_case():
assert result is not None
```

**`unittest.TestCase` style** — when tests must run in a specific order or share `setUp`/`tearDown` state:
**`Class` style** — when tests must run in a specific order or share `setup_method`/`teardown_method` state:

```python
# ----------------------------------------------------------------------------
Expand All @@ -274,28 +274,23 @@ def test_edge_case():
# ...
# ----------------------------------------------------------------------------

import unittest
from embodichain.my_module import MyClass


class TestMyClass(unittest.TestCase):
def setUp(self):
class TestMyClass():
def setup_method(self):
self.obj = MyClass(param=1.0)

def tearDown(self):
def teardown_method(self):
pass

def test_basic_behavior(self):
result = self.obj.run()
self.assertEqual(result, expected)
assert result == expected_result

def test_raises_on_bad_input(self):
self.assertRaises(ValueError, self.obj.run, bad_input)


if __name__ == "__main__":
unittest.main()
```
with pytest.raises(ValueError):
self.obj.run(bad_input)

### Conventions

Expand Down
2 changes: 1 addition & 1 deletion configs/agents/rl/basic/cart_pole/gym_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": "CartPoleRL",
"max_episodes": 5,
"max_episode_steps": 500,
"env": {
"events": {},
"observations": {
Expand All @@ -26,7 +27,6 @@
},
"extensions": {
"action_type": "delta_qpos",
"episode_length": 500,
"action_scale": 0.1,
"success_threshold": 0.1
}
Expand Down
2 changes: 1 addition & 1 deletion configs/agents/rl/push_cube/gym_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": "PushCubeRL",
"max_episodes": 5,
"max_episode_steps": 100,
"env": {
"events": {
"randomize_cube": {
Expand Down Expand Up @@ -112,7 +113,6 @@
},
"extensions": {
"action_type": "delta_qpos",
"episode_length": 100,
"action_scale": 0.1,
"success_threshold": 0.1
}
Expand Down
4 changes: 2 additions & 2 deletions configs/gym/agent/pour_water_agent/fast_gym_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -251,15 +251,15 @@
"mode": "save",
"params": {
"robot_meta": {
"control_freq": 25,
"control_parts": ["left_arm", "left_eef", "right_arm", "right_eef"]
"control_freq": 25
},
"instruction": {
"lang": "Pour water from the bottle into the mug."
}
}
}
},
"control_parts": ["left_arm", "left_eef", "right_arm", "right_eef"],
"success_params": {
"strict": false
}
Expand Down
4 changes: 2 additions & 2 deletions configs/gym/agent/rearrangement_agent/fast_gym_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -236,15 +236,15 @@
"mode": "save",
"params": {
"robot_meta": {
"control_freq": 25,
"control_parts": ["left_arm", "left_eef", "right_arm", "right_eef"]
"control_freq": 25
},
"instruction": {
"lang": "Place the spoon and fork neatly into the plate on the table."
}
}
}
},
"control_parts": ["left_arm", "left_eef", "right_arm", "right_eef"],
"success_params": {
"strict": false
}
Expand Down
2 changes: 1 addition & 1 deletion configs/gym/blocks_ranking_rgb/cobot_magic_3cam.json
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
"mode": "modify",
"name": "robot/qpos",
"params": {
"joint_ids": [12, 13, 14, 15]
"joint_ids": [6, 13]
}
},
"block_1_pose": {
Expand Down
2 changes: 1 addition & 1 deletion configs/gym/blocks_ranking_size/cobot_magic_3cam.json
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
"mode": "modify",
"name": "robot/qpos",
"params": {
"joint_ids": [12, 13, 14, 15]
"joint_ids": [6, 13]
}
},
"block_1_pose": {
Expand Down
2 changes: 1 addition & 1 deletion configs/gym/match_object_container/cobot_magic_3cam.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"mode": "modify",
"name": "robot/qpos",
"params": {
"joint_ids": [12, 13, 14, 15]
"joint_ids": [6, 13]
}
},
"block_cube_1_pose": {
Expand Down
9 changes: 5 additions & 4 deletions configs/gym/pour_water/gym_config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": "PourWater-v3",
"max_episodes": 10,
"max_episode_steps": 300,
"env": {
"events": {
"random_light": {
Expand Down Expand Up @@ -200,7 +201,7 @@
"mode": "modify",
"name": "robot/qpos",
"params": {
"joint_ids": [12, 13, 14, 15]
"joint_ids": [6, 13]
}
},
"bottle_pose": {
Expand Down Expand Up @@ -264,8 +265,7 @@
"params": {
"robot_meta": {
"robot_type": "CobotMagic",
"control_freq": 25,
"control_parts": ["left_arm", "left_eef", "right_arm", "right_eef"]
"control_freq": 25
},
"instruction": {
"lang": "Pour water from bottle to cup"
Expand All @@ -278,7 +278,8 @@
"use_videos": true
}
}
}
},
"control_parts": ["left_arm", "left_eef", "right_arm", "right_eef"]
},
"robot": {
"uid": "CobotMagic",
Expand Down
4 changes: 2 additions & 2 deletions configs/gym/pour_water/gym_config_simple.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"id": "PourWater-v3",
"max_episodes": 5,
"max_episode_steps": 300,
"env": {
"events": {
"record_camera": {
Expand Down Expand Up @@ -213,8 +214,7 @@
"params": {
"robot_meta": {
"robot_type": "CobotMagic",
"control_freq": 25,
"control_parts": ["left_arm", "left_eef", "right_arm", "right_eef"]
"control_freq": 25
},
"instruction": {
"lang": "Pour water from bottle to cup"
Expand Down
2 changes: 1 addition & 1 deletion configs/gym/stack_blocks_two/cobot_magic_3cam.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"mode": "modify",
"name": "robot/qpos",
"params": {
"joint_ids": [12, 13, 14, 15]
"joint_ids": [6, 13]
}
},
"block_1_pose": {
Expand Down
2 changes: 1 addition & 1 deletion configs/gym/stack_cups/cobot_magic_3cam.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"mode": "modify",
"name": "robot/qpos",
"params": {
"joint_ids": [12, 13, 14, 15]
"joint_ids": [6, 13]
}
},
"cup_1_pose": {
Expand Down
44 changes: 43 additions & 1 deletion docs/source/api_reference/embodichain/embodichain.agents.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,48 @@

.. autosummary::

dexforce_vla
datasets
engine
rl

Datasets
--------

.. automodule:: embodichain.agents.datasets
:members:
:undoc-members:
:show-inheritance:

.. autosummary::

online_data
sampler

Online Data Engine
------------------

.. automodule:: embodichain.agents.engine
:members:
:undoc-members:
:show-inheritance:

.. autosummary::

data

Reinforcement Learning
----------------------

.. automodule:: embodichain.agents.rl
:members:
:undoc-members:
:show-inheritance:

.. autosummary::

algo
buffer
models
train
utils

Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,20 @@ Registration System

:param name: Unique identifier for the environment
:param cls: Environment class (must inherit from BaseEnv or BaseEnv)
:param max_episode_steps: Maximum steps per episode (optional)
:param default_kwargs: Default keyword arguments for environment creation

.. autofunction:: register_env

Decorator function for registering environment classes. This is the recommended way to register environments.

:param uid: Unique identifier for the environment
:param max_episode_steps: Maximum steps per episode (optional)
:param override: Whether to override existing environment with same ID
:param kwargs: Additional registration parameters

Example:
.. code-block:: python

@register_env("MyEnv-v1", max_episode_steps=1000)
@register_env("MyEnv-v1")
class MyCustomEnv(BaseEnv):
def __init__(self, **kwargs):
super().__init__(**kwargs)
Expand Down
1 change: 1 addition & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ Table of Contents

overview/sim/index
overview/gym/index
overview/agents/online_data.md
overview/rl/index

.. toctree::
Expand Down
Loading