deprecated_utils
A set of utility functions slated to be deprecated once Omniverse bugs are fixed
ArticulationView
Bases: ArticulationView
ArticulationView with some additional functionality implemented.
Source code in omnigibson/utils/deprecated_utils.py
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 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 |
|
get_joint_limits(indices=None, joint_indices=None, clone=True)
Gets joint limits for articulation in the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices |
Optional[Union[ndarray, List, Tensor, array]]
|
indicies to specify which prims to query. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices |
Optional[Union[ndarray, List, Tensor, array]]
|
joint indicies to specify which joints to query. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
clone |
Optional[bool]
|
True to return a clone of the internal buffer. Otherwise False. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
Union[ndarray, Tensor, array]
|
Union[np.ndarray, torch.Tensor, wp.indexedarray]: joint limits for articulations in the view. shape (M, K). |
Source code in omnigibson/utils/deprecated_utils.py
get_max_velocities(indices=None, joint_indices=None, clone=True)
Gets maximum velocities for articulation in the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices |
Optional[Union[ndarray, List, Tensor, array]]
|
indicies to specify which prims to query. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices |
Optional[Union[ndarray, List, Tensor, array]]
|
joint indicies to specify which joints to query. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
clone |
Optional[bool]
|
True to return a clone of the internal buffer. Otherwise False. Defaults to True. |
True
|
Returns:
Type | Description |
---|---|
Union[ndarray, Tensor, indexedarray]
|
Union[np.ndarray, torch.Tensor, wp.indexedarray]: maximum velocities for articulations in the view. shape (M, K). |
Source code in omnigibson/utils/deprecated_utils.py
set_joint_efforts(efforts, indices=None, joint_indices=None)
Set the joint efforts of articulations in the view
.. note::
This method can be used for effort control. For this purpose, there must be no joint drive
or the stiffness and damping must be set to zero.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
efforts |
Optional[Union[ndarray, Tensor, array]]
|
efforts of articulations in the view to be set to in the next frame. shape is (M, K). |
required |
indices |
Optional[Union[ndarray, List, Tensor, array]]
|
indices to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices |
Optional[Union[ndarray, List, Tensor, array]]
|
joint indices to specify which joints to manipulate. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
.. hint::
This method belongs to the methods used to set the articulation kinematic states:
``set_velocities`` (``set_linear_velocities``, ``set_angular_velocities``),
``set_joint_positions``, ``set_joint_velocities``, ``set_joint_efforts``
Example:
.. code-block:: python
>>> # set the efforts for all the articulation joints to the indicated values.
>>> # Since there are 5 envs, the joint efforts are repeated 5 times
>>> efforts = np.tile(np.array([10, 20, 30, 40, 50, 60, 70, 80, 90]), (num_envs, 1))
>>> prims.set_joint_efforts(efforts)
>>>
>>> # set the fingers efforts: panda_finger_joint1 (7) and panda_finger_joint2 (8) to 10
>>> # for the first, middle and last of the 5 envs
>>> efforts = np.tile(np.array([10, 10]), (3, 1))
>>> prims.set_joint_efforts(efforts, indices=np.array([0, 2, 4]), joint_indices=np.array([7, 8]))
Source code in omnigibson/utils/deprecated_utils.py
set_joint_limits(values, indices=None, joint_indices=None)
Sets joint limits for articulation joints in the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
values |
Union[ndarray, Tensor, array]
|
joint limits for articulations in the view. shape (M, K, 2). |
required |
indices |
Optional[Union[ndarray, List, Tensor, array]]
|
indicies to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices |
Optional[Union[ndarray, List, Tensor, array]]
|
joint indicies to specify which joints to manipulate. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
Source code in omnigibson/utils/deprecated_utils.py
set_joint_positions(positions, indices=None, joint_indices=None)
Set the joint positions of articulations in the view
.. warning::
This method will immediately set (teleport) the affected joints to the indicated value.
Use the ``set_joint_position_targets`` or the ``apply_action`` methods to control the articulation joints.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
positions |
Optional[Union[ndarray, Tensor, array]]
|
joint positions of articulations in the view to be set to in the next frame. shape is (M, K). |
required |
indices |
Optional[Union[ndarray, List, Tensor, array]]
|
indices to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices |
Optional[Union[ndarray, List, Tensor, array]]
|
joint indices to specify which joints to manipulate. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
.. hint::
This method belongs to the methods used to set the articulation kinematic states:
``set_velocities`` (``set_linear_velocities``, ``set_angular_velocities``),
``set_joint_positions``, ``set_joint_velocities``, ``set_joint_efforts``
Example:
.. code-block:: python
>>> # set all the articulation joints.
>>> # Since there are 5 envs, the joint positions are repeated 5 times
>>> positions = np.tile(np.array([0.0, -1.0, 0.0, -2.2, 0.0, 2.4, 0.8, 0.04, 0.04]), (num_envs, 1))
>>> prims.set_joint_positions(positions)
>>>
>>> # set only the fingers in closed position: panda_finger_joint1 (7) and panda_finger_joint2 (8) to 0.0
>>> # for the first, middle and last of the 5 envs
>>> positions = np.tile(np.array([0.0, 0.0]), (3, 1))
>>> prims.set_joint_positions(positions, indices=np.array([0, 2, 4]), joint_indices=np.array([7, 8]))
Source code in omnigibson/utils/deprecated_utils.py
set_joint_velocities(velocities, indices=None, joint_indices=None)
Set the joint velocities of articulations in the view
.. warning::
This method will immediately set the affected joints to the indicated value.
Use the ``set_joint_velocity_targets`` or the ``apply_action`` methods to control the articulation joints.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
velocities |
Optional[Union[ndarray, Tensor, array]]
|
joint velocities of articulations in the view to be set to in the next frame. shape is (M, K). |
required |
indices |
Optional[Union[ndarray, List, Tensor, array]]
|
indices to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices |
Optional[Union[ndarray, List, Tensor, array]]
|
joint indices to specify which joints to manipulate. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
.. hint::
This method belongs to the methods used to set the articulation kinematic states:
``set_velocities`` (``set_linear_velocities``, ``set_angular_velocities``),
``set_joint_positions``, ``set_joint_velocities``, ``set_joint_efforts``
Example:
.. code-block:: python
>>> # set the velocities for all the articulation joints to the indicated values.
>>> # Since there are 5 envs, the joint velocities are repeated 5 times
>>> velocities = np.tile(np.array([0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9]), (num_envs, 1))
>>> prims.set_joint_velocities(velocities)
>>>
>>> # set the fingers velocities: panda_finger_joint1 (7) and panda_finger_joint2 (8) to -0.1
>>> # for the first, middle and last of the 5 envs
>>> velocities = np.tile(np.array([-0.1, -0.1]), (3, 1))
>>> prims.set_joint_velocities(velocities, indices=np.array([0, 2, 4]), joint_indices=np.array([7, 8]))
Source code in omnigibson/utils/deprecated_utils.py
set_max_velocities(values, indices=None, joint_indices=None)
Sets maximum velocities for articulation in the view.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
values |
Union[ndarray, Tensor, array]
|
maximum velocities for articulations in the view. shape (M, K). |
required |
indices |
Optional[Union[ndarray, List, Tensor, array]]
|
indicies to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
joint_indices |
Optional[Union[ndarray, List, Tensor, array]]
|
joint indicies to specify which joints to manipulate. Shape (K,). Where K <= num of dofs. Defaults to None (i.e: all dofs). |
None
|
Source code in omnigibson/utils/deprecated_utils.py
Core
Bases: Core
Subclass that overrides a specific function within Omni's Core class to fix a bug
Source code in omnigibson/utils/deprecated_utils.py
get_compute_graph(selected_paths, create_new_graph=True, created_paths=None)
Returns the first ComputeGraph found in selected_paths. If no graph is found and create_new_graph is true, a new graph will be created and its path appended to created_paths (if provided).
Source code in omnigibson/utils/deprecated_utils.py
CreateMeshPrimWithDefaultXformCommand
Bases: CreateMeshPrimWithDefaultXformCommand
Source code in omnigibson/utils/deprecated_utils.py
__init__(prim_type, **kwargs)
Creates primitive.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
prim_type |
str
|
It supports Plane/Sphere/Cone/Cylinder/Disk/Torus/Cube. |
required |
kwargs
object_origin (Gf.Vec3f): Position of mesh center in stage units.
u_patches (int): The number of patches to tessellate U direction.
v_patches (int): The number of patches to tessellate V direction.
w_patches (int): The number of patches to tessellate W direction. It only works for Cone/Cylinder/Cube.
half_scale (float): Half size of mesh in centimeters. Default is None, which means it's controlled by settings.
u_verts_scale (int): Tessellation Level of U. It's a multiplier of u_patches.
v_verts_scale (int): Tessellation Level of V. It's a multiplier of v_patches.
w_verts_scale (int): Tessellation Level of W. It's a multiplier of w_patches. It only works for Cone/Cylinder/Cube. For Cone/Cylinder, it's to tessellate the caps. For Cube, it's to tessellate along z-axis.
above_ground (bool): It will offset the center of mesh above the ground plane if it's True, False otherwise. It's False by default. This param only works when param object_origin is not given. Otherwise, it will be ignored.
stage (Usd.Stage): If specified, stage to create prim on
Source code in omnigibson/utils/deprecated_utils.py
RigidPrimView
Bases: RigidPrimView
Source code in omnigibson/utils/deprecated_utils.py
disable_gravities(indices=None)
Disable gravity on rigid bodies (enabled by default).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices |
Optional[Union[ndarray, list, Tensor, array]]
|
indicies to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
Source code in omnigibson/utils/deprecated_utils.py
enable_gravities(indices=None)
Enable gravity on rigid bodies (enabled by default).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
indices |
Optional[Union[ndarray, list, Tensor, array]]
|
indicies to specify which prims to manipulate. Shape (M,). Where M <= size of the encapsulated prims in the view. Defaults to None (i.e: all prims in the view). |
None
|
Source code in omnigibson/utils/deprecated_utils.py
colorize_bboxes(bboxes_2d_data, bboxes_2d_rgb, num_channels=3)
Colorizes 2D bounding box data for visualization.
We are overriding the replicator native version of this function to fix a bug. In their version of this function, the ordering of the rectangle corners is incorrect and we fix it here.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
bboxes_2d_data |
ndarray
|
2D bounding box data from the sensor. |
required |
bboxes_2d_rgb |
ndarray
|
RGB data from the sensor to embed bounding box. |
required |
num_channels |
int
|
Specify number of channels i.e. 3 or 4. |
3
|