curobo.graph.graph_base module

class curobo.graph.graph_base.GraphResult(success: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'value', torch.bool), 'cls_name': 'TensorType'}], start_q: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'dof', torch.float32), 'cls_name': 'TensorType'}], goal_q: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'dof', torch.float32), 'cls_name': 'TensorType'}], path_length: Optional[Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'value', torch.float32), 'cls_name': 'TensorType'}]] = None, solve_time: float = 0.0, plan: Optional[List[List[Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('dof', torch.float32), 'cls_name': 'TensorType'}]]]] = None, interpolated_plan: curobo.types.state.JointState | None = None, metrics: curobo.rollout.rollout_base.RolloutMetrics | None = None, valid_query: bool = True, debug_info: Any | None = None, optimized_dt: torch.Tensor | None = None, path_buffer_last_tstep: List[int] | None = None)

Bases: object

Parameters:
  • success (Tensor) –

  • start_q (Tensor) –

  • goal_q (Tensor) –

  • path_length (Tensor | None) –

  • solve_time (float) –

  • plan (List[List[Tensor]] | None) –

  • interpolated_plan (JointState | None) –

  • metrics (RolloutMetrics | None) –

  • valid_query (bool) –

  • debug_info (Any | None) –

  • optimized_dt (Tensor | None) –

  • path_buffer_last_tstep (List[int] | None) –

success: Tensor
start_q: Tensor
goal_q: Tensor
path_length: Tensor | None = None
solve_time: float = 0.0
plan: List[List[Tensor]] | None = None
interpolated_plan: JointState | None = None
metrics: RolloutMetrics | None = None
valid_query: bool = True
debug_info: Any | None = None
optimized_dt: Tensor | None = None
path_buffer_last_tstep: List[int] | None = None
class curobo.graph.graph_base.Graph(nodes: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'dof', torch.float32), 'cls_name': 'TensorType'}], edges: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'horizon', 'dof', torch.float32), 'cls_name': 'TensorType'}], connectivity: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'value', torch.int64), 'cls_name': 'TensorType'}], shortest_path_lengths: Optional[Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('batch', 'value', torch.float32), 'cls_name': 'TensorType'}]] = None)

Bases: object

Parameters:
  • nodes (Tensor) –

  • edges (Tensor) –

  • connectivity (Tensor) –

  • shortest_path_lengths (Tensor | None) –

nodes: Tensor
edges: Tensor
connectivity: Tensor
shortest_path_lengths: Tensor | None = None
set_shortest_path_lengths(shortest_path_lengths)
Parameters:

shortest_path_lengths (Tensor) –

get_node_distance()
class curobo.graph.graph_base.GraphConfig(max_nodes: int, steer_delta_buffer: int, sample_pts: int, node_similarity_distance: float, rejection_ratio: int, k_nn: int, c_max: float, vertex_n: int, graph_max_attempts: int, graph_min_attempts: int, init_nodes: int, use_bias_node: bool, dof: int, bounds: torch.Tensor, tensor_args: curobo.types.base.TensorDeviceType, rollout_fn: curobo.rollout.rollout_base.RolloutBase, safety_rollout_fn: curobo.rollout.rollout_base.RolloutBase, max_buffer: int, max_cg_buffer: int, compute_metrics: bool, interpolation_type: curobo.util.trajectory.InterpolateType, interpolation_steps: int, seed: int, use_cuda_graph_mask_samples: bool, distance_weight: torch.Tensor, bias_node: Annotated[torch.Tensor, {'__torchtyping__': True, 'details': ('dof', torch.float32), 'cls_name': 'TensorType'}], interpolation_dt: float = 0.02, interpolation_deviation: float = 0.05, interpolation_acceleration_scale: float = 0.5)

Bases: object

Parameters:
  • max_nodes (int) –

  • steer_delta_buffer (int) –

  • sample_pts (int) –

  • node_similarity_distance (float) –

  • rejection_ratio (int) –

  • k_nn (int) –

  • c_max (float) –

  • vertex_n (int) –

  • graph_max_attempts (int) –

  • graph_min_attempts (int) –

  • init_nodes (int) –

  • use_bias_node (bool) –

  • dof (int) –

  • bounds (Tensor) –

  • tensor_args (TensorDeviceType) –

  • rollout_fn (RolloutBase) –

  • safety_rollout_fn (RolloutBase) –

  • max_buffer (int) –

  • max_cg_buffer (int) –

  • compute_metrics (bool) –

  • interpolation_type (InterpolateType) –

  • interpolation_steps (int) –

  • seed (int) –

  • use_cuda_graph_mask_samples (bool) –

  • distance_weight (Tensor) –

  • bias_node (Tensor) –

  • interpolation_dt (float) –

  • interpolation_deviation (float) –

  • interpolation_acceleration_scale (float) –

max_nodes: int
steer_delta_buffer: int
sample_pts: int
node_similarity_distance: float
rejection_ratio: int
k_nn: int
c_max: float
vertex_n: int
graph_max_attempts: int
graph_min_attempts: int
init_nodes: int
use_bias_node: bool
dof: int
bounds: Tensor
tensor_args: TensorDeviceType
rollout_fn: RolloutBase
safety_rollout_fn: RolloutBase
max_buffer: int
max_cg_buffer: int
compute_metrics: bool
interpolation_type: InterpolateType
interpolation_steps: int
seed: int
use_cuda_graph_mask_samples: bool
distance_weight: Tensor
bias_node: Tensor
interpolation_dt: float = 0.02
interpolation_deviation: float = 0.05
interpolation_acceleration_scale: float = 0.5
static from_dict(graph_dict, tensor_args, rollout_fn, safety_rollout_fn, use_cuda_graph=True)
Parameters:
static load_from_robot_config(robot_cfg, world_model=None, tensor_args=TensorDeviceType(device=device(type='cuda', index=0), dtype=torch.float32), world_coll_checker=None, base_cfg_file='base_cfg.yml', graph_file='graph.yml', self_collision_check=True, use_cuda_graph=True)
Parameters:
  • robot_cfg (str | Dict | RobotConfig) –

  • world_model (str | Dict | WorldConfig | None) –

  • tensor_args (TensorDeviceType) –

  • world_coll_checker (WorldCollision | None) –

  • base_cfg_file (str) –

  • graph_file (str) –

  • self_collision_check (bool) –

  • use_cuda_graph (bool) –

class curobo.graph.graph_base.GraphPlanBase(config=None)

Bases: GraphConfig

Parameters:

config (GraphConfig | None) –

check_feasibility(x_set)
get_feasible_sample_set(x_samples)
mask_samples(x_samples)
_mask_samples_cuda_graph(x_samples)
_mask_samples(x_samples)
_cuda_graph_rollout_constraint(x_samples, use_batch_env=False)
get_samples(n_samples, bounded=True)
Parameters:
  • n_samples (int) –

  • bounded (bool) –

_sample_pts(n_samples=None, bounded=False, unit_ball=False, seed=123)
reset_buffer()
get_biased_vertex_set(x_start, x_goal, c_max=10.0, c_min=1, n=None, lazy=False)
_compute_rotation_frame(x_start, x_goal)
get_new_vertex_set(n=None, lazy=False)
validate_graph()
get_graph_edges()

Return edges in the graph with start node and end node locations

Returns:

tensor

get_graph()
_validate_graph()
_get_graph_shortest_path(start_node_idx, goal_node_idx, return_length=False)
batch_get_graph_shortest_path(start_idx_list, goal_idx_list, return_length=False)
batch_shortcut_path(g_path, start_idx, goal_idx)
get_node_idx(goal_state, exact=False)
Return type:

int | None

get_path_lengths(goal_idx)
get_graph_shortest_path_lengths(goal_idx)
Parameters:

goal_idx (int) –

path_exists(start_node_idx, goal_node_idx)
batch_path_exists(start_idx_list, goal_idx_list, all_paths=False)
find_paths(x_init, x_goal, interpolation_steps=None)
Parameters:

interpolation_steps (int | None) –

Return type:

GraphResult

abstract _find_paths(x_search, c_search, x_init)
Return type:

GraphResult

compute_path_length(path)
reset_graph()
_distance(pt, batch_pts, norm=True)
distance(pt, batch_pts, norm=True)
_hybrid_nearest(sample_node, path, radius, k_n=10)
_nearest(sample_point, current_graph)
_k_nearest(sample_point, current_graph, k=10)
_batch_k_nearest(sample_point, current_graph, k=10)
_near(sample_point, current_graph, radius)
_batch_steer_and_connect(start_nodes, goal_nodes, add_steer_pts=-1, lazy=False, add_exact_node=False)

Connect node from start to goal where both are batched.

Parameters:
  • start_node ([type]) – [description]

  • goal_nodes ([type]) – [description]

_batch_steer(start_nodes, desired_nodes, steer_radius=None, add_steer_pts=-1, lazy=False)
_add_batch_edges_to_graph(new_nodes, start_nodes, lazy=False, add_exact_node=False)
add_nodes_to_graph(nodes, add_exact_node=False)
_add_unique_nodes_to_graph(nodes, add_exact_node=False, skip_unique_check=False)
connect_nodes(x_set=None, connect_mode='knn', debug=False, lazy=False, add_exact_node=False, k_nn=10, edge_set=None)
get_paths(path_list)
get_interpolated_trajectory(trajectory, interpolation_steps=None)
Parameters:
  • trajectory (List[Tensor]) –

  • interpolation_steps (int | None) –

get_metrics(state)
Parameters:

state (State) –

reset_seed()
reset_cuda_graph()
get_all_rollout_instances()
Return type:

List[RolloutBase]

warmup(x_start=None, x_goal=None)
Parameters:
  • x_start (Tensor | None) –

  • x_goal (Tensor | None) –