controller_view
ControllerView
A registry that maps group keys to batched controller instances.
Controllers with the same (robot kinematic tree pattern, body_part, controller_config) key are grouped into a single controller instance. Each member is assigned a controller_idx that indexes into the group's batched state.
Torch boundary: Callers interact with this view using torch tensors (and plain Python
scalars / lists where controllers already accept them). Batched controllers internally use
compute-backend arrays (cb). The view translates on the way in (e.g. torch.Tensor
→ cb for :meth:update_goal) and on the way out (e.g. cb → torch.Tensor for
:meth:get_control, :meth:get_goal, :meth:get_dof_idx, gains, and command limits) so that
no cb array is returned from or required by the public view API. If a compute-backend
array is passed in, it is normalized through torch and re-imported into cb before reaching
the controller—prefer passing torch.Tensor from new code.
Usage
At controller load time:
group_key, controller_idx = ControllerView.register( body_part, controller_cfg, articulation_root_path, link_name )
At action time:
ControllerView.update_goal(group_key, controller_idx, command)
At sim step time (called once for all groups):
ControllerView.step_all()
Source code in OmniGibson/omnigibson/controllers/controller_view.py
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | |
clear()
classmethod
Remove all registered controller groups. Call this inside simulator._partial_clear().
compute_no_op_action(group_key, controller_idx)
classmethod
Compute the no-op action command for the controller at @controller_idx in group @group_key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group_key
|
str
|
key identifying the controller group |
required |
controller_idx
|
int
|
index of the controller within the group |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
no-op command for this controller |
Source code in OmniGibson/omnigibson/controllers/controller_view.py
get_controller_type_str(group_key)
classmethod
Python class name of the batched controller (e.g. JointController), for UI / diagnostics.
Source code in OmniGibson/omnigibson/controllers/controller_view.py
register(body_part, controller_cfg, articulation_root_path, link_name=None, control_enabled=True)
classmethod
Register a controller into the appropriate group.
If no group exists for the given key, one is created. A new member is then added to that group's controller via add_member().
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
body_part
|
str
|
name of the body part being controlled (e.g., "arm_right", "base") |
required |
controller_cfg
|
dict
|
controller configuration dict (must include "name" key) |
required |
articulation_root_path
|
str
|
articulation root prim path of the new group member |
required |
link_name
|
None or str
|
if specified, the name of the EEF or trunk link (for IK/OSC controllers) |
None
|
control_enabled
|
bool
|
if set to False, the controller is disabled. Default is true. |
True
|
Returns:
| Type | Description |
|---|---|
2 - tuple
|
|
Source code in OmniGibson/omnigibson/controllers/controller_view.py
reset(group_key, controller_idx)
classmethod
Reset the goal state for the controller at @controller_idx in the group @group_key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group_key
|
str
|
key identifying the controller group |
required |
controller_idx
|
int
|
index of the controller within the group |
required |
Source code in OmniGibson/omnigibson/controllers/controller_view.py
reverse_preprocess_command(group_key, command)
classmethod
Undo command scaling (same as :meth:BaseController._reverse_preprocess_command).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
command
|
torch tensor or array-like in scaled command space |
required |
Returns:
| Type | Description |
|---|---|
Tensor
|
command in normalized input space (for stacking into a flat action vector) |
Source code in OmniGibson/omnigibson/controllers/controller_view.py
step_all()
classmethod
Run a batched controller step for all registered controller groups.
unregister_robot(controllers)
classmethod
Unregister one robot from controller groups without reindexing members.
For each (group_key, controller_idx) in @controllers: - Locate the shared controller group. - Mark controller_idx as a tombstoned (unregistered) slot. - Keep the group if any active members remain; delete it only when all members are tombstoned.
Controller logic must mask tombstoned slots during goal updates, batched compute, and writeback.
Tombstoned slots will be reused for new controller members.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
controllers
|
dict
|
The robot.controllers dict, mapping controller_name -> (group_key, controller_idx) |
required |
Source code in OmniGibson/omnigibson/controllers/controller_view.py
update_goal(group_key, controller_idx, command)
classmethod
Update the goal for the controller at @controller_idx in the group identified by @group_key.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
group_key
|
str
|
key identifying the controller group |
required |
controller_idx
|
int
|
index of the controller within the group |
required |
command
|
Tensor or array - like
|
action command for this controller (see class docstring) |
required |