curobo.graph.graph_base module

class GraphResult(
success: torch.Tensor,
start_q: torch.Tensor,
goal_q: torch.Tensor,
path_length: torch.Tensor | None = None,
solve_time: float = 0.0,
plan: List[List[torch.Tensor]] | None = 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

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 Graph(
nodes: torch.Tensor,
edges: torch.Tensor,
connectivity: torch.Tensor,
shortest_path_lengths: torch.Tensor | None = None,
)

Bases: object

nodes: Tensor
edges: Tensor
connectivity: Tensor
shortest_path_lengths: Tensor | None = None
set_shortest_path_lengths(
shortest_path_lengths: Tensor,
)
get_node_distance()
class 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: torch.Tensor,
interpolation_dt: float = 0.02,
interpolation_deviation: float = 0.05,
interpolation_acceleration_scale: float = 0.5,
)

Bases: object

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: Dict,
tensor_args: TensorDeviceType,
rollout_fn: RolloutBase,
safety_rollout_fn: RolloutBase,
use_cuda_graph: bool = True,
)
static load_from_robot_config(
robot_cfg: str | Dict | RobotConfig,
world_model: str | Dict | WorldConfig | 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),
world_coll_checker: WorldCollision | None = None,
base_cfg_file: str = 'base_cfg.yml',
graph_file: str = 'graph.yml',
self_collision_check: bool = True,
use_cuda_graph: bool = True,
seed: int | None = None,
)
class GraphPlanBase(
config: GraphConfig | None = None,
)

Bases: GraphConfig

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: int,
bounded: bool = True,
)
_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,
) int | None
get_path_lengths(goal_idx)
get_graph_shortest_path_lengths(
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: int | None = None,
) GraphResult
abstract _find_paths(
x_search,
c_search,
x_init,
) 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: List[Tensor],
interpolation_steps: int | None = None,
)
get_metrics(
state: State,
)
reset_seed()
reset_cuda_graph()
get_all_rollout_instances() List[RolloutBase]
warmup(
x_start: Tensor | None = None,
x_goal: Tensor | None = None,
)
static from_dict(
graph_dict: Dict,
tensor_args: TensorDeviceType,
rollout_fn: RolloutBase,
safety_rollout_fn: RolloutBase,
use_cuda_graph: bool = True,
)
interpolation_acceleration_scale: float = 0.5
interpolation_deviation: float = 0.05
interpolation_dt: float = 0.02
static load_from_robot_config(
robot_cfg: str | Dict | RobotConfig,
world_model: str | Dict | WorldConfig | 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),
world_coll_checker: WorldCollision | None = None,
base_cfg_file: str = 'base_cfg.yml',
graph_file: str = 'graph.yml',
self_collision_check: bool = True,
use_cuda_graph: bool = True,
seed: int | None = None,
)
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