curobo
CuRoboMotionGenerator
Class for motion generator using CuRobo backend
Source code in omnigibson/action_primitives/curobo.py
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 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 |
|
tensor_args
property
Returns:
Type | Description |
---|---|
TensorDeviceType
|
tensor arguments used by this CuRobo instance |
__init__(robot, robot_cfg_path=None, robot_usd_path=None, ee_link=None, device='cuda:0', motion_cfg_kwargs=None, batch_size=2, debug=False)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
robot
|
BaseRobot
|
Robot for which to generate motion plans |
required |
robot_cfg_path
|
None or str
|
If specified, the path to the robot configuration to use. If None, will try to use a pre-configured one directly from curobo based on the robot class of @robot |
None
|
robot_usd_path
|
None or str
|
If specified, the path to the robot USD file to use. If None, will try to use a pre-configured one directly from curobo based on the robot class of @robot |
None
|
ee_link
|
None or str
|
If specified, the link name representing the end-effector to track. None defaults to value already set in the config from @robot_cfg |
None
|
device
|
str
|
Which device to use for curobo |
'cuda:0'
|
motion_cfg_kwargs
|
None or dict
|
If specified, keyward arguments to pass to MotionGenConfig.load_from_robot_config(...) |
None
|
batch_size
|
int
|
Size of batches for computing trajectories. This must be FIXED |
2
|
debug
|
bool
|
Whether to debug generation or not |
False
|
Source code in omnigibson/action_primitives/curobo.py
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 |
|
check_collisions(q, activation_distance=0.01, weight=50000.0)
Checks collisions between the sphere representation of the robot and the rest of the current scene
Parameters:
Name | Type | Description | Default |
---|---|---|---|
q
|
tensor
|
(N, D)-shaped tensor, representing N-total different joint configurations to check collisions against the world |
required |
activation_distance
|
float
|
Safety buffer around robot mesh representation which will trigger a collision check |
0.01
|
weight
|
float
|
Loss weighting to apply during collision check optimization |
50000.0
|
Returns:
Type | Description |
---|---|
tensor
|
(N,)-shaped tensor, where each value is True if in collision, else False |
Source code in omnigibson/action_primitives/curobo.py
compute_trajectories(target_pos, target_quat, is_local=False, max_attempts=5, timeout=2.0, enable_graph_attempt=3, ik_fail_return=5, enable_finetune_trajopt=True, finetune_attempts=1, return_full_result=False, success_ratio=None, attached_obj=None)
Computes the robot joint trajectory to reach the desired @target_pos and @target_quat
Parameters:
Name | Type | Description | Default |
---|---|---|---|
target_pos
|
N,3)-tensor
|
(N, 3)-shaped tensor, where each entry is an individual (x,y,z) position to reach. A single (3,) array can also be given |
required |
target_quat
|
N,4)-tensor
|
(N, 4) or (4,)-shaped tensor, where each entry is an individual (x,y,z,w) quaternion orientation to reach. A single (4,) array can also be given |
required |
is_local
|
bool
|
Whether @target_pos and @target_quat are specified in the robot's local frame or the world global frame |
False
|
max_attempts
|
int
|
Maximum number of attempts for trying to compute a valid trajectory |
5
|
timeout
|
float
|
Maximum time in seconds allowed to solve the motion generation problem |
2.0
|
enable_graph_attempt
|
None or int
|
Number of failed attempts at which to fallback to a graph planner for obtaining trajectory seeds |
3
|
ik_fail_return
|
None or int
|
Number of IK attempts allowed before returning a failure. Set this to a low value (5) to save compute time when an unreachable goal is given |
5
|
enable_finetune_trajopt
|
bool
|
Whether to enable timing reparameterization for a smoother trajectory |
True
|
finetune_attempts
|
int
|
Number of attempts to run finetuning trajectory optimization. Every attempt will
increase the |
1
|
return_full_result
|
bool
|
Whether to return a list of raw MotionGenResult object(s) or a 2-tuple of (success, results); the default is the latter |
False
|
success_ratio
|
None or float
|
If set, specifies the fraction of successes necessary given self.batch_size. If None, will automatically be the smallest ratio (1 / self.batch_size), i.e: any nonzero number of successes |
None
|
attached_obj
|
None or BaseObject
|
If specified, the object to attach to the robot end-effector when solving for this trajectory |
None
|
Returns:
Type | Description |
---|---|
2-tuple or list of MotionGenResult
|
If @return_full_result is True, will return a list of raw MotionGenResult object(s) computed from internal batch trajectory computations. If it is False, will return 2-tuple (success, results), where success is a (N,)-shaped boolean tensor representing whether each requested target pos / quat successfully generated a motion plan, and results is a (N,)-shaped array of corresponding JointState objects. |
Source code in omnigibson/action_primitives/curobo.py
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 |
|
convert_q_to_eef_traj(traj, return_axisangle=False)
Converts a joint trajectory @traj into an equivalent trajectory defined by end effector poses
Parameters:
Name | Type | Description | Default |
---|---|---|---|
traj
|
Tensor
|
(T, D)-shaped joint trajectory |
required |
return_axisangle
|
bool
|
Whether to return the interpolated orientations in quaternion or axis-angle representation |
False
|
Returns:
Type | Description |
---|---|
Tensor
|
(T, [6, 7])-shaped array where each entry is is the (x,y,z) position and (x,y,z,w) quaternion (if @return_axisangle is False) or (ax, ay, az) axis-angle orientation, specified in the robot frame. |
Source code in omnigibson/action_primitives/curobo.py
path_to_joint_trajectory(path, joint_names=None)
Converts raw path from motion generator into joint trajectory sequence
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
JointState
|
Joint state path to convert into joint trajectory |
required |
joint_names
|
None or list
|
If specified, the individual joints to use when constructing the joint trajectory. If None, will use all joints. |
None
|
Returns:
Type | Description |
---|---|
tensor
|
(T, D) tensor representing the interpolated joint trajectory to reach the desired @target_pos, @target_quat configuration, where T is the number of interpolated steps and D is the number of robot joints. |
Source code in omnigibson/action_primitives/curobo.py
update_obstacles(ignore_paths=None)
Updates internal world collision cache representation based on sim state
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ignore_paths
|
None or list of str
|
If specified, prim path substrings that should be ignored when updating obstacles |
None
|
Source code in omnigibson/action_primitives/curobo.py
create_collision_world(tensor_args, cache_size=1024, max_distance=0.1)
Creates a CuRobo CollisionMeshWorld to use for collision checking
Parameters:
Name | Type | Description | Default |
---|---|---|---|
tensor_args
|
TensorDeviceType
|
Tensor device information |
required |
cache_size
|
int
|
Cache size for number of meshes supported in the collision world |
1024
|
max_distance
|
float
|
maximum distance when checking collisions (see curobo source code) |
0.1
|
Returns:
Type | Description |
---|---|
MeshCollisionWorld
|
collision world used to check against for collisions |
Source code in omnigibson/action_primitives/curobo.py
get_obstacles(reference_prim_path=None, only_paths=None, ignore_paths=None, only_substring=None, ignore_substring=None)
Grabs world collision representation
Parameters:
Name | Type | Description | Default |
---|---|---|---|
reference_prim_path
|
None or str
|
If specified, the prim path defining the collision world frame |
None
|
only_paths
|
None or list of str
|
If specified, only include these sets of prim paths in the resulting collision representation |
None
|
ignore_paths
|
None or list of str
|
If specified, exclude these sets of prim paths from the resulting collision representation |
None
|
only_substring
|
None or list of str
|
If specified, only include any prim path that includes any of these substrings in the resulting collision representation |
None
|
ignore_substring
|
None or list of str
|
If specified, exclude any prim path that includes any of these substrings from the resulting collision representation |
None
|
Source code in omnigibson/action_primitives/curobo.py
get_obstacles_sphere_representation(obstacles, tensor_args, n_spheres=20, sphere_radius=0.001)
Gest the collision sphere representation of obstacles @obstacles Args: obstacles (list of Obstacle): Obstacles whose aggregate sphere representation will be computed tensor_args (TensorDeviceType): Tensor device information n_spheres (int or list of int): Either per-obstacle or default number of collision spheres for representing each obstacle sphere_radius (float or list of float): Either per-obstacle or default radius of collision spheres for representing each obstacle
Returns:
Type | Description |
---|---|
Tensor
|
(N, 4)-shaped tensor, where each of the N computed collision spheres are defined by (x,y,z,r), where (x,y,z) is the global position and r defines the sphere radius |