curobo.opt.particle.particle_opt_utils module

class SquashType(value)

Bases: Enum

An enumeration.

CLAMP = 0
CLAMP_RESCALE = 1
TANH = 2
IDENTITY = 3
scale_ctrl(
ctrl,
action_lows,
action_highs,
squash_fn: SquashType = SquashType.CLAMP,
)
get_stomp_cov(
horizon: int,
d_action: int,
tensor_args=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),
cov_mode='acc',
RETURN_M=False,
)

Computes the covariance matrix following STOMP motion planner

Coefficients from here: https://en.wikipedia.org/wiki/Finite_difference_coefficient More info here: https://github.com/ros-industrial/stomp_ros/blob/7fe40fbe6ad446459d8d4889916c64e276dbf882/stomp_core/src/utils.cpp#L36

get_stomp_cov_jit(
horizon: int,
d_action: int,
cov_mode: str = 'acc',
device: device = device(type='cuda', index=0),
)
gaussian_logprob(
mean,
cov,
x,
cov_type='full',
)

Calculate gaussian log prob for given input batch x :param mean (np.ndarray): :type mean (np.ndarray): [N x num_samples] batch of means :param cov (np.ndarray): :type cov (np.ndarray): [N x N] covariance matrix :param x (np.ndarray): :type x (np.ndarray): [N x num_samples] batch of sample values

Returns:

log_prob (np.ndarray)

Return type:

[num_sampls] log probability of each sample

gaussian_logprobgrad(
mean,
cov,
x,
cov_type='full',
)
gaussian_entropy(cov=None, L=None)

Entropy of multivariate gaussian given either covariance or cholesky decomposition of covariance

gaussian_kl(
mean0,
cov0,
mean1,
cov1,
cov_type='full',
)

KL-divergence between Gaussians given mean and covariance KL(p||q) = E_{p}[log(p) - log(q)]

cost_to_go(
cost_seq: Tensor,
gamma_seq: Tensor,
only_first: bool = False,
) Tensor

Calculate (discounted) cost to go for given cost sequence

cost_to_go_np(cost_seq, gamma_seq)

Calculate (discounted) cost to go for given cost sequence

matrix_cholesky(A)
batch_cholesky(A)