trimesh.poses module¶
poses.py¶
Find stable orientations of meshes.
- trimesh.poses.compute_stable_poses(mesh, center_mass=None, sigma=0.0, n_samples=1, threshold=0.0)¶
Computes stable orientations of a mesh and their quasi-static probabilities.
This method samples the location of the center of mass from a multivariate gaussian with the mean at the center of mass, and a covariance equal to and identity matrix times sigma, over n_samples.
For each sample, it computes the stable resting poses of the mesh on a a planar workspace and evaluates the probabilities of landing in each pose if the object is dropped onto the table randomly.
This method returns the 4x4 homogeneous transform matrices that place the shape against the planar surface with the z-axis pointing upwards and a list of the probabilities for each pose.
The transforms and probabilities that are returned are sorted, with the most probable pose first.
- Parameters:
mesh (trimesh.Trimesh) – The target mesh
com ((3,) float) – Rhe object center of mass. If None, this method assumes uniform density and watertightness and computes a center of mass explicitly
sigma (float) – Rhe covariance for the multivariate gaussian used to sample center of mass locations
n_samples (int) – The number of samples of the center of mass location
threshold (float) – The probability value at which to threshold returned stable poses
- Returns:
transforms ((n, 4, 4) float) – The homogeneous matrices that transform the object to rest in a stable pose, with the new z-axis pointing upwards from the table and the object just touching the table.
probs ((n,) float) – Probability in (0, 1) for each pose