curobo.rollout module

Rollout module.

Rollouts define the cost function and dynamics that an optimizer minimizes over. cuRobo’s built-in solvers use robot-specific rollouts internally; this public surface exposes rollouts useful for writing standalone optimization examples and benchmarks.

Currently exposes:
  • RosenbrockRollout / RosenbrockCfg: A canonical non-convex test function, useful for validating custom optimizer configurations against a well-known problem.

Example

from curobo.rollout import RosenbrockRollout, RosenbrockCfg

rollout = RosenbrockRollout(RosenbrockCfg(...))
class RosenbrockCfg(
device_cfg,
a=1.0,
b=100.0,
dimensions=2,
time_horizon=1,
time_action_horizon=1,
sum_horizon=False,
sampler_seed=1312,
)

Bases: object

Configuration for the Rosenbrock rollout class.

Parameters:
device_cfg: curobo._src.types.device_cfg.DeviceCfg

Device and dtype for tensors.

a: float = 1.0

The ‘a’ parameter in the Rosenbrock function (a-x)^2 + b(y-x^2)^2

b: float = 100.0

The ‘b’ parameter in the Rosenbrock function (a-x)^2 + b(y-x^2)^2

dimensions: int = 2

Number of dimensions for the Rosenbrock function

time_horizon: int = 1

Time horizon for the rollout

time_action_horizon: int = 1

Action horizon (usually same as horizon)

sum_horizon: bool = False

Whether to sum costs across the horizon.

sampler_seed: int = 1312

Seed for the random number generator.

classmethod create(
config_dict,
device_cfg=DeviceCfg(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 RosenbrockCfg from a dictionary.

Parameters:
__init__(
device_cfg,
a=1.0,
b=100.0,
dimensions=2,
time_horizon=1,
time_action_horizon=1,
sum_horizon=False,
sampler_seed=1312,
)
Parameters:
Return type:

None

class RosenbrockRollout(
config=None,
use_cuda_graph=False,
)

Bases: object

Rollout that evaluates the Rosenbrock cost for optimizer testing.

f(x, y) = (a - x)^2 + b(y - x^2)^2

For higher dimensions, uses the generalized form: f(x) = sum_{i=1}^{n-1} [ (a - x_i)^2 + b(x_{i+1} - x_i^2)^2 ]

Useful for verifying optimizer convergence without a full robot model. Supports optional CUDA-graph wrapping via use_cuda_graph.

Parameters:
__init__(
config=None,
use_cuda_graph=False,
)
Parameters:
property action_dim: int
property action_bound_lows: torch.Tensor
property action_bound_highs: torch.Tensor
property action_bounds: torch.Tensor
property horizon: int
property action_horizon: int
property state_bounds: Dict[str, List[float]]
property batch_size: int
property dt: float
evaluate_action(
act_seq,
**kwargs,
)
Return type:

RolloutResult

Parameters:

act_seq (torch.Tensor)

compute_metrics_from_state(
state,
**kwargs,
)
Return type:

RolloutMetrics

Parameters:

state (curobo._src.state.state_joint.JointState)

compute_metrics_from_action(
act_seq,
**kwargs,
)
Return type:

RolloutMetrics

Parameters:

act_seq (torch.Tensor)

update_params(
a=None,
b=None,
**kwargs,
)
Return type:

bool

Parameters:
update_batch_size(
batch_size,
)
Return type:

None

Parameters:

batch_size (int)

update_dt(
dt,
**kwargs,
)
Return type:

bool

reset(
reset_problem_ids=None,
**kwargs,
)
Return type:

bool

reset_shape()
Return type:

bool

reset_seed()
Return type:

None

reset_cuda_graph()
Return type:

bool

sample_random_actions(
n=0,
bounded=True,
)
Return type:

Tensor

Parameters:
get_initial_action(
use_random=True,
use_zero=False,
**kwargs,
)
Return type:

Tensor

Parameters:
get_all_cost_components()