Skip to content

Commit 1f96128

Browse files
docs(act-obs-flow): added action and observation flow documentation
1 parent a6cfd05 commit 1f96128

3 files changed

Lines changed: 132 additions & 0 deletions

File tree

Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# Action-Observation Flow
2+
3+
## wrapper Hierarchy
4+
5+
6+
Vertical Order:
7+
8+
- Top: Highest-level wrapper (first applied)
9+
10+
- Bottom: Base environment
11+
12+
Inheritance Notation:
13+
14+
- Use (ParentClass) next to wrapper names
15+
16+
Wrapping Notation
17+
18+
- Show ← wraps arrows between layers
19+
<p align="center">
20+
<img src="images/class_hierarchy.png" width="150"/>
21+
</p>
22+
23+
## Flow
24+
1. **`RelativeActionSpace(ActionWrapper).step(act)`**
25+
26+
- 2- Calls step function of ActionWrapper (→2)
27+
28+
2. **`ActionWrapper.step(act)`**
29+
- 3. Calls `RelativeActionSpace.action(act)`
30+
- 4. Calls `GripperWrapper.step(act)`
31+
32+
3. **`RelativeActionSpace.action(act)`**
33+
- Processes action: `{"tquart": [0.01, 0, 0, 0, 0, 0, 1], "gripper": 0}`
34+
- Operations:
35+
- Clips action within min/max limits
36+
- Makes action relative (current_pose + action)
37+
- Updates `action["tquart"]`
38+
39+
4. **`GripperWrapper(ActObsInfoWrapper).step(act)`**
40+
- →5. Calls `GripperWrapper.action(act)`
41+
- →6. Calls `CameraSetWrapper.step(act)`
42+
- →15. Calls `GripperWrapper.observation(obs)`
43+
44+
5. **`GripperWrapper.action(act)`**
45+
- Uses `act["gripper"]` to open/close gripper
46+
- Only executes if state change needed
47+
- Deletes `"gripper"` key from action dict
48+
49+
6. **`CameraSetWrapper(ActObsInfoWrapper).step(act)`**
50+
- →7. Calls `CameraSetWrapper.action(act)`
51+
- →8. Calls `CameraSetWrapper(ActObsInfoWrapper).step(act)`
52+
- →14. Calls `CameraSetWrapper.observation(obs)`
53+
54+
7. **`CameraSetWrapper.action(act)`**
55+
- (Pass-through) Returns original action
56+
57+
8. **`CameraSetWrapper(ActObsInfoWrapper).step(act)`**
58+
- →9. Calls `CameraSetWrapper.action(act)`
59+
- →10. Calls `FR3Sim.step(act)`
60+
61+
9. **`CameraSetWrapper.action(act)`**
62+
- (Pass-through) Returns original action
63+
64+
10. **`FR3Sim.step(act)`**
65+
- →11. Calls `FR3Env.step(act)`
66+
- 13. Executes:
67+
```python
68+
self.sim.step_until_convergence()
69+
state = self.sim_robot.get_state()
70+
```
71+
- Returns observation
72+
73+
11. **`FR3Env.step(act)`**
74+
- Sets new pose:
75+
```python
76+
self.robot.set_cartesian_position(
77+
common.Pose(
78+
translation=action_dict[self.tquart_key][:3],
79+
quaternion=action_dict[self.tquart_key][3:]
80+
)
81+
)
82+
```
83+
-12. Calls `FR3Env.get_obs()`
84+
85+
12. **`FR3Env.get_obs()`**
86+
- Returns:
87+
```python
88+
(
89+
tquart=np.concatenate([
90+
self.robot.get_cartesian_position().translation(),
91+
self.robot.get_cartesian_position().rotation_q()
92+
]),
93+
joints=self.robot.get_joint_position(),
94+
xyzrpy=self.robot.get_cartesian_position().xyzrpy()
95+
)
96+
```
97+
- Shapes:
98+
- `joints`: (7,)
99+
- `tquart`: (7,) [x,y,z, qx,qy,qz,qw]
100+
- `xyzrpy`: (6,) [x,y,z, roll,pitch,yaw]
101+
102+
14. **`CameraSetWrapper.observation(obs)`**
103+
- Adds camera data:
104+
```python
105+
{
106+
...original_obs...,
107+
"frames": {
108+
"wrist": {
109+
"rgb": (256,256,3),
110+
"depth": (256,256,3)
111+
},
112+
"default_free": {
113+
"wrist": {
114+
"rgb": (256,256,3),
115+
"depth": (256,256,3)
116+
}
117+
}
118+
}
119+
}
120+
```
121+
122+
15. **`GripperWrapper.observation(obs)`**
123+
- Adds gripper state:
124+
```python
125+
{
126+
...previous_data...,
127+
"gripper": float
128+
}
129+
```
130+
# Sequence Diagram
131+
![image](images/sequence_diagram.png)
132+
44.1 KB
Loading
62.1 KB
Loading

0 commit comments

Comments
 (0)