curobo.wrap.reacher.ik_solver module

class curobo.wrap.reacher.ik_solver.IKSolverConfig(robot_config: curobo.types.robot.RobotConfig, solver: curobo.wrap.wrap_base.WrapBase, num_seeds: int, position_threshold: float, rotation_threshold: float, rollout_fn: curobo.rollout.arm_reacher.ArmReacher, ik_nn_seeder: str | None = None, world_coll_checker: curobo.geom.sdf.world.WorldCollision | None = None, sample_rejection_ratio: int = 50, tensor_args: curobo.types.base.TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32), use_cuda_graph: bool = True)

Bases: object

Parameters:
  • robot_config (RobotConfig) –

  • solver (WrapBase) –

  • num_seeds (int) –

  • position_threshold (float) –

  • rotation_threshold (float) –

  • rollout_fn (ArmReacher) –

  • ik_nn_seeder (str | None) –

  • world_coll_checker (WorldCollision | None) –

  • sample_rejection_ratio (int) –

  • tensor_args (TensorDeviceType) –

  • use_cuda_graph (bool) –

robot_config: RobotConfig
solver: WrapBase
num_seeds: int
position_threshold: float
rotation_threshold: float
rollout_fn: ArmReacher
ik_nn_seeder: str | None = None
world_coll_checker: WorldCollision | None = None
sample_rejection_ratio: int = 50
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32)
use_cuda_graph: bool = True
static load_from_robot_config(robot_cfg, world_model=None, tensor_args=TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32), num_seeds=100, position_threshold=0.005, rotation_threshold=0.05, world_coll_checker=None, base_cfg_file='base_cfg.yml', particle_file='particle_ik.yml', gradient_file='gradient_ik.yml', use_cuda_graph=True, self_collision_check=True, self_collision_opt=True, grad_iters=None, use_particle_opt=True, collision_checker_type=CollisionCheckerType.MESH, sync_cuda_time=None, use_gradient_descent=False, collision_cache=None, n_collision_envs=None, ee_link_name=None, use_es=None, es_learning_rate=0.1, use_fixed_samples=None, store_debug=False, regularization=True, collision_activation_distance=None, high_precision=False, project_pose_to_goal_frame=True)
Parameters:
  • robot_cfg (str | Dict | RobotConfig) –

  • world_model (List[Dict] | List[WorldConfig] | Dict | WorldConfig | None) –

  • tensor_args (TensorDeviceType) –

  • num_seeds (int) –

  • position_threshold (float) –

  • rotation_threshold (float) –

  • base_cfg_file (str) –

  • particle_file (str) –

  • gradient_file (str) –

  • use_cuda_graph (bool) –

  • self_collision_check (bool) –

  • self_collision_opt (bool) –

  • grad_iters (int | None) –

  • use_particle_opt (bool) –

  • collision_checker_type (CollisionCheckerType | None) –

  • sync_cuda_time (bool | None) –

  • use_gradient_descent (bool) –

  • collision_cache (Dict[str, int] | None) –

  • n_collision_envs (int | None) –

  • ee_link_name (str | None) –

  • use_es (bool | None) –

  • es_learning_rate (float | None) –

  • use_fixed_samples (bool | None) –

  • store_debug (bool) –

  • regularization (bool) –

  • collision_activation_distance (float | None) –

  • high_precision (bool) –

  • project_pose_to_goal_frame (bool) –

class curobo.wrap.reacher.ik_solver.IKResult(js_solution: curobo.types.state.JointState, goal_pose: curobo.types.math.Pose, solution: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'dof', torch.float32), 'cls_name': 'TensorType'}], seed: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'dof', torch.float32), 'cls_name': 'TensorType'}], success: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'value', torch.bool), 'cls_name': 'TensorType'}], position_error: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'value', torch.float32), 'cls_name': 'TensorType'}], rotation_error: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'value', torch.float32), 'cls_name': 'TensorType'}], error: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'value', torch.float32), 'cls_name': 'TensorType'}], solve_time: float, debug_info: Any | None = None, goalset_index: torch.Tensor | None = None)

Bases: Sequence

Parameters:
  • js_solution (JointState) –

  • goal_pose (Pose) –

  • solution (Tensor) –

  • seed (Tensor) –

  • success (Tensor) –

  • position_error (Tensor) –

  • rotation_error (Tensor) –

  • error (Tensor) –

  • solve_time (float) –

  • debug_info (Any | None) –

  • goalset_index (Tensor | None) –

js_solution: JointState
goal_pose: Pose
solution: Tensor
seed: Tensor
success: Tensor
position_error: Tensor
rotation_error: Tensor

rotation error is computed as sqrt(q_des^T * q)

error: Tensor
solve_time: float
debug_info: Any | None = None
goalset_index: Tensor | None = None
get_unique_solution(roundoff_decimals=2)
Parameters:

roundoff_decimals (int) –

Return type:

Tensor

get_batch_unique_solution(roundoff_decimals=2)
Parameters:

roundoff_decimals (int) –

Return type:

List[Tensor]

_abc_impl = <_abc._abc_data object>
class curobo.wrap.reacher.ik_solver.IKSolver(config)

Bases: IKSolverConfig

Parameters:

config (IKSolverConfig) –

update_goal_buffer(solve_state, goal_pose, retract_config=None, link_poses=None)
Parameters:
  • solve_state (ReacherSolveState) –

  • goal_pose (Pose) –

  • retract_config (Tensor | None) –

  • link_poses (Dict[str, Pose] | None) –

Return type:

Goal

solve_any(solve_type, goal_pose, retract_config=None, seed_config=None, return_seeds=1, num_seeds=None, use_nn_seed=True, newton_iters=None, link_poses=None)
Parameters:
  • solve_type (ReacherSolveType) –

  • goal_pose (Pose) –

  • retract_config (Tensor | None) –

  • seed_config (Tensor | None) –

  • return_seeds (int) –

  • num_seeds (int | None) –

  • use_nn_seed (bool) –

  • newton_iters (int | None) –

  • link_poses (Dict[str, Pose] | None) –

Return type:

IKResult

solve_single(goal_pose, retract_config=None, seed_config=None, return_seeds=1, num_seeds=None, use_nn_seed=True, newton_iters=None, link_poses=None)
Parameters:
  • goal_pose (Pose) –

  • retract_config (Tensor | None) –

  • seed_config (Tensor | None) –

  • return_seeds (int) –

  • num_seeds (int | None) –

  • use_nn_seed (bool) –

  • newton_iters (int | None) –

  • link_poses (Dict[str, Pose] | None) –

Return type:

IKResult

solve_goalset(goal_pose, retract_config=None, seed_config=None, return_seeds=1, num_seeds=None, use_nn_seed=True, newton_iters=None, link_poses=None)
Parameters:
  • goal_pose (Pose) –

  • retract_config (Tensor | None) –

  • seed_config (Tensor | None) –

  • return_seeds (int) –

  • num_seeds (int | None) –

  • use_nn_seed (bool) –

  • newton_iters (int | None) –

  • link_poses (Dict[str, Pose] | None) –

Return type:

IKResult

solve_batch(goal_pose, retract_config=None, seed_config=None, return_seeds=1, num_seeds=None, use_nn_seed=True, newton_iters=None, link_poses=None)
Parameters:
  • goal_pose (Pose) –

  • retract_config (Tensor | None) –

  • seed_config (Tensor | None) –

  • return_seeds (int) –

  • num_seeds (int | None) –

  • use_nn_seed (bool) –

  • newton_iters (int | None) –

  • link_poses (Dict[str, Pose] | None) –

Return type:

IKResult

solve_batch_goalset(goal_pose, retract_config=None, seed_config=None, return_seeds=1, num_seeds=None, use_nn_seed=True, newton_iters=None, link_poses=None)
Parameters:
  • goal_pose (Pose) –

  • retract_config (Tensor | None) –

  • seed_config (Tensor | None) –

  • return_seeds (int) –

  • num_seeds (int | None) –

  • use_nn_seed (bool) –

  • newton_iters (int | None) –

  • link_poses (Dict[str, Pose] | None) –

Return type:

IKResult

solve_batch_env(goal_pose, retract_config=None, seed_config=None, return_seeds=1, num_seeds=None, use_nn_seed=True, newton_iters=None, link_poses=None)
Parameters:
  • goal_pose (Pose) –

  • retract_config (Tensor | None) –

  • seed_config (Tensor | None) –

  • return_seeds (int) –

  • num_seeds (int | None) –

  • use_nn_seed (bool) –

  • newton_iters (int | None) –

  • link_poses (Dict[str, Pose] | None) –

Return type:

IKResult

solve_batch_env_goalset(goal_pose, retract_config=None, seed_config=None, return_seeds=1, num_seeds=None, use_nn_seed=True, newton_iters=None, link_poses=None)
Parameters:
  • goal_pose (Pose) –

  • retract_config (Tensor | None) –

  • seed_config (Tensor | None) –

  • return_seeds (int) –

  • num_seeds (int | None) –

  • use_nn_seed (bool) –

  • newton_iters (int | None) –

  • link_poses (Dict[str, Pose] | None) –

Return type:

IKResult

solve_from_solve_state(solve_state, goal_pose, num_seeds, retract_config=None, seed_config=None, return_seeds=1, use_nn_seed=True, newton_iters=None, link_poses=None)
Parameters:
  • solve_state (ReacherSolveState) –

  • goal_pose (Pose) –

  • num_seeds (int) –

  • retract_config (Tensor | None) –

  • seed_config (Tensor | None) –

  • return_seeds (int) –

  • use_nn_seed (bool) –

  • newton_iters (int | None) –

  • link_poses (Dict[str, Pose] | None) –

Return type:

IKResult

get_result(num_seeds, result, goal_pose, return_seeds)
Parameters:
  • num_seeds (int) –

  • result (WrapResult) –

  • goal_pose (Pose) –

  • return_seeds (int) –

Return type:

IKResult

get_seed(num_seeds, goal_pose, use_nn_seed, seed_config=None)
Parameters:
  • num_seeds (int) –

  • goal_pose (Pose) –

  • seed_config (Tensor | None) –

Return type:

Tensor

solve(goal_pose, retract_config=None, seed_config=None, return_seeds=1, num_seeds=None, use_nn_seed=True, newton_iters=None)

Ik solver

Parameters:
  • goal_pose (Pose) – _description_

  • retract_config (Optional[T_BDOF], optional) – _description_. Defaults to None.

  • seed_config (Optional[T_BDOF], optional) – _description_. Defaults to None.

  • return_seeds (int, optional) – _description_. Defaults to 1.

  • num_seeds (Optional[int], optional) – _description_. Defaults to None.

  • use_nn_seed (bool, optional) – _description_. Defaults to True.

  • newton_iters (Optional[int], optional) – _description_. Defaults to None.

Returns:

_description_

Return type:

IKResult

batch_env_solve(goal_pose, retract_config=None, seed_config=None, return_seeds=1, num_seeds=None, use_nn_seed=True, newton_iters=None)

Ik solver

Parameters:
  • goal_pose (Pose) – _description_

  • retract_config (Optional[T_BDOF], optional) – _description_. Defaults to None.

  • seed_config (Optional[T_BDOF], optional) – _description_. Defaults to None.

  • return_seeds (int, optional) – _description_. Defaults to 1.

  • num_seeds (Optional[int], optional) – _description_. Defaults to None.

  • use_nn_seed (bool, optional) – _description_. Defaults to True.

  • newton_iters (Optional[int], optional) – _description_. Defaults to None.

Returns:

_description_

Return type:

IKResult

get_success(metrics, num_seeds)
Parameters:
Return type:

Tensor

generate_seed(num_seeds, batch, use_nn_seed=False, pose=None)

Generate seeds for a batch. Given a pose set, this will create all the seeds: [batch + batch*random_restarts]

Parameters:
  • batch (int, optional) – [description]. Defaults to 1.

  • num_seeds (Optional[int], optional) – [description]. Defaults to None.

  • use_nn_seed (bool) –

  • pose (Pose | None) –

Returns:

[description]

Return type:

[type]

update_world(world)
Parameters:

world (WorldConfig) –

Return type:

bool

reset_seed()
Return type:

None

check_constraints(q)
Parameters:

q (JointState) –

Return type:

RolloutMetrics

sample_configs(n, use_batch_env=False)

Only works for environment=0

Parameters:

n (int) –

Return type:

Tensor

property kinematics: CudaRobotModel
get_all_rollout_instances()
Return type:

List[RolloutBase]

get_all_kinematics_instances()
Return type:

List[CudaRobotModel]

fk(q)
Parameters:

q (Tensor) –

Return type:

CudaRobotModelState

reset_cuda_graph()
Return type:

None

reset_shape()
attach_object_to_robot(sphere_radius, sphere_tensor=None, link_name='attached_object')
Parameters:
  • sphere_radius (float) –

  • sphere_tensor (Tensor | None) –

  • link_name (str) –

Return type:

None

detach_object_from_robot(link_name='attached_object')
Parameters:

link_name (str) –

Return type:

None

get_retract_config()
update_pose_cost_metric(metric)
Parameters:

metric (PoseCostMetric) –