curobo.rollout.arm_base module

class ArmCostConfig(
bound_cfg: curobo.rollout.cost.bound_cost.BoundCostConfig | None = None,
null_space_cfg: curobo.rollout.cost.dist_cost.DistCostConfig | None = None,
manipulability_cfg: curobo.rollout.cost.manipulability_cost.ManipulabilityCostConfig | None = None,
stop_cfg: curobo.rollout.cost.stop_cost.StopCostConfig | None = None,
self_collision_cfg: curobo.rollout.cost.self_collision_cost.SelfCollisionCostConfig | None = None,
primitive_collision_cfg: curobo.rollout.cost.primitive_collision_cost.PrimitiveCollisionCostConfig | None = None,
)

Bases: object

bound_cfg: BoundCostConfig | None = None
null_space_cfg: DistCostConfig | None = None
manipulability_cfg: ManipulabilityCostConfig | None = None
stop_cfg: StopCostConfig | None = None
self_collision_cfg: SelfCollisionCostConfig | None = None
primitive_collision_cfg: PrimitiveCollisionCostConfig | None = None
static _get_base_keys()
static from_dict(
data_dict: Dict,
robot_config: RobotConfig,
world_coll_checker: WorldCollision | None = None,
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
)
static _get_formatted_dict(
data_dict: Dict,
cost_key_list: Dict,
robot_config: RobotConfig,
world_coll_checker: WorldCollision | None = None,
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
)
class ArmBaseConfig(
tensor_args: 'TensorDeviceType',
sum_horizon: 'bool' = False,
sampler_seed: 'int' = 1312,
model_cfg: curobo.rollout.dynamics_model.kinematic_model.KinematicModelConfig | None = None,
cost_cfg: curobo.rollout.arm_base.ArmCostConfig | None = None,
constraint_cfg: curobo.rollout.arm_base.ArmCostConfig | None = None,
convergence_cfg: curobo.rollout.arm_base.ArmCostConfig | None = None,
world_coll_checker: curobo.geom.sdf.world.WorldCollision | None = None,
)

Bases: RolloutConfig

model_cfg: KinematicModelConfig | None = None
cost_cfg: ArmCostConfig | None = None
constraint_cfg: ArmCostConfig | None = None
convergence_cfg: ArmCostConfig | None = None
world_coll_checker: WorldCollision | None = None
static model_from_dict(
model_data_dict: Dict,
robot_cfg: RobotConfig,
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
)
static cost_from_dict(
cost_data_dict: Dict,
robot_cfg: RobotConfig,
world_coll_checker: WorldCollision | None = None,
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
)
static world_coll_checker_from_dict(
world_coll_checker_dict: Dict | None = None,
world_model_dict: WorldConfig | Dict | None = None,
world_coll_checker: WorldCollision | None = None,
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
)
classmethod from_dict(
robot_cfg: Dict | RobotConfig,
model_data_dict: Dict,
cost_data_dict: Dict,
constraint_data_dict: Dict,
convergence_data_dict: Dict,
world_coll_checker_dict: Dict | None = None,
world_model_dict: Dict | None = None,
world_coll_checker: WorldCollision | None = None,
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
)

Create ArmBase class from dictionary

NOTE: We declare this as a classmethod to allow for derived classes to use it.

Parameters:
  • robot_cfg (Union[Dict, RobotConfig]) – _description_

  • model_data_dict (Dict) – _description_

  • cost_data_dict (Dict) – _description_

  • constraint_data_dict (Dict) – _description_

  • convergence_data_dict (Dict) – _description_

  • world_coll_checker_dict (Optional[Dict], optional) – _description_. Defaults to None.

  • world_model_dict (Optional[Dict], optional) – _description_. Defaults to None.

  • world_coll_checker (Optional[WorldCollision], optional) – _description_. Defaults to None.

  • tensor_args (TensorDeviceType, optional) – _description_. Defaults to TensorDeviceType().

Returns:

_description_

Return type:

_type_

sampler_seed: int = 1312
sum_horizon: bool = False
tensor_args: TensorDeviceType
class ArmBase(
config: ArmBaseConfig | None = None,
)

Bases: RolloutBase, ArmBaseConfig

This rollout function is for reaching a cartesian pose for a robot

_init_after_config_load()
cost_fn(
state: KinematicModelState,
action_batch=None,
return_list=False,
)
constraint_fn(
state: KinematicModelState,
out_metrics: RolloutMetrics | None = None,
use_batch_env: bool = True,
) RolloutMetrics
get_metrics(
state: JointState | KinematicModelState,
)
Compute metrics given state

#TODO: Currently does not compute velocity and acceleration costs.

Parameters:

state (Union[JointState, URDFModelState]) – _description_

Returns:

_description_

Return type:

_type_

get_metrics_cuda_graph(
state: JointState,
)

Use a CUDA Graph to compute metrics

Parameters:

state – _description_

Raises:

ValueError – _description_

Returns:

_description_

abstract convergence_fn(
state: KinematicModelState,
out_metrics: RolloutMetrics | None = None,
)
_get_augmented_state(
state: JointState,
) KinematicModelState
compute_kinematics(
state: JointState,
) KinematicModelState
rollout_constraint(
act_seq: Tensor,
use_batch_env: bool = True,
) RolloutMetrics
rollout_constraint_cuda_graph(
act_seq: Tensor,
use_batch_env: bool = True,
)
rollout_fn(
act_seq,
) Trajectory

Return sequence of costs and states encountered by simulating a batch of action sequences

Parameters:

action_seq (torch.Tensor [num_particles, horizon, d_act]) –

update_params(
goal: Goal,
)

Updates the goal targets for the cost functions.

get_ee_pose(current_state)
current_cost(
current_state: JointState,
no_coll=False,
return_state=True,
**kwargs,
)
filter_robot_state(
current_state: JointState,
) JointState
get_robot_command(
current_state: JointState,
act_seq: Tensor,
shift_steps: int = 1,
state_idx: Tensor | None = None,
) JointState
reset()
property d_action
property action_bound_lows
property action_bound_highs
property state_bounds: Dict[str, List[float]]
property dt
property horizon
property action_horizon
get_init_action_seq() Tensor
reset_shape()
reset_cuda_graph()
get_action_from_state(
state: JointState,
)
get_state_from_action(
start_state: JointState,
act_seq: Tensor,
state_idx: Tensor | None = None,
)
property kinematics
property cspace_config: CSpaceConfig
get_full_dof_from_solution(
q_js: JointState,
) JointState

This function will all the dof that are locked during optimization.

Parameters:

q_sol – _description_

Returns:

_description_

property joint_names: List[str]
property retract_state
update_traj_dt(
dt: float | Tensor,
base_dt: float | None = None,
max_dt: float | None = None,
base_ratio: float | None = None,
)
update_cost_dt(dt: float)
abstract property action_bounds
constraint_cfg: ArmCostConfig | None = None
convergence_cfg: ArmCostConfig | None = None
cost_cfg: ArmCostConfig | None = None
static cost_from_dict(
cost_data_dict: Dict,
robot_cfg: RobotConfig,
world_coll_checker: WorldCollision | None = None,
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
)
classmethod from_dict(
robot_cfg: Dict | RobotConfig,
model_data_dict: Dict,
cost_data_dict: Dict,
constraint_data_dict: Dict,
convergence_data_dict: Dict,
world_coll_checker_dict: Dict | None = None,
world_model_dict: Dict | None = None,
world_coll_checker: WorldCollision | None = None,
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
)

Create ArmBase class from dictionary

NOTE: We declare this as a classmethod to allow for derived classes to use it.

Parameters:
  • robot_cfg (Union[Dict, RobotConfig]) – _description_

  • model_data_dict (Dict) – _description_

  • cost_data_dict (Dict) – _description_

  • constraint_data_dict (Dict) – _description_

  • convergence_data_dict (Dict) – _description_

  • world_coll_checker_dict (Optional[Dict], optional) – _description_. Defaults to None.

  • world_model_dict (Optional[Dict], optional) – _description_. Defaults to None.

  • world_coll_checker (Optional[WorldCollision], optional) – _description_. Defaults to None.

  • tensor_args (TensorDeviceType, optional) – _description_. Defaults to TensorDeviceType().

Returns:

_description_

Return type:

_type_

model_cfg: KinematicModelConfig | None = None
static model_from_dict(
model_data_dict: Dict,
robot_cfg: RobotConfig,
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
)
reset_seed()
sample_random_actions(
n: int = 0,
)
sampler_seed: int = 1312
sum_horizon: bool = False
update_start_state(
start_state: Tensor,
)
world_coll_checker: WorldCollision | None = None
static world_coll_checker_from_dict(
world_coll_checker_dict: Dict | None = None,
world_model_dict: WorldConfig | Dict | None = None,
world_coll_checker: WorldCollision | None = None,
tensor_args: TensorDeviceType = TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32, collision_geometry_dtype=torch.float32, collision_gradient_dtype=torch.float32, collision_distance_dtype=torch.float32),
)
tensor_args: TensorDeviceType