mirror of
https://github.com/wassname/pyrobolearn.git
synced 2026-09-09 11:31:38 +08:00
add new world + add traj. segmentation in GMM
This commit is contained in:
@@ -78,11 +78,11 @@ class PCA(object):
|
||||
##############
|
||||
|
||||
@property
|
||||
def eigenvalues(self): # alias to evals
|
||||
def eigenvalues(self): # alias to evals
|
||||
return self.evals
|
||||
|
||||
@property
|
||||
def eigenvectors(self): # alias to evecs
|
||||
def eigenvectors(self): # alias to evecs
|
||||
return self.evecs
|
||||
|
||||
##################
|
||||
|
||||
+419
-97
@@ -10,12 +10,16 @@ try:
|
||||
import cPickle as pickle
|
||||
except ImportError as e:
|
||||
import pickle
|
||||
from scipy import signal
|
||||
from scipy import interpolate
|
||||
from sklearn.cluster import KMeans
|
||||
from sklearn.mixture import GaussianMixture, BayesianGaussianMixture
|
||||
|
||||
# from pyrobolearn.models.model import Model
|
||||
from pyrobolearn.models.gaussian import Gaussian
|
||||
|
||||
from pyrobolearn.filters.utils import smooth
|
||||
|
||||
|
||||
__author__ = "Brian Delhaisse"
|
||||
__copyright__ = "Copyright 2018, PyRoboLearn"
|
||||
@@ -182,6 +186,9 @@ class GMM(object):
|
||||
if len(priors) != len(gaussians):
|
||||
raise ValueError("The number of priors and gaussians are differents")
|
||||
|
||||
# Set dimensionality
|
||||
self._dimensionality = dimensionality if isinstance(dimensionality, int) and dimensionality > 0 else 0
|
||||
|
||||
##############
|
||||
# Properties #
|
||||
##############
|
||||
@@ -210,7 +217,7 @@ class GMM(object):
|
||||
"""Return the dimensionality of the mean"""
|
||||
if len(self._gaussians) > 0:
|
||||
return self._gaussians[0].dim
|
||||
return 0
|
||||
return self._dimensionality
|
||||
|
||||
# alias
|
||||
dim = dimensionality
|
||||
@@ -698,15 +705,69 @@ class GMM(object):
|
||||
"""
|
||||
return - 2 * self.log_likelihood(x) + self.num_parameters * np.log(self.num_data)
|
||||
|
||||
def estimate_num_components_from_trajectory_curvature_segmentation(self, data):
|
||||
"""
|
||||
def estimate_num_components_from_trajectory_curvature_segmentation(self, data, interpolation_method='cubic',
|
||||
smooth_curvature=True):
|
||||
r"""
|
||||
Estimate the number of components / Gaussians needed to model a temporal and spatial trajectory based on
|
||||
trajectory curvature segmentation.
|
||||
trajectory curvature segmentation. This only works for sequential temporal and spatial data. The first
|
||||
dimension is assumed to be the time, and the other dimensions have to be spatial data (x [,y [,z]]).
|
||||
|
||||
Warnings: this only makes sense with trajectories.
|
||||
Warnings: this initialization only makes sense with spatial trajectories, and is deterministic. It also
|
||||
assumes that the trajectories are similar. Currently, we only accept 4D curves (t, x, y, z).
|
||||
|
||||
From [1], let's assume a D-dimensional curve :math:`\pmb{x}(t) \in \mathbb{R}^D`, for which we can define a
|
||||
Frenet frame at each time step :math:`\{\pmb{e}_1(t), ..., \pmb{e}_D(t)\}`. That curve can be the mean
|
||||
trajectory computed from all the provided trajectories. It might be necessary to align them using dynamic time
|
||||
wrapping beforehand, The basis vectors are computed using the Gram-Schmidt orthogonalization process, where
|
||||
the first basis is computed using:
|
||||
|
||||
.. math::
|
||||
|
||||
\pmb{q}_1(t) &= \frac{\partial \pmb{x}(t)}{\partial t} \\
|
||||
\pmb{e}_1(t) &= \frac{\pmb{q}_1(t)}{|| \pmb{q}_1(t) ||}
|
||||
|
||||
and the subsequent basis are computed recursively using:
|
||||
|
||||
.. math::
|
||||
|
||||
\pmb{q}_j(t) &= \frac{\partial^j \pmb{x}(t)}{\partial t^j} - \sum_{i=1}^{j-1}
|
||||
\pmb{e}_i(t)^\top \left( \frac{\partial^j \pmb{x}(t)}{\partial t^j} \right) \pmb{e}_i(t) \\
|
||||
\pmb{e}_1(t) &= \frac{ \pmb{q}_j(t) }{ ||\pmb{q}_j(t)|| }
|
||||
|
||||
Based on these basis vectors, we can compute the generalized curvatures :math:`\{\chi_j(t)\}_{j=1}^{D-1}`,
|
||||
where:
|
||||
|
||||
.. math::
|
||||
|
||||
\chi_j(t) = \frac{\pmb{e}_{j+1}(t)^\top \left( \frac{\partial \pmb{e}_j(t)}{\partial t}\right)}
|
||||
{|| \frac{\partial \pmb{x}(t)}{\partial t} ||}.
|
||||
|
||||
Note that, this involves the computation of the jth derivative of the curve wrt to the time for each dimension
|
||||
:math:`j \in \{1, ..., D\}`. In order to get satisfactory estimations, we can locally approximated the curve by
|
||||
a D-dimensional polynomial function. "The derivatives can subsequently be analytically computed and are
|
||||
re-sampled to provide trajectories of T data points" [1]. For instance, for a 3D curve we can use a Hermite
|
||||
interpolator (a 5th order polynomial) or a 3D polynomial function.
|
||||
|
||||
The total norm curvature of a D-dimensional curve is finally defined as:
|
||||
|
||||
.. math:: \Sigma(t) = \sqrt{\sum_{i=1}^{D-2} \chi_i(t)^2}
|
||||
|
||||
The local maxima of :math:`\Sigma(t)` provide points for segmenting the trajectory, where the data between
|
||||
two segmentation points represent parts of the trajectory for which directions do not vary much" [1]. The
|
||||
number of local maxima + 1 provides the number of Gaussian needed.
|
||||
|
||||
Args:
|
||||
data (np.array[T,D]): trajectory data.
|
||||
data (np.array[N,D], list of np.array[T,D], np.array[N,T,D]): data matrix(ces). For each matrix, we assume
|
||||
that the first dimension is the time. If only a 2D matrix is provided, the trajectory can be
|
||||
concatenated but the time has to be relative; that is when you record a trajectory the time
|
||||
has to between [t0, tf], and when you record another trajectory it has to be between [t0',tf'] where
|
||||
t0' < tf. We will use that to reshape the matrix.
|
||||
interpolation_method (str): "Specifies the kind of interpolation as a string ('linear', 'nearest', 'zero',
|
||||
'slinear', 'quadratic', 'cubic', 'previous', 'next', where 'zero', 'slinear', 'quadratic' and 'cubic'
|
||||
refer to a spline interpolation of zeroth, first, second or third order; 'previous' and 'next' simply
|
||||
return the previous or next value of the point) or as an integer specifying the order of the spline
|
||||
interpolator to use. Default is 'cubic'." from ``scipy.interpolate.interp1d`` documentation.
|
||||
smooth_curvature (bool): if we should smooth the total norm curvature before looking for the local maxima.
|
||||
|
||||
Returns:
|
||||
int: number of components needed
|
||||
@@ -714,6 +775,215 @@ class GMM(object):
|
||||
References:
|
||||
- [1] "Robot Programming by Demonstration: A Probabilistic Approach", Calinon, 2009, Chap 2.8.2
|
||||
"""
|
||||
indices = self._get_curvature_segmentation_points(data, interpolation_method=interpolation_method,
|
||||
smooth_curvature=smooth_curvature)[0]
|
||||
return len(indices) - 1 # because the indices contain the first and end points
|
||||
|
||||
@staticmethod
|
||||
def _get_curvature_segmentation_points(data, interpolation_method='cubic', smooth_curvature=True):
|
||||
r"""
|
||||
Get the trajectory curvature segmentation points. This only works for sequential temporal and
|
||||
spatial data. The first dimension is assumed to be the time, and the other dimensions have to be spatial data
|
||||
(x [,y [,z]]).
|
||||
|
||||
Warnings: this initialization only makes sense with spatial trajectories, and is deterministic. It also
|
||||
assumes that the trajectories are similar. Currently, we only accept 4D curves (t, x, y, z).
|
||||
|
||||
From [1], let's assume a D-dimensional curve :math:`\pmb{x}(t) \in \mathbb{R}^D`, for which we can define a
|
||||
Frenet frame at each time step :math:`\{\pmb{e}_1(t), ..., \pmb{e}_D(t)\}`. That curve can be the mean
|
||||
trajectory computed from all the provided trajectories. It might be necessary to align them using dynamic time
|
||||
wrapping beforehand, The basis vectors are computed using the Gram-Schmidt orthogonalization process, where
|
||||
the first basis is computed using:
|
||||
|
||||
.. math::
|
||||
|
||||
\pmb{q}_1(t) &= \frac{\partial \pmb{x}(t)}{\partial t} \\
|
||||
\pmb{e}_1(t) &= \frac{\pmb{q}_1(t)}{|| \pmb{q}_1(t) ||}
|
||||
|
||||
and the subsequent basis are computed recursively using:
|
||||
|
||||
.. math::
|
||||
|
||||
\pmb{q}_j(t) &= \frac{\partial^j \pmb{x}(t)}{\partial t^j} - \sum_{i=1}^{j-1}
|
||||
\pmb{e}_i(t)^\top \left( \frac{\partial^j \pmb{x}(t)}{\partial t^j} \right) \pmb{e}_i(t) \\
|
||||
\pmb{e}_1(t) &= \frac{ \pmb{q}_j(t) }{ ||\pmb{q}_j(t)|| }
|
||||
|
||||
Based on these basis vectors, we can compute the generalized curvatures :math:`\{\chi_j(t)\}_{j=1}^{D-1}`,
|
||||
where:
|
||||
|
||||
.. math::
|
||||
|
||||
\chi_j(t) = \frac{\pmb{e}_{j+1}(t)^\top \left( \frac{\partial \pmb{e}_j(t)}{\partial t}\right)}
|
||||
{|| \frac{\partial \pmb{x}(t)}{\partial t} ||}.
|
||||
|
||||
Note that, this involves the computation of the jth derivative of the curve wrt to the time for each dimension
|
||||
:math:`j \in \{1, ..., D\}`. In order to get satisfactory estimations, we can locally approximated the curve by
|
||||
a D-dimensional polynomial function. "The derivatives can subsequently be analytically computed and are
|
||||
re-sampled to provide trajectories of T data points" [1]. For instance, for a 3D curve we can use a Hermite
|
||||
interpolator (a 5th order polynomial) or a 3D polynomial function.
|
||||
|
||||
The total norm curvature of a D-dimensional curve is finally defined as:
|
||||
|
||||
.. math:: \Sigma(t) = \sqrt{\sum_{i=1}^{D-2} \chi_i(t)^2}
|
||||
|
||||
The local maxima of :math:`\Sigma(t)` provide points for segmenting the trajectory, where the data between
|
||||
two segmentation points represent parts of the trajectory for which directions do not vary much" [1].
|
||||
Based on them, we can then compute the mean of each Gaussian by taking the center between two segmentation
|
||||
points, and compute the covariance matrix by looking at the variation of each trajectory along each dimension
|
||||
(for the time dimension, we check the distance between the mean of a Gaussian and one of its associated
|
||||
segmentation point).
|
||||
|
||||
Args:
|
||||
data (np.array[N,D], list of np.array[T,D], np.array[N,T,D]): data matrix(ces). For each matrix, we assume
|
||||
that the first dimension is the time. If only a 2D matrix is provided, the trajectory can be
|
||||
concatenated but the time has to be relative; that is when you record a trajectory the time
|
||||
has to between [t0, tf], and when you record another trajectory it has to be between [t0',tf'] where
|
||||
t0' < tf. We will use that to reshape the matrix.
|
||||
interpolation_method (str): "Specifies the kind of interpolation as a string ('linear', 'nearest', 'zero',
|
||||
'slinear', 'quadratic', 'cubic', 'previous', 'next', where 'zero', 'slinear', 'quadratic' and 'cubic'
|
||||
refer to a spline interpolation of zeroth, first, second or third order; 'previous' and 'next' simply
|
||||
return the previous or next value of the point) or as an integer specifying the order of the spline
|
||||
interpolator to use. Default is 'cubic'." from ``scipy.interpolate.interp1d`` documentation.
|
||||
smooth_curvature (bool): if we should smooth the total norm curvature before looking for the local maxima.
|
||||
|
||||
Returns:
|
||||
np.array: indices where we have local maxima in the total norm curvature; i.e. segmenting points. The
|
||||
beginning and end points are also included in the indices. Thus, the number of needed gaussians is
|
||||
the size of the returned array - 1.
|
||||
np.array: reshaped trajectories of shape (N, T, D). The trajectories have been reshaped such that they
|
||||
have the same size (T, D) where T is the maximum time length that was found in the data.
|
||||
np.array: mean trajectory on the reshaped trajectory. It has a shape (T, D).
|
||||
|
||||
References:
|
||||
- [1] "Robot Programming by Demonstration: A Probabilistic Approach", Calinon, 2009, Chap 2.8.2
|
||||
"""
|
||||
# check shape of data
|
||||
if isinstance(data, list): # if data is a list of np.array[T,D]
|
||||
for d in data:
|
||||
if not isinstance(d, np.ndarray):
|
||||
raise TypeError("Expecting each element in the given data list to be a np.array, instead got: "
|
||||
"{}".format(type(d)))
|
||||
if len(d.shape) != 2:
|
||||
raise ValueError("Expecting each element in the given data list to be a np.array of shape 2, "
|
||||
"instead got: {}".format(d.shape))
|
||||
|
||||
elif isinstance(data, np.ndarray): # if data is a np.array[N,T,D] or np.array[N,D]
|
||||
if len(data.shape) != 2 and len(data.shape) != 3:
|
||||
raise ValueError("Expecting the given data array to have a shape of 2 or 3 (i.e. len(shape)), "
|
||||
"instead got: {}".format(data.shape))
|
||||
|
||||
# if 2D matrix, we have to create a list of np.array[T,D]
|
||||
# we go through each element and when the time associated with an element is smaller than the preceding
|
||||
# time, we create a trajectory
|
||||
if len(data.shape) == 2:
|
||||
d = []
|
||||
t_prec = data[0][0]
|
||||
i_prec = 0 # index to cut the data
|
||||
for i, step in enumerate(data):
|
||||
t = step[0] # get current time
|
||||
|
||||
# if current time is smaller than previous time, we assume it is a new trajectory as we can
|
||||
# go to the past ;)
|
||||
if t < t_prec or i == len(data) - 1:
|
||||
d.append(data[i_prec:i + 1])
|
||||
i_prec = i
|
||||
|
||||
# update precedent time
|
||||
t_prec = t
|
||||
|
||||
# set data
|
||||
data = d # list of np.array[T,D]
|
||||
else:
|
||||
raise TypeError("Expecting the given data to be a list of 2D np.array, a 2D np.array, or 3D np.array, "
|
||||
"instead got: {}".format(type(data)))
|
||||
|
||||
# check if we have enough trajectories to compute the covariances
|
||||
if len(data) == 0 or len(data) < data[0].shape[1]:
|
||||
raise ValueError("Expecting to have more trajectories than the dimensionality of each trajectory.")
|
||||
|
||||
# fit a polynomial function to each trajectory
|
||||
data_fcts, num_points, periods, t0s = [], [], [], []
|
||||
for d in data:
|
||||
period = (d[-1, 0] - d[0, 0]) # T = (tf - t0)
|
||||
t = d[:, 0] - d[0, 0] # t = [t0, ..., tf] --> t = [0, ..., tf-t0]
|
||||
t /= period # t = [0, ..., tf-t0] --> t= [0, ..., 1]
|
||||
|
||||
# compute interpolation function
|
||||
fct = interpolate.interp1d(t, d[:, 1:], kind=interpolation_method, axis=0, assume_sorted=True)
|
||||
|
||||
# add useful variables
|
||||
data_fcts.append(fct)
|
||||
num_points.append(d.shape[0])
|
||||
periods.append(period)
|
||||
t0s.append(d[0, 0])
|
||||
|
||||
# sample trajectories (such that they have the same size)
|
||||
num_max_points = np.max(num_points)
|
||||
t = np.linspace(0, 1, num_max_points)
|
||||
trajectories = np.array([fct(t) for fct in data_fcts]) # shape=(N,T,D-1); (D-1) because we removed the time
|
||||
|
||||
# compute mean trajectory from which we will compute the Frenet frame
|
||||
mean_traj = np.mean(trajectories, axis=0) # (T, D-1)
|
||||
|
||||
# fit polynomial function to the mean trajectory
|
||||
# currently, we only consider cubic spline (3D) interpolation
|
||||
if mean_traj.shape[1] > 3:
|
||||
raise ValueError("Currently, this method doesn't accept more than 4 dimensions (time, x, y, z), "
|
||||
"however {} dimensions were given".format(mean_traj.shape[1] + 1))
|
||||
interpolator = interpolate.CubicSpline(t, mean_traj, axis=0)
|
||||
# coeffs = np.polyfit(mean_traj[:, 0], mean_traj[:, 1], deg=data.shape[2]-1) # (T,D)
|
||||
# interpolator = interpolate.KroghInterpolator(t, mean_traj, axis=0)
|
||||
# derivatives = interpolator.derivatives(t)
|
||||
|
||||
# compute basis vectors for the Frenet frame
|
||||
bases = []
|
||||
generalized_curvatures = []
|
||||
norm_first_deriv = 1
|
||||
for i in range(mean_traj.shape[1]):
|
||||
derivative = interpolator.derivative(nu=i + 1)
|
||||
d = derivative(t) # (T, D-1)
|
||||
|
||||
# if not first basis vector, compute orthogonal vector using Gram-Schmidt
|
||||
if i != 0:
|
||||
d_init = np.array(d)
|
||||
for basis in bases: # TODO: vectorize this
|
||||
d -= np.sum(basis * d_init, axis=1) * basis # (T, D-1)
|
||||
else:
|
||||
norm_first_deriv = np.linalg.norm(d, axis=1) # (T,)
|
||||
|
||||
# normalize basis vector
|
||||
basis = (d.T / np.linalg.norm(d, axis=1)).T # (T, D-1)
|
||||
bases.append(basis)
|
||||
|
||||
# compute generalized curvature
|
||||
if i != 0:
|
||||
# compute first derivative of previous basis
|
||||
d = interpolate.CubicSpline(t, bases[-1], axis=0).derivative(nu=1)
|
||||
d = d(t) # (T, D-1)
|
||||
|
||||
chi = np.sum(basis * d, axis=1) / norm_first_deriv # (T,)
|
||||
generalized_curvatures.append(chi)
|
||||
|
||||
generalized_curvatures = np.array(generalized_curvatures) # (D-2, T)
|
||||
|
||||
# compute total curvature norm
|
||||
total_curvature_norm = np.linalg.norm(generalized_curvatures, axis=0) # (T,)
|
||||
|
||||
# the local maxima of total curvature provide points for segmenting the trajectory (+ start / end points)
|
||||
if smooth_curvature:
|
||||
total_curvature_norm = smooth(total_curvature_norm) # smooth the signal
|
||||
indices = np.diff(np.sign(np.diff(total_curvature_norm))) < 0 # (T-2,)
|
||||
indices = np.concatenate(([True], indices, [True])) # (T,)
|
||||
indices = np.where(indices)[0] # (I,)
|
||||
# peaks_indices = scipy.signal.find_peaks(total_curvature_norm)
|
||||
# peaks_indices = scipy.signal.find_peaks_cwt(total_curvature_norm, widths=np.arange(1,10))
|
||||
# extrema = scipy.signal.argrelextrema(total_curvature_norm)
|
||||
|
||||
# append time dimension back to trajectories / mean trajectory
|
||||
trajectories = np.dstack((t.reshape(-1, 1), trajectories)) # (N, T, D)
|
||||
mean_traj = np.hstack((t.reshape(-1, 1), mean_traj)) # (T, D)
|
||||
|
||||
return indices, trajectories, mean_traj
|
||||
|
||||
def init_random(self, data, seed=None, reg=1e-8):
|
||||
r"""
|
||||
@@ -725,7 +995,11 @@ class GMM(object):
|
||||
reg (float): regularization term (useful to not have singular covariance matrices)
|
||||
"""
|
||||
# initialize random generator
|
||||
np.random.seed(seed)
|
||||
if seed is not None:
|
||||
np.random.seed(seed)
|
||||
|
||||
# set dimensionality
|
||||
self._dimensionality = data.shape[1]
|
||||
|
||||
# uniform priors
|
||||
self._priors = np.ones(self.num_components) / self.num_components
|
||||
@@ -744,12 +1018,45 @@ class GMM(object):
|
||||
# create gaussians
|
||||
self._gaussians = [Gaussian(mean=mu, covariance=cov) for mu, cov in zip(means, covariances)]
|
||||
|
||||
def init_kmeans(self, data, seed=None):
|
||||
r"""
|
||||
Initialize the GMM using K-means algorithm.
|
||||
|
||||
Args:
|
||||
data (np.array[N,D]): data matrix
|
||||
seed (int, None): seed for random generator
|
||||
"""
|
||||
# initialize random generator
|
||||
if seed is not None:
|
||||
np.random.seed(seed)
|
||||
|
||||
# set dimensionality
|
||||
self._dimensionality = data.shape[1]
|
||||
|
||||
# fit the data using k-means
|
||||
km = KMeans(n_clusters=self.num_components)
|
||||
km.fit(data)
|
||||
|
||||
# uniform priors
|
||||
self._priors = np.ones(self.num_components) / self.num_components
|
||||
|
||||
# identity covariances
|
||||
covariances = np.array([np.identity(self.dim)] * self.num_components)
|
||||
|
||||
# means = position of the cluster centers
|
||||
means = km.cluster_centers_
|
||||
|
||||
# create gaussians
|
||||
self._gaussians = [Gaussian(mean=mu, covariance=cov) for mu, cov in zip(means, covariances)]
|
||||
|
||||
def init_uniformly(self, data, axis=0):
|
||||
r"""
|
||||
Initialize the GMM uniformly in the space with respect to the axis dimension. If the data represents
|
||||
trajectories, the first dimension is the time and it will distributed uniformly with respect to that one by
|
||||
default. The covariances of each Gaussian will be a spherical one.
|
||||
|
||||
Warnings: this initialization is deterministic (given the same data).
|
||||
|
||||
Args:
|
||||
data (np.array[N,D]): data matrix
|
||||
axis (int): axis specifying the dimension to distribute the Gaussians uniformly
|
||||
@@ -780,18 +1087,45 @@ class GMM(object):
|
||||
# create gaussians
|
||||
self._gaussians = [Gaussian(mean=mu, covariance=cov) for mu, cov in zip(means, covariances)]
|
||||
|
||||
def init_curvature(self, data):
|
||||
def init_sklearn(self, data, seed=None, max_iter=10, init_params='kmeans', reg=1e-6):
|
||||
r"""
|
||||
Initialize the GMM using the curvature of the trajectories. This only works for sequential temporal and
|
||||
spatial data. The first dimension has to be the time, and the other dimensions have to be spatial data
|
||||
Initialize the GMM by training a GMM from the sklearn library.
|
||||
|
||||
Args:
|
||||
data (np.array[N,D]): data matrix
|
||||
seed (int, None): seed for random generator
|
||||
max_iter (int): the number of EM iterations to perform
|
||||
init_params (str): {'kmeans', 'random'}, defaults to 'kmeans'. The method used to initialize the
|
||||
weights, the means and the precisions.
|
||||
reg (float): regularization term (useful to not have singular covariance matrices)
|
||||
"""
|
||||
# check seed
|
||||
kwargs = {}
|
||||
if seed is not None:
|
||||
kwargs['random_state'] = seed
|
||||
|
||||
# fit data to gmm
|
||||
gmm_ = GaussianMixture(n_components=self.num_components, max_iter=max_iter, init_params=init_params,
|
||||
reg_covar=reg, **kwargs)
|
||||
gmm_.fit(data)
|
||||
|
||||
# create gaussians
|
||||
self._gaussians = [Gaussian(mean=mu, covariance=cov) for mu, cov in zip(gmm_.means_, gmm_.covariances_)]
|
||||
|
||||
def init_curvature(self, data, interpolation_method='cubic', reg=1.e-6, smooth_curvature=True):
|
||||
r"""
|
||||
Initialize the GMM using trajectory curvature segmentation. This only works for sequential temporal and
|
||||
spatial data. The first dimension is assumed to be the time, and the other dimensions have to be spatial data
|
||||
(x [,y [,z]]).
|
||||
|
||||
Warnings: this initialization only makes sense with trajectories.
|
||||
Warnings: this initialization only makes sense with spatial trajectories, and is deterministic. It also
|
||||
assumes that the trajectories are similar. Currently, we only accept 4D curves (t, x, y, z).
|
||||
|
||||
From [1], let's assume a D-dimensional curve :math:`x(t) \in \mathbb{R}^D`, for which we can define a Frenet
|
||||
frame at each time step :math:`\{e_1(t), ..., e_D(t)\}`. That curve can be the mean trajectory computed from
|
||||
all the provided trajectories. The basis vectors are computed using the Gram-Schmidt orthogonalization process,
|
||||
where the first basis is computed using:
|
||||
From [1], let's assume a D-dimensional curve :math:`\pmb{x}(t) \in \mathbb{R}^D`, for which we can define a
|
||||
Frenet frame at each time step :math:`\{\pmb{e}_1(t), ..., \pmb{e}_D(t)\}`. That curve can be the mean
|
||||
trajectory computed from all the provided trajectories. It might be necessary to align them using dynamic time
|
||||
wrapping beforehand, The basis vectors are computed using the Gram-Schmidt orthogonalization process, where
|
||||
the first basis is computed using:
|
||||
|
||||
.. math::
|
||||
|
||||
@@ -817,10 +1151,10 @@ class GMM(object):
|
||||
Note that, this involves the computation of the jth derivative of the curve wrt to the time for each dimension
|
||||
:math:`j \in \{1, ..., D\}`. In order to get satisfactory estimations, we can locally approximated the curve by
|
||||
a D-dimensional polynomial function. "The derivatives can subsequently be analytically computed and are
|
||||
resampled to provide trajectories of T datapoints" [1]. For instance, for a 3D curve we can use a Hermite
|
||||
re-sampled to provide trajectories of T data points" [1]. For instance, for a 3D curve we can use a Hermite
|
||||
interpolator (a 5th order polynomial) or a 3D polynomial function.
|
||||
|
||||
The total curvature of a D-dimensional curve is finally defined as:
|
||||
The total norm curvature of a D-dimensional curve is finally defined as:
|
||||
|
||||
.. math:: \Sigma(t) = \sqrt{\sum_{i=1}^{D-2} \chi_i(t)^2}
|
||||
|
||||
@@ -835,105 +1169,73 @@ class GMM(object):
|
||||
data (np.array[N,D], list of np.array[T,D], np.array[N,T,D]): data matrix(ces). For each matrix, we assume
|
||||
that the first dimension is the time. If only a 2D matrix is provided, the trajectory can be
|
||||
concatenated but the time has to be relative; that is when you record a trajectory the time
|
||||
has to between [t0, tf], and when you record another trajectory it has to be again [t0',tf'] where
|
||||
has to between [t0, tf], and when you record another trajectory it has to be between [t0',tf'] where
|
||||
t0' < tf. We will use that to reshape the matrix.
|
||||
interpolation_method (str): "Specifies the kind of interpolation as a string ('linear', 'nearest', 'zero',
|
||||
'slinear', 'quadratic', 'cubic', 'previous', 'next', where 'zero', 'slinear', 'quadratic' and 'cubic'
|
||||
refer to a spline interpolation of zeroth, first, second or third order; 'previous' and 'next' simply
|
||||
return the previous or next value of the point) or as an integer specifying the order of the spline
|
||||
interpolator to use. Default is 'cubic'." from ``scipy.interpolate.interp1d`` documentation.
|
||||
reg (float): regularization term (useful to not have singular covariance matrices)
|
||||
smooth_curvature (bool): if we should smooth the total norm curvature before looking for the local maxima.
|
||||
|
||||
References:
|
||||
- [1] "Robot Programming by Demonstration: A Probabilistic Approach", Calinon, 2009, Chap 2.8.2
|
||||
"""
|
||||
# fit a polynomial function to the trajectories
|
||||
# get the trajectory curvature segmentation points
|
||||
ret = self._get_curvature_segmentation_points(data, interpolation_method=interpolation_method,
|
||||
smooth_curvature=smooth_curvature)
|
||||
# get the segmentation points (I,), reshaped trajectories (N, T, D), and mean of the reshaped trajectory (T,D)
|
||||
indices, trajectories, mean_traj = ret
|
||||
|
||||
# resample trajectories
|
||||
# take each couple of segmenting points and compute the mean and covariance of a Gaussian
|
||||
means, covariances = [], []
|
||||
for i in range(len(indices) - 1):
|
||||
idx1, idx2 = indices[i], indices[i+1]
|
||||
|
||||
# compute mean trajectory from which we will compute the Frenet frame
|
||||
# compute the mean
|
||||
mean = np.mean(mean_traj[idx1:idx2], axis=0) # (D,)
|
||||
means.append(mean)
|
||||
|
||||
# create gaussians
|
||||
pass
|
||||
# compute the covariance based on all the trajectories
|
||||
# 1. center the data
|
||||
trajs = trajectories[:, idx1:idx2] # (N, dT, D)
|
||||
trajs -= mean
|
||||
|
||||
def init_sklearn(self, data, max_iter=10, init_params='kmeans'):
|
||||
r"""
|
||||
Initialize the GMM by training a GMM from the sklearn library.
|
||||
|
||||
Args:
|
||||
data (np.array[N,D]): data matrix
|
||||
max_iter (int): the number of EM iterations to perform
|
||||
init_params (str): {'kmeans', 'random'}, defaults to 'kmeans'. The method used to initialize the
|
||||
weights, the means and the precisions.
|
||||
"""
|
||||
# fit data to gmm
|
||||
gmm_ = GaussianMixture(n_components=self.num_components, max_iter=max_iter, init_params=init_params)
|
||||
gmm_.fit(data)
|
||||
|
||||
# create gaussians
|
||||
self._gaussians = [Gaussian(mean=mu, covariance=cov) for mu, cov in zip(gmm_.means_, gmm_.covariances_)]
|
||||
|
||||
def init_time_warping(self, data):
|
||||
r"""
|
||||
Initialize the GMM using Dynamic Time Wrapping [1]. This only works for sequential temporal and spatial data.
|
||||
The first dimension has to be the time, and the other dimensions have to be spatial data (x [,y [,z]]).
|
||||
|
||||
Warnings: this initialization only makes sense with trajectories.
|
||||
|
||||
Args:
|
||||
data (np.array[N,D]): data matrix
|
||||
|
||||
References:
|
||||
- [1] "Robot Programming by Demonstration: A Probabilistic Approach", Calinon, 2009, Chap 2.9.3
|
||||
"""
|
||||
pass
|
||||
|
||||
def init_kmeans(self, data, seed=None):
|
||||
r"""
|
||||
Initialize the GMM using K-means algorithm.
|
||||
|
||||
Args:
|
||||
data (np.array[N,D]): data matrix
|
||||
seed (int, None): seed for random generator
|
||||
"""
|
||||
# initialize random generator
|
||||
np.random.seed(seed)
|
||||
|
||||
# fit the data using k-means
|
||||
km = KMeans(n_clusters=self.num_components)
|
||||
km.fit(data)
|
||||
|
||||
# uniform priors
|
||||
self._priors = np.ones(self.num_components) / self.num_components
|
||||
|
||||
# identity covariances
|
||||
covariances = np.array([np.identity(self.dim)] * self.num_components)
|
||||
|
||||
# means = position of the cluster centers
|
||||
means = km.cluster_centers_
|
||||
# 2. compute the covariance matrix (and add regularization term)
|
||||
trajs = trajs.reshape(-1, trajs.shape[-1]) # (N*dT, D)
|
||||
covariance = np.cov(trajs, rowvar=False) # (D, D)
|
||||
covariance += reg * np.identity(trajs.shape[-1])
|
||||
covariances.append(covariance)
|
||||
|
||||
# create gaussians
|
||||
self._gaussians = [Gaussian(mean=mu, covariance=cov) for mu, cov in zip(means, covariances)]
|
||||
|
||||
def init(self, data, method='k-means', seed=None, reg=1e-8):
|
||||
def init(self, data, method='k-means', seed=None, reg=1e-6, axis=0):
|
||||
r"""
|
||||
Initialize the GMM using the specified method
|
||||
|
||||
Args:
|
||||
data (np.array[N,D]): data matrix
|
||||
method (str, None): 'k-means', 'random', None. If None, it starts from where the Gaussians are placed.
|
||||
method (str, None): method to use to initialize the GMM, select between {'random', 'k-means', 'uniform',
|
||||
'sklearn', 'curvature', None}. If None, it starts from where the Gaussians are placed.
|
||||
seed (str): seed for random generator
|
||||
reg (float): regularization term (useful to not have singular covariance matrices)
|
||||
axis (int): if method axis specifying the dimension to distribute the Gaussians uniformly
|
||||
"""
|
||||
if method is None:
|
||||
return
|
||||
method = method.lower()
|
||||
if method == 'random':
|
||||
if method == 'random': # init the Gaussian randomly
|
||||
self.init_random(data, seed, reg=reg)
|
||||
elif method == 'k-means' or method == 'kmeans':
|
||||
elif method == 'k-means' or method == 'kmeans': # init the Gaussians using K-Means
|
||||
self.init_kmeans(data, seed)
|
||||
elif method[:7] == 'uniform':
|
||||
self.init_uniformly(data)
|
||||
elif method == 'sklearn' or method[:6] == 'scikit':
|
||||
self.init_sklearn(data)
|
||||
elif method == 'curvature':
|
||||
self.init_curvature(data)
|
||||
elif method[:4] == 'time' or method[:4] == 'warp':
|
||||
self.init_time_warping(data)
|
||||
elif method[:7] == 'uniform': # init the Gaussians uniformly
|
||||
self.init_uniformly(data, axis=axis)
|
||||
elif method == 'sklearn' or method[:6] == 'scikit': # init using sklearn
|
||||
self.init_sklearn(data, seed=seed, reg=reg)
|
||||
elif method == 'curvature': # init based on the curvature of the trajectories
|
||||
self.init_curvature(data, reg=reg, smooth_curvature=True)
|
||||
else:
|
||||
raise NotImplementedError("The given initialization method has not been implemented")
|
||||
|
||||
@@ -1493,10 +1795,10 @@ class GMM(object):
|
||||
raise ValueError("The given 'wrt' argument is not valid (see documentation)")
|
||||
|
||||
def grad_log_likelihood(self, x):
|
||||
pass
|
||||
raise NotImplementedError
|
||||
|
||||
def hessian(self, x, wrt='x'):
|
||||
pass
|
||||
raise NotImplementedError
|
||||
|
||||
def update(self, x):
|
||||
r"""
|
||||
@@ -1505,7 +1807,7 @@ class GMM(object):
|
||||
Args:
|
||||
x (np.array): data vector/matrix
|
||||
"""
|
||||
pass
|
||||
raise NotImplementedError
|
||||
|
||||
def approximate_by_single_gaussian(self):
|
||||
r"""
|
||||
@@ -1556,7 +1858,7 @@ class GMM(object):
|
||||
Returns:
|
||||
float: differential entropy
|
||||
"""
|
||||
pass
|
||||
raise NotImplementedError
|
||||
|
||||
def kl_divergence(self, other):
|
||||
r"""
|
||||
@@ -1575,7 +1877,26 @@ class GMM(object):
|
||||
Returns:
|
||||
float: the divergence between the 2 GMMs.
|
||||
"""
|
||||
pass
|
||||
raise NotImplementedError
|
||||
|
||||
def align_trajectories_with_dynamic_time_warping(self, data):
|
||||
r"""
|
||||
Align the trajectories using Dynamic Time Wrapping prior to learn a GMM [1]. This only works for sequential
|
||||
temporal and spatial data. The first dimension is assumed to be the time, and the other dimensions are assumed
|
||||
to be spatial data (x [,y [,z]]).
|
||||
|
||||
Warnings: this initialization only makes sense with trajectories.
|
||||
|
||||
Args:
|
||||
data (np.array[N,T,D], list of np.array[T,D]): trajectories to align.
|
||||
|
||||
Returns:
|
||||
np.array[N,D]: aligned data trajectories
|
||||
|
||||
References:
|
||||
- [1] "Robot Programming by Demonstration: A Probabilistic Approach", Calinon, 2009, Chap 2.9.3
|
||||
"""
|
||||
raise NotImplementedError
|
||||
|
||||
#############
|
||||
# Operators #
|
||||
@@ -1762,8 +2083,9 @@ if __name__ == "__main__":
|
||||
X = np.hstack((np.array([t] * N).reshape(-1, 1), y.reshape(-1, 1)))
|
||||
|
||||
# init GMM
|
||||
gmm.init(X, method='random') # method='k-means')
|
||||
plotGMM(gmm, title='GMM after K-Means')
|
||||
init_method = 'random' # 'k-means'
|
||||
gmm.init(X, method=init_method)
|
||||
plotGMM(gmm, title='GMM after ' + init_method.capitalize())
|
||||
plt.show()
|
||||
|
||||
# fit a GMM using EM
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
# This file describes the Hidden Markov Model
|
||||
|
||||
# TODO: implement this model
|
||||
|
||||
from gaussian import Gaussian
|
||||
from model import Model
|
||||
from hmmlearn.hmm import GaussianHMM
|
||||
|
||||
@@ -0,0 +1,79 @@
|
||||
--------------------------------------------------------------------------------
|
||||
Thank you for downloading "Low Poly Baseball Bat" by laurenceduffy
|
||||
Released under
|
||||
Creative Commons Attribution 3.0
|
||||
Downloaded from http://www.blendswap.com/blends/view/68818
|
||||
|
||||
The following is important licensing information, please keep this file for
|
||||
archival and future reference when working with the file. It's important that
|
||||
you know, understand and follow any requirements stated in this file regarding
|
||||
the usage of the materials included.
|
||||
|
||||
Some parts of this file are marked with [#], the corresponding numbered note is
|
||||
at the end of the file.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
################################################################################
|
||||
|
||||
VERY IMPORTANT LICENSE INFORMATION:
|
||||
|
||||
This blend has been released under
|
||||
Creative Commons Attribution 3.0
|
||||
|
||||
This means that you can use it for any purpose you see fit, even commercially,
|
||||
as long as you respect these requirements:
|
||||
|
||||
--You MUST give credit to laurenceduffy.
|
||||
|
||||
|
||||
################################################################################
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
ABOUT THE BLEND:
|
||||
|
||||
Ready for Blender 2.67
|
||||
Published on: 2013-06-21 17:06:49
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
HELP US MODERATE THIS BLEND:
|
||||
If you find anomalies in this blend or any of the contained files such as:
|
||||
|
||||
- Missing, unneeded or corrupted files.
|
||||
- Inaccurate/mismatching preview image on the site.
|
||||
- Illegal distribution of third party files.
|
||||
- Ripping from a game or other 3D repository.
|
||||
- Uncredited or incorrect use of other CC licensed works.
|
||||
- Some other troubling issues[1].
|
||||
|
||||
Please submit a report from http://www.blendswap.com/blends/view/68818
|
||||
by pressing the red button with the flag, including links and details that serve
|
||||
as evidence and can help us to solve any conflicts or issues derived from the
|
||||
contents of this file.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
Thank you for using Blend Swap!
|
||||
|
||||
Register to get tons of more blends! http://www.blendswap.com/register
|
||||
Share your own blends with the world from http://www.blendswap.com/blends/add
|
||||
|
||||
Get answers to your questions and doubts: http://www.blendswap.com/page/faq
|
||||
If the site doesn't work for you try here: http://www.blendswap.com/page/issues
|
||||
For questions please contact us: http://www.blendswap.com/contact
|
||||
Check out our Terms Of Use: http://www.blendswap.com/tou
|
||||
Report website bugs: http://www.blendswap.com/bugs
|
||||
|
||||
Consider getting an associate Membership to get some neat features and
|
||||
enhancements.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
NOTES:
|
||||
|
||||
[1] Please make sure your problem is not derived from a setting in Blender (like
|
||||
hidden layers or objects) before submitting a report under the "Other" category.
|
||||
Issues arising from this type of problem will be ignored.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
###################### END OF BLEND SWAP LICENSE.txt #####################
|
||||
@@ -0,0 +1,2 @@
|
||||
|
||||
Brian Delhaisse: Compared to the original, I rescaled and rotated the baseball bat and ball.
|
||||
@@ -0,0 +1,3 @@
|
||||
|
||||
- The license for the baseball bat is the `BLENDSWAP_LICENSE.txt` file.
|
||||
- The license for the baseball ball is the `LICENSE.html` file.
|
||||
@@ -0,0 +1 @@
|
||||
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <title>67352 - Baseball - Downloaded from Blend Swap</title> <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> <style> body {background: #f0f0f0; color: #666; max-width: 960px; width: 100%; margin: auto; font-family: sans-serif; } a {color: #f80; text-decoration: none; } a:hover {color: #f50; } a:active {color: #f00; } article {background: #fff; padding: 32px; margin: 16px; } footer {margin: 16px; padding: 32px; } </style></head><body> <article class="license"> <h1><a href="http://www.blendswap.com/blends/view/67352">Blend #67352: Baseball</a></h1><h3>Released under <a href="https://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0</a></h3><hr /><p>You are free to use this asset privately for any use you see fit. If you choose to distribute copies or modified versions of this asset you must do so under the following requirements:</p><ul><li>You must mention the author of this blend in your copies and derivative works.</li></ul><p>Failure to comply with these requirements, if any, is considered a severe violation of the License and the Blend Swap Terms of Use, Upload Rules and Code of Conduct.</p><hr /><h2>About "Baseball":</h2><ul><li>Blender: 2.66</li><li>Render Engine: Cycles</li><li>Uploaded on: 2013-03-29 15:13:48</li></ul><blockquote>Just a simple Baseball- model.Have fun and please visit my Homepage. </blockquote><hr /><h3>Help us moderate this file</h3><p>Blend Swap is a place to share and get awesome 3D work, if you think this blend falls into one of the following issues please file a report from <a href="http://www.blendswap.com/blends/view/67352">http://www.blendswap.com/blends/view/67352</a> by clicking on the <strong>Manage</strong> panel to the left of the blend and then on <strong>Report/Flag</strong>:</p><ul><li>The blend author didn't make this blend and posted it as their own.</li><li>The blend author is violating a Creative Commons License or copyright.</li><li>The blend is incomplete, work in progress, or has missing textures.</li><li>The blend contains simulation cache files and other unneeded media.</li><li>The preview image has nothing to do with the blend's contents.</li></ul><p>Your help allows the site to stay clear of broken and stolen work.</p><hr /><h4>Notes:</h4><ul><li>Do NOT report this blend if you dont' know how to use a feature on Blender, instead use the <a href="http://www.blendswap.com/questions">questions section</a> of the site.</li></ul> </article> <footer> Original file hosted by <a href="https://www.blendswap.com">Blend Swap, LLC</a>. </footer></body></html>
|
||||
@@ -0,0 +1,34 @@
|
||||
# Blender MTL File: 'Baseball_by_www_up3d_de.blend'
|
||||
# Material Count: 3
|
||||
|
||||
newmtl Leder_1
|
||||
Ns 96.078431
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd C:/Users/Thomas/Desktop/Loecher_Baseball.png
|
||||
|
||||
newmtl Leder_2
|
||||
Ns 96.078431
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
map_Kd C:/Users/Thomas/Desktop/Loecher_Baseball.png
|
||||
|
||||
newmtl Naht
|
||||
Ns 96.078431
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Kd 0.640000 0.640000 0.640000
|
||||
Ks 0.500000 0.500000 0.500000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.000000
|
||||
d 1.000000
|
||||
illum 2
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,11 @@
|
||||
# Blender MTL File: 'Model.blend'
|
||||
# Material Count: 1
|
||||
|
||||
newmtl None
|
||||
Ns 0
|
||||
Ka 0.000000 0.000000 0.000000
|
||||
Kd 0.8 0.8 0.8
|
||||
Ks 0.8 0.8 0.8
|
||||
d 1
|
||||
illum 2
|
||||
map_Kd texture.png
|
||||
@@ -0,0 +1,795 @@
|
||||
# Blender v2.76 (sub 0) OBJ File: 'Model.blend'
|
||||
# www.blender.org
|
||||
mtllib bat.mtl
|
||||
o Cube
|
||||
v 0.000000 0.482463 0.000000
|
||||
v 0.029346 -0.477576 0.000000
|
||||
v 0.000000 -0.484288 0.000000
|
||||
v -0.025729 0.478069 0.000000
|
||||
v 0.000000 -0.477576 -0.029346
|
||||
v 0.000000 0.478069 0.025729
|
||||
v 0.033082 -0.150510 0.000000
|
||||
v -0.039506 -0.292739 0.000000
|
||||
v 0.000000 -0.150510 -0.033082
|
||||
v 0.000000 -0.292739 0.039506
|
||||
v -0.021935 0.015198 0.000000
|
||||
v 0.013122 0.390803 0.000000
|
||||
v 0.015799 0.163839 0.000000
|
||||
v 0.000000 0.467383 -0.024576
|
||||
v 0.000000 -0.150510 0.033082
|
||||
v -0.033082 -0.150510 0.000000
|
||||
v 0.000000 0.163839 -0.015799
|
||||
v 0.000000 0.015198 0.021935
|
||||
v 0.000000 0.015198 -0.021935
|
||||
v -0.012978 0.295414 -0.000000
|
||||
v 0.021935 0.015198 0.000000
|
||||
v 0.000000 0.295414 0.012978
|
||||
v -0.015772 0.440747 0.000000
|
||||
v 0.000000 0.390803 -0.013122
|
||||
v 0.000000 0.440747 0.015772
|
||||
v 0.024576 0.467383 -0.000000
|
||||
v -0.024576 0.467383 -0.000000
|
||||
v 0.000000 0.467383 0.024576
|
||||
v 0.000000 0.478069 -0.025729
|
||||
v 0.025729 0.478069 0.000000
|
||||
v 0.039506 -0.411489 0.000000
|
||||
v 0.000000 -0.411489 -0.039506
|
||||
v -0.029346 -0.477576 0.000000
|
||||
v 0.000000 -0.477576 0.029346
|
||||
v 0.015772 0.440747 0.000000
|
||||
v -0.013122 0.390803 0.000000
|
||||
v 0.000000 0.440747 -0.015772
|
||||
v 0.000000 0.390803 0.013122
|
||||
v 0.012978 0.295414 -0.000000
|
||||
v 0.000000 0.295414 -0.012978
|
||||
v -0.015799 0.163839 0.000000
|
||||
v 0.000000 0.163839 0.015799
|
||||
v 0.000000 -0.292739 -0.039506
|
||||
v -0.039506 -0.411489 0.000000
|
||||
v 0.000000 -0.411489 0.039506
|
||||
v 0.039506 -0.292739 0.000000
|
||||
v 0.000000 0.481364 0.016017
|
||||
v 0.016017 0.481364 0.000000
|
||||
v 0.000000 0.481364 -0.016017
|
||||
v -0.016017 0.481364 0.000000
|
||||
v 0.022009 -0.477576 0.022009
|
||||
v 0.016930 -0.482610 0.000000
|
||||
v 0.019296 0.478069 -0.019296
|
||||
v 0.000000 -0.482610 0.016930
|
||||
v -0.016930 -0.482610 0.000000
|
||||
v 0.000000 -0.482610 -0.016930
|
||||
v -0.019296 0.478069 0.019296
|
||||
v -0.022009 -0.477576 -0.022009
|
||||
v 0.019296 0.478069 0.019296
|
||||
v 0.022009 -0.477576 -0.022009
|
||||
v -0.022009 -0.477576 0.022009
|
||||
v -0.019296 0.478069 -0.019296
|
||||
v 0.037900 -0.227494 0.000000
|
||||
v -0.037900 -0.227494 0.000000
|
||||
v 0.000000 -0.227494 -0.037900
|
||||
v 0.000000 -0.227494 0.037900
|
||||
v -0.024812 -0.150510 -0.024812
|
||||
v -0.024812 -0.150510 0.024812
|
||||
v 0.024812 -0.150510 -0.024812
|
||||
v 0.024812 -0.150510 0.024812
|
||||
v 0.011850 0.163839 -0.011850
|
||||
v -0.011850 0.163839 0.011850
|
||||
v 0.011850 0.163839 0.011850
|
||||
v -0.011850 0.163839 -0.011850
|
||||
v -0.012308 0.352155 0.000000
|
||||
v 0.000000 0.352155 0.012308
|
||||
v 0.012308 0.352155 0.000000
|
||||
v 0.000000 0.352155 -0.012308
|
||||
v -0.027084 -0.067656 0.000000
|
||||
v 0.000000 -0.067656 -0.027084
|
||||
v 0.000000 -0.067656 0.027084
|
||||
v 0.027084 -0.067656 0.000000
|
||||
v 0.000000 0.093785 -0.018039
|
||||
v 0.000000 0.093785 0.018039
|
||||
v -0.018039 0.093785 0.000000
|
||||
v 0.018039 0.093785 0.000000
|
||||
v -0.018519 0.457577 0.000000
|
||||
v 0.000000 0.457577 0.018519
|
||||
v 0.018519 0.457577 -0.000000
|
||||
v 0.000000 0.457577 -0.018519
|
||||
v 0.016451 0.015198 0.016451
|
||||
v -0.016451 0.015198 0.016451
|
||||
v -0.016451 0.015198 -0.016451
|
||||
v 0.016451 0.015198 -0.016451
|
||||
v 0.009842 0.390803 0.009842
|
||||
v -0.009842 0.390803 0.009842
|
||||
v -0.009842 0.390803 -0.009842
|
||||
v 0.009842 0.390803 -0.009842
|
||||
v 0.018432 0.467383 -0.018432
|
||||
v -0.018432 0.467383 0.018432
|
||||
v 0.018432 0.467383 0.018432
|
||||
v -0.018432 0.467383 -0.018432
|
||||
v -0.028719 0.473201 0.000000
|
||||
v 0.000000 0.473201 0.028719
|
||||
v 0.000000 0.473201 -0.028719
|
||||
v 0.028719 0.473201 -0.000000
|
||||
v 0.029629 -0.292739 0.029629
|
||||
v -0.029629 -0.292739 -0.029629
|
||||
v 0.029629 -0.292739 -0.029629
|
||||
v -0.029629 -0.292739 0.029629
|
||||
v 0.036966 -0.457699 0.000000
|
||||
v 0.000000 -0.457699 -0.036966
|
||||
v -0.036966 -0.457699 0.000000
|
||||
v 0.000000 -0.457699 0.036966
|
||||
v 0.011829 0.440747 0.011829
|
||||
v -0.011829 0.440747 0.011829
|
||||
v -0.011829 0.440747 -0.011829
|
||||
v 0.011829 0.440747 -0.011829
|
||||
v 0.014563 0.418090 0.000000
|
||||
v -0.014563 0.418090 0.000000
|
||||
v 0.000000 0.418090 -0.014563
|
||||
v 0.000000 0.418090 0.014563
|
||||
v 0.009733 0.295414 -0.009733
|
||||
v -0.009733 0.295414 0.009733
|
||||
v 0.009733 0.295414 0.009733
|
||||
v -0.009733 0.295414 -0.009733
|
||||
v 0.014389 0.229627 -0.000000
|
||||
v 0.000000 0.229627 -0.014389
|
||||
v -0.014389 0.229627 -0.000000
|
||||
v 0.000000 0.229627 0.014389
|
||||
v -0.029629 -0.411489 0.029629
|
||||
v -0.029629 -0.411489 -0.029629
|
||||
v 0.029629 -0.411489 0.029629
|
||||
v 0.029629 -0.411489 -0.029629
|
||||
v 0.000000 -0.352114 -0.039506
|
||||
v 0.000000 -0.352114 0.039506
|
||||
v -0.039506 -0.352114 0.000000
|
||||
v 0.039506 -0.352114 0.000000
|
||||
v -0.012836 0.480510 -0.012836
|
||||
v 0.012836 0.480510 -0.012836
|
||||
v 0.014046 -0.481305 -0.014046
|
||||
v -0.014046 -0.481305 -0.014046
|
||||
v -0.012836 0.480510 0.012836
|
||||
v 0.012836 0.480510 0.012836
|
||||
v 0.014046 -0.481305 0.014046
|
||||
v -0.014046 -0.481305 0.014046
|
||||
v 0.028425 -0.227494 0.028425
|
||||
v 0.028425 -0.227494 -0.028425
|
||||
v -0.028425 -0.227494 0.028425
|
||||
v -0.028425 -0.227494 -0.028425
|
||||
v -0.013529 0.093785 -0.013529
|
||||
v 0.013529 0.093785 0.013529
|
||||
v -0.013529 0.093785 0.013529
|
||||
v 0.013529 0.093785 -0.013529
|
||||
v 0.013889 0.457577 -0.013889
|
||||
v -0.013889 0.457577 0.013889
|
||||
v 0.013889 0.457577 0.013889
|
||||
v -0.013889 0.457577 -0.013889
|
||||
v -0.009231 0.352155 -0.009231
|
||||
v 0.009231 0.352155 0.009231
|
||||
v -0.009231 0.352155 0.009231
|
||||
v 0.009231 0.352155 -0.009231
|
||||
v 0.020313 -0.067656 0.020313
|
||||
v 0.020313 -0.067656 -0.020313
|
||||
v -0.020313 -0.067656 0.020313
|
||||
v -0.020313 -0.067656 -0.020313
|
||||
v 0.021540 0.473201 -0.021540
|
||||
v -0.021540 0.473201 0.021540
|
||||
v 0.021540 0.473201 0.021540
|
||||
v -0.021540 0.473201 -0.021540
|
||||
v 0.027724 -0.457699 0.027724
|
||||
v -0.027724 -0.457699 -0.027724
|
||||
v 0.027724 -0.457699 -0.027724
|
||||
v -0.027724 -0.457699 0.027724
|
||||
v 0.010922 0.418090 0.010922
|
||||
v -0.010922 0.418090 0.010922
|
||||
v -0.010922 0.418090 -0.010922
|
||||
v 0.010922 0.418090 -0.010922
|
||||
v 0.010791 0.229627 -0.010791
|
||||
v -0.010791 0.229627 0.010791
|
||||
v 0.010791 0.229627 0.010791
|
||||
v -0.010791 0.229627 -0.010791
|
||||
v -0.029629 -0.352114 0.029629
|
||||
v 0.029629 -0.352114 -0.029629
|
||||
v -0.029629 -0.352114 -0.029629
|
||||
v 0.029629 -0.352114 0.029629
|
||||
vt 0.537880 0.090458
|
||||
vt 0.519193 0.090458
|
||||
vt 0.519193 0.071770
|
||||
vt 0.537880 0.071770
|
||||
vt 0.556567 0.071770
|
||||
vt 0.556567 0.090458
|
||||
vt 0.556567 0.109145
|
||||
vt 0.537880 0.109145
|
||||
vt 0.519193 0.109145
|
||||
vt 0.743891 0.979250
|
||||
vt 0.743715 0.956751
|
||||
vt 0.781295 0.973160
|
||||
vt 0.771677 0.979047
|
||||
vt 0.762142 0.990647
|
||||
vt 0.743975 0.990780
|
||||
vt 0.725808 0.990912
|
||||
vt 0.716104 0.979453
|
||||
vt 0.706400 0.973723
|
||||
vt 0.524365 0.938473
|
||||
vt 0.543068 0.938473
|
||||
vt 0.543068 0.957175
|
||||
vt 0.524365 0.957175
|
||||
vt 0.505662 0.957175
|
||||
vt 0.505662 0.938473
|
||||
vt 0.505662 0.919770
|
||||
vt 0.524365 0.919770
|
||||
vt 0.543068 0.919770
|
||||
vt 0.611142 0.074690
|
||||
vt 0.619149 0.078966
|
||||
vt 0.604296 0.104612
|
||||
vt 0.598435 0.097552
|
||||
vt 0.594660 0.087826
|
||||
vt 0.604128 0.070791
|
||||
vt 0.613596 0.053756
|
||||
vt 0.623849 0.051827
|
||||
vt 0.632415 0.047374
|
||||
vt 0.668910 0.979252
|
||||
vt 0.641123 0.979051
|
||||
vt 0.631505 0.973164
|
||||
vt 0.669084 0.956754
|
||||
vt 0.696696 0.979453
|
||||
vt 0.686993 0.990913
|
||||
vt 0.668826 0.990781
|
||||
vt 0.650660 0.990649
|
||||
vt 0.801639 0.074705
|
||||
vt 0.814342 0.097570
|
||||
vt 0.808480 0.104628
|
||||
vt 0.793632 0.078981
|
||||
vt 0.780372 0.047386
|
||||
vt 0.788937 0.051841
|
||||
vt 0.799189 0.053772
|
||||
vt 0.808654 0.070808
|
||||
vt 0.818119 0.087844
|
||||
vt 0.736191 0.675171
|
||||
vt 0.731779 0.598144
|
||||
vt 0.757167 0.596173
|
||||
vt 0.766177 0.673009
|
||||
vt 0.773541 0.743315
|
||||
vt 0.739804 0.745338
|
||||
vt 0.706393 0.746092
|
||||
vt 0.706390 0.675924
|
||||
vt 0.706388 0.598777
|
||||
vt 0.599268 0.800309
|
||||
vt 0.596975 0.855273
|
||||
vt 0.560226 0.853652
|
||||
vt 0.562886 0.797729
|
||||
vt 0.570136 0.736701
|
||||
vt 0.604853 0.740268
|
||||
vt 0.639243 0.743320
|
||||
vt 0.635398 0.802522
|
||||
vt 0.633620 0.856650
|
||||
vt 0.676589 0.675173
|
||||
vt 0.646603 0.673013
|
||||
vt 0.655608 0.596176
|
||||
vt 0.680996 0.598145
|
||||
vt 0.672981 0.745340
|
||||
vt 0.813520 0.800302
|
||||
vt 0.849902 0.797719
|
||||
vt 0.852566 0.853642
|
||||
vt 0.815818 0.855266
|
||||
vt 0.779172 0.856645
|
||||
vt 0.777391 0.802517
|
||||
vt 0.807932 0.740261
|
||||
vt 0.842649 0.736691
|
||||
vt 0.643577 0.514722
|
||||
vt 0.630227 0.592797
|
||||
vt 0.604848 0.588714
|
||||
vt 0.622834 0.511493
|
||||
vt 0.637382 0.437900
|
||||
vt 0.654499 0.440044
|
||||
vt 0.671682 0.441813
|
||||
vt 0.664392 0.517381
|
||||
vt 0.720207 0.151456
|
||||
vt 0.723125 0.120337
|
||||
vt 0.738999 0.124524
|
||||
vt 0.733664 0.153378
|
||||
vt 0.731067 0.192139
|
||||
vt 0.718809 0.191345
|
||||
vt 0.706384 0.191049
|
||||
vt 0.706386 0.150759
|
||||
vt 0.706388 0.118651
|
||||
vt 0.721486 0.375339
|
||||
vt 0.720057 0.311811
|
||||
vt 0.733721 0.311447
|
||||
vt 0.736559 0.374656
|
||||
vt 0.741084 0.441811
|
||||
vt 0.723767 0.442832
|
||||
vt 0.706383 0.443155
|
||||
vt 0.706382 0.375561
|
||||
vt 0.706382 0.311930
|
||||
vt 0.675176 0.047568
|
||||
vt 0.648058 0.063722
|
||||
vt 0.670521 0.035328
|
||||
vt 0.706396 0.015666
|
||||
vt 0.706394 0.040522
|
||||
vt 0.706392 0.059144
|
||||
vt 0.680157 0.064951
|
||||
vt 0.656992 0.077745
|
||||
vt 0.796535 0.669532
|
||||
vt 0.827077 0.665398
|
||||
vt 0.782548 0.592792
|
||||
vt 0.807927 0.588707
|
||||
vt 0.616245 0.669538
|
||||
vt 0.585702 0.665406
|
||||
vt 0.691278 0.375340
|
||||
vt 0.676205 0.374657
|
||||
vt 0.679042 0.311446
|
||||
vt 0.692707 0.311811
|
||||
vt 0.688999 0.442833
|
||||
vt 0.769193 0.514719
|
||||
vt 0.789936 0.511488
|
||||
vt 0.748378 0.517379
|
||||
vt 0.758268 0.440042
|
||||
vt 0.775384 0.437897
|
||||
vt 0.685353 0.518900
|
||||
vt 0.706385 0.519374
|
||||
vt 0.668853 0.247803
|
||||
vt 0.665399 0.310829
|
||||
vt 0.651767 0.310084
|
||||
vt 0.656483 0.247892
|
||||
vt 0.658014 0.194743
|
||||
vt 0.669774 0.193338
|
||||
vt 0.681700 0.192137
|
||||
vt 0.681276 0.247717
|
||||
vt 0.727418 0.518899
|
||||
vt 0.743911 0.247805
|
||||
vt 0.756281 0.247894
|
||||
vt 0.760996 0.310084
|
||||
vt 0.747364 0.310829
|
||||
vt 0.731489 0.247718
|
||||
vt 0.742993 0.193341
|
||||
vt 0.754752 0.194747
|
||||
vt 0.650478 0.108760
|
||||
vt 0.659628 0.130333
|
||||
vt 0.646342 0.136963
|
||||
vt 0.636849 0.119757
|
||||
vt 0.626017 0.109223
|
||||
vt 0.639969 0.092895
|
||||
vt 0.665985 0.098660
|
||||
vt 0.673776 0.124519
|
||||
vt 0.692564 0.151454
|
||||
vt 0.679107 0.153375
|
||||
vt 0.689650 0.120335
|
||||
vt 0.693959 0.191344
|
||||
vt 0.762299 0.108769
|
||||
vt 0.775925 0.119768
|
||||
vt 0.766429 0.136971
|
||||
vt 0.753146 0.130340
|
||||
vt 0.746794 0.098666
|
||||
vt 0.755789 0.077753
|
||||
vt 0.772809 0.092906
|
||||
vt 0.786759 0.109235
|
||||
vt 0.737611 0.047573
|
||||
vt 0.742268 0.035334
|
||||
vt 0.764726 0.063732
|
||||
vt 0.732627 0.064955
|
||||
vt 0.629143 0.083999
|
||||
vt 0.614328 0.106338
|
||||
vt 0.783638 0.084012
|
||||
vt 0.798448 0.106353
|
||||
vt 0.666409 0.025357
|
||||
vt 0.637605 0.037871
|
||||
vt 0.641108 0.025844
|
||||
vt 0.662570 0.016519
|
||||
vt 0.684032 0.007195
|
||||
vt 0.695214 0.012842
|
||||
vt 0.746381 0.025363
|
||||
vt 0.750222 0.016527
|
||||
vt 0.771683 0.025855
|
||||
vt 0.775183 0.037883
|
||||
vt 0.717578 0.012844
|
||||
vt 0.728761 0.007198
|
||||
vt 0.743356 0.912316
|
||||
vt 0.742733 0.857535
|
||||
vt 0.780330 0.911728
|
||||
vt 0.706398 0.912517
|
||||
vt 0.706396 0.857857
|
||||
vt 0.669441 0.912318
|
||||
vt 0.632466 0.911732
|
||||
vt 0.670060 0.857537
|
||||
vt 0.594044 0.978027
|
||||
vt 0.593764 0.989513
|
||||
vt 0.575667 0.989071
|
||||
vt 0.566364 0.977352
|
||||
vt 0.559729 0.954561
|
||||
vt 0.594537 0.955471
|
||||
vt 0.621724 0.978703
|
||||
vt 0.611860 0.989955
|
||||
vt 0.818757 0.978020
|
||||
vt 0.846437 0.977343
|
||||
vt 0.837135 0.989063
|
||||
vt 0.819038 0.989506
|
||||
vt 0.800941 0.989949
|
||||
vt 0.791077 0.978698
|
||||
vt 0.818262 0.955464
|
||||
vt 0.853070 0.954552
|
||||
vt 0.727531 0.090357
|
||||
vt 0.706390 0.086650
|
||||
vt 0.666379 0.156354
|
||||
vt 0.654016 0.159862
|
||||
vt 0.685248 0.090354
|
||||
vt 0.746391 0.156359
|
||||
vt 0.758753 0.159868
|
||||
vt 0.718962 0.247638
|
||||
vt 0.706382 0.247600
|
||||
vt 0.693803 0.247638
|
||||
vt 0.661194 0.373494
|
||||
vt 0.646213 0.372092
|
||||
vt 0.751570 0.373493
|
||||
vt 0.766550 0.372091
|
||||
vt 0.671022 0.804003
|
||||
vt 0.706395 0.804559
|
||||
vt 0.595456 0.910774
|
||||
vt 0.558429 0.909629
|
||||
vt 0.817340 0.910767
|
||||
vt 0.854368 0.909619
|
||||
vt 0.741767 0.804000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
vn -0.201400 0.979500 0.000000
|
||||
vn -0.162300 0.973300 0.162300
|
||||
vn 0.000000 0.979500 0.201400
|
||||
vn 0.162300 0.973300 0.162300
|
||||
vn 0.201400 0.979500 0.000000
|
||||
vn 0.162300 0.973300 -0.162300
|
||||
vn 0.000000 0.979500 -0.201400
|
||||
vn -0.162300 0.973300 -0.162300
|
||||
vn 0.741800 -0.670600 0.000000
|
||||
vn 0.979200 -0.202800 0.000000
|
||||
vn 0.691200 -0.211000 0.691200
|
||||
vn 0.527800 -0.665300 0.527800
|
||||
vn 0.200000 -0.959100 0.200000
|
||||
vn 0.243400 -0.969900 0.000000
|
||||
vn 0.200000 -0.959100 -0.200000
|
||||
vn 0.527800 -0.665300 -0.527800
|
||||
vn 0.691200 -0.211000 -0.691200
|
||||
vn 0.000000 -1.000000 0.000000
|
||||
vn 0.000000 -0.969900 0.243400
|
||||
vn -0.200000 -0.959100 0.200000
|
||||
vn -0.243400 -0.969900 0.000000
|
||||
vn -0.200000 -0.959100 -0.200000
|
||||
vn 0.000000 -0.969900 -0.243400
|
||||
vn -0.653400 0.757000 0.000000
|
||||
vn -0.999500 -0.030700 0.000000
|
||||
vn -0.706800 -0.030100 0.706800
|
||||
vn -0.464200 0.754300 0.464200
|
||||
vn -0.464200 0.754300 -0.464200
|
||||
vn -0.706800 -0.030100 -0.706800
|
||||
vn 0.000000 -0.670600 -0.741800
|
||||
vn -0.527800 -0.665300 -0.527800
|
||||
vn -0.691200 -0.211000 -0.691200
|
||||
vn 0.000000 -0.202800 -0.979200
|
||||
vn 0.000000 0.757000 0.653400
|
||||
vn 0.000000 -0.030700 0.999500
|
||||
vn 0.706800 -0.030100 0.706800
|
||||
vn 0.464200 0.754300 0.464200
|
||||
vn 0.997700 0.067300 0.000000
|
||||
vn 0.997700 0.067200 0.000000
|
||||
vn 0.705300 0.071300 0.705300
|
||||
vn 0.706400 0.045900 0.706400
|
||||
vn 0.999100 0.043400 0.000000
|
||||
vn 0.706400 0.045900 -0.706400
|
||||
vn 0.705300 0.071300 -0.705300
|
||||
vn -0.999900 0.012300 0.000000
|
||||
vn -1.000000 0.000000 0.000000
|
||||
vn -0.707100 0.000000 0.707100
|
||||
vn -0.707000 0.013000 0.707000
|
||||
vn -0.706400 0.045900 0.706400
|
||||
vn -0.999100 0.043400 0.000000
|
||||
vn -0.706400 0.045900 -0.706400
|
||||
vn -0.707000 0.013000 -0.707000
|
||||
vn -0.707100 0.000000 -0.707100
|
||||
vn 0.000000 0.067300 -0.997700
|
||||
vn -0.705300 0.071300 -0.705300
|
||||
vn 0.000000 0.067200 -0.997700
|
||||
vn 0.000000 0.043400 -0.999100
|
||||
vn 0.000000 0.012300 0.999900
|
||||
vn 0.000000 0.000000 1.000000
|
||||
vn 0.707100 0.000000 0.707100
|
||||
vn 0.707000 0.013000 0.707000
|
||||
vn 0.000000 0.043400 0.999100
|
||||
vn -0.998400 0.055800 0.000000
|
||||
vn -0.997700 0.067200 0.000000
|
||||
vn -0.705300 0.071300 0.705300
|
||||
vn -0.705900 0.059200 0.705900
|
||||
vn -0.706400 0.043300 0.706400
|
||||
vn -0.999100 0.040800 0.000000
|
||||
vn -0.706400 0.043300 -0.706400
|
||||
vn -0.705900 0.059200 -0.705900
|
||||
vn 0.999300 -0.037000 0.000000
|
||||
vn 0.998600 -0.053000 0.000000
|
||||
vn 0.706000 -0.056200 0.706000
|
||||
vn 0.706500 -0.039300 0.706500
|
||||
vn 0.707100 -0.004900 0.707100
|
||||
vn 1.000000 -0.004600 0.000000
|
||||
vn 0.707100 -0.004900 -0.707100
|
||||
vn 0.706500 -0.039300 -0.706500
|
||||
vn 0.706000 -0.056200 -0.706000
|
||||
vn 0.999600 0.026700 0.000000
|
||||
vn 0.999800 0.021400 0.000000
|
||||
vn 0.706900 0.022700 0.706900
|
||||
vn 0.706800 0.028400 0.706800
|
||||
vn 0.706400 0.043300 0.706400
|
||||
vn 0.999100 0.040800 0.000000
|
||||
vn 0.706400 0.043300 -0.706400
|
||||
vn 0.706800 0.028400 -0.706800
|
||||
vn 0.706900 0.022700 -0.706900
|
||||
vn 0.000000 -0.556200 -0.831000
|
||||
vn -0.575900 -0.580300 -0.575900
|
||||
vn 0.000000 -0.030700 -0.999500
|
||||
vn 0.706800 -0.030100 -0.706800
|
||||
vn 0.575900 -0.580300 -0.575900
|
||||
vn 0.651600 -0.388300 -0.651600
|
||||
vn 0.000000 -0.363500 -0.931500
|
||||
vn -0.651600 -0.388300 -0.651600
|
||||
vn 0.000000 0.067300 0.997700
|
||||
vn 0.000000 0.067200 0.997700
|
||||
vn -0.997700 0.067300 0.000000
|
||||
vn 0.000000 0.026700 -0.999600
|
||||
vn -0.706800 0.028400 -0.706800
|
||||
vn -0.706900 0.022700 -0.706900
|
||||
vn 0.000000 0.021400 -0.999800
|
||||
vn 0.000000 0.040800 -0.999100
|
||||
vn 0.000000 0.055800 0.998400
|
||||
vn 0.705900 0.059200 0.705900
|
||||
vn 0.000000 0.040800 0.999100
|
||||
vn 0.000000 0.055800 -0.998400
|
||||
vn 0.705900 0.059200 -0.705900
|
||||
vn -0.999800 0.016600 0.000000
|
||||
vn -0.999800 0.021400 0.000000
|
||||
vn -0.706900 0.022700 0.706900
|
||||
vn -0.707000 0.017600 0.707000
|
||||
vn -0.707100 -0.004900 0.707100
|
||||
vn -1.000000 -0.004600 0.000000
|
||||
vn -0.707100 -0.004900 -0.707100
|
||||
vn -0.707000 0.017600 -0.707000
|
||||
vn 0.998400 0.055800 0.000000
|
||||
vn 0.000000 0.016600 0.999800
|
||||
vn 0.000000 0.021400 0.999800
|
||||
vn 0.707000 0.017600 0.707000
|
||||
vn 0.000000 -0.004600 1.000000
|
||||
vn -0.994100 -0.108500 0.000000
|
||||
vn -0.998600 -0.053000 0.000000
|
||||
vn -0.706000 -0.056200 0.706000
|
||||
vn -0.702400 -0.115600 0.702400
|
||||
vn -0.651600 -0.388300 0.651600
|
||||
vn -0.931500 -0.363500 0.000000
|
||||
vn -0.702400 -0.115600 -0.702400
|
||||
vn -0.706000 -0.056200 -0.706000
|
||||
vn 0.000000 -0.037000 -0.999300
|
||||
vn -0.706500 -0.039300 -0.706500
|
||||
vn 0.000000 -0.053000 -0.998600
|
||||
vn 0.000000 -0.004600 -1.000000
|
||||
vn 0.000000 -0.108500 0.994100
|
||||
vn 0.000000 -0.053000 0.998600
|
||||
vn 0.702400 -0.115600 0.702400
|
||||
vn 0.651600 -0.388300 0.651600
|
||||
vn 0.000000 -0.363500 0.931500
|
||||
vn 0.831000 -0.556200 0.000000
|
||||
vn 0.999500 -0.030700 0.000000
|
||||
vn 0.575900 -0.580300 0.575900
|
||||
vn 0.931500 -0.363500 0.000000
|
||||
vn -0.831000 -0.556200 0.000000
|
||||
vn -0.575900 -0.580300 0.575900
|
||||
vn 0.000000 -0.556200 0.831000
|
||||
vn 0.000000 0.757000 -0.653400
|
||||
vn 0.464200 0.754300 -0.464200
|
||||
vn 0.653400 0.757000 0.000000
|
||||
vn 0.999600 -0.027300 0.000000
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn 0.706800 -0.028900 0.706800
|
||||
vn 0.706800 -0.028900 -0.706800
|
||||
vn 0.707100 0.000000 -0.707100
|
||||
vn 0.000000 -0.027300 -0.999600
|
||||
vn -0.706800 -0.028900 -0.706800
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
vn -0.741800 -0.670600 0.000000
|
||||
vn -0.527800 -0.665300 0.527800
|
||||
vn -0.691200 -0.211000 0.691200
|
||||
vn -0.979200 -0.202800 0.000000
|
||||
vn 0.000000 -0.670600 0.741800
|
||||
vn 0.000000 -0.202800 0.979200
|
||||
vn 0.994100 -0.108500 0.000000
|
||||
vn 0.702400 -0.115600 -0.702400
|
||||
vn -0.999300 -0.037000 0.000000
|
||||
vn -0.706500 -0.039300 0.706500
|
||||
vn 0.000000 -0.108500 -0.994100
|
||||
vn 0.000000 -0.037000 0.999300
|
||||
vn 0.999800 0.016600 0.000000
|
||||
vn 0.707000 0.017600 -0.707000
|
||||
vn 0.000000 0.016600 -0.999800
|
||||
vn -0.999600 0.026700 0.000000
|
||||
vn -0.706800 0.028400 0.706800
|
||||
vn 0.000000 0.026700 0.999600
|
||||
vn 0.000000 0.012300 -0.999900
|
||||
vn 0.707000 0.013000 -0.707000
|
||||
vn -0.999600 -0.027300 0.000000
|
||||
vn -0.706800 -0.028900 0.706800
|
||||
vn 0.000000 -0.027300 0.999600
|
||||
vn 0.999900 0.012300 0.000000
|
||||
usemtl None
|
||||
s 1
|
||||
f 1/1/1 50/2/2 143/3/3 47/4/4
|
||||
f 1/1/1 47/4/4 144/5/5 48/6/6
|
||||
f 1/1/1 48/6/6 140/7/7 49/8/8
|
||||
f 1/1/1 49/8/8 139/9/9 50/2/2
|
||||
f 2/10/10 111/11/11 171/12/12 51/13/13
|
||||
f 2/10/10 51/13/13 145/14/14 52/15/15
|
||||
f 2/10/10 52/15/15 141/16/16 60/17/17
|
||||
f 2/10/10 60/17/17 173/18/18 111/11/11
|
||||
f 3/19/19 52/20/15 145/21/14 54/22/20
|
||||
f 3/19/19 54/22/20 146/23/21 55/24/22
|
||||
f 3/19/19 55/24/22 142/25/23 56/26/24
|
||||
f 3/19/19 56/26/24 141/27/16 52/20/15
|
||||
f 4/28/25 103/29/26 168/30/27 57/31/28
|
||||
f 4/28/25 57/31/28 143/32/3 50/33/2
|
||||
f 4/28/25 50/33/2 139/34/9 62/35/29
|
||||
f 4/28/25 62/35/29 170/36/30 103/29/26
|
||||
f 5/37/31 58/38/32 172/39/33 112/40/34
|
||||
f 5/37/31 112/40/34 173/18/18 60/41/17
|
||||
f 5/37/31 60/41/17 141/42/16 56/43/24
|
||||
f 5/37/31 56/43/24 142/44/23 58/38/32
|
||||
f 6/45/35 57/46/28 168/47/27 104/48/36
|
||||
f 6/45/35 104/48/36 169/49/37 59/50/38
|
||||
f 6/45/35 59/50/38 144/51/5 47/52/4
|
||||
f 6/45/35 47/52/4 143/53/3 57/46/28
|
||||
f 7/54/39 82/55/40 163/56/41 70/57/41
|
||||
f 7/54/39 70/57/41 147/58/42 63/59/43
|
||||
f 7/54/39 63/59/43 148/60/44 69/61/45
|
||||
f 7/54/39 69/61/45 164/62/45 82/55/40
|
||||
f 8/63/46 137/64/47 183/65/48 110/66/49
|
||||
f 8/63/46 110/66/49 149/67/50 64/68/51
|
||||
f 8/63/46 64/68/51 150/69/52 108/70/53
|
||||
f 8/63/46 108/70/53 185/71/54 137/64/47
|
||||
f 9/72/55 67/73/56 166/74/56 80/75/57
|
||||
f 9/72/55 80/75/57 164/62/45 69/61/45
|
||||
f 9/72/55 69/61/45 148/60/44 65/76/58
|
||||
f 9/72/55 65/76/58 150/69/52 67/73/56
|
||||
f 10/77/59 110/78/49 183/79/48 136/80/60
|
||||
f 10/77/59 136/80/60 186/81/61 107/82/62
|
||||
f 10/77/59 107/82/62 147/58/42 66/83/63
|
||||
f 10/77/59 66/83/63 149/84/50 110/78/49
|
||||
f 11/85/64 79/86/65 165/87/66 92/88/67
|
||||
f 11/85/64 92/88/67 153/89/68 85/90/69
|
||||
f 11/85/64 85/90/69 151/91/70 93/92/71
|
||||
f 11/85/64 93/92/71 166/74/56 79/86/65
|
||||
f 12/93/72 119/94/73 175/95/74 95/96/75
|
||||
f 12/93/72 95/96/75 160/97/76 77/98/77
|
||||
f 12/93/72 77/98/77 162/99/78 98/100/79
|
||||
f 12/93/72 98/100/79 178/101/80 119/94/73
|
||||
f 13/102/81 127/103/82 181/104/83 73/105/84
|
||||
f 13/102/81 73/105/84 152/106/85 86/107/86
|
||||
f 13/102/81 86/107/86 154/108/87 71/109/88
|
||||
f 13/102/81 71/109/88 179/110/89 127/103/82
|
||||
f 14/111/90 102/112/91 170/36/30 105/113/92
|
||||
f 14/111/90 105/113/92 167/114/93 99/115/94
|
||||
f 14/111/90 99/115/94 155/116/95 90/117/96
|
||||
f 14/111/90 90/117/96 158/118/97 102/112/91
|
||||
f 15/119/98 68/120/66 149/84/50 66/83/63
|
||||
f 15/119/98 66/83/63 147/58/42 70/57/41
|
||||
f 15/119/98 70/57/41 163/56/41 81/121/99
|
||||
f 15/119/98 81/121/99 165/122/66 68/120/66
|
||||
f 16/123/100 64/68/51 149/67/50 68/124/66
|
||||
f 16/123/100 68/124/66 165/87/66 79/86/65
|
||||
f 16/123/100 79/86/65 166/74/56 67/73/56
|
||||
f 16/123/100 67/73/56 150/69/52 64/68/51
|
||||
f 17/125/101 74/126/102 182/127/103 128/128/104
|
||||
f 17/125/101 128/128/104 179/110/89 71/109/88
|
||||
f 17/125/101 71/109/88 154/108/87 83/129/105
|
||||
f 17/125/101 83/129/105 151/91/70 74/126/102
|
||||
f 18/130/106 92/131/67 165/122/66 81/121/99
|
||||
f 18/130/106 81/121/99 163/56/41 91/132/107
|
||||
f 18/130/106 91/132/107 152/106/85 84/133/108
|
||||
f 18/130/106 84/133/108 153/134/68 92/131/67
|
||||
f 19/135/109 93/92/71 151/91/70 83/129/105
|
||||
f 19/135/109 83/129/105 154/108/87 94/136/110
|
||||
f 19/135/109 94/136/110 164/62/45 80/75/57
|
||||
f 19/135/109 80/75/57 166/74/56 93/92/71
|
||||
f 20/137/111 129/138/112 180/139/113 124/140/114
|
||||
f 20/137/111 124/140/114 161/141/115 75/142/116
|
||||
f 20/137/111 75/142/116 159/143/117 126/144/118
|
||||
f 20/137/111 126/144/118 182/127/103 129/138/112
|
||||
f 21/145/119 86/107/86 152/106/85 91/132/107
|
||||
f 21/145/119 91/132/107 163/56/41 82/55/40
|
||||
f 21/145/119 82/55/40 164/62/45 94/136/110
|
||||
f 21/145/119 94/136/110 154/108/87 86/107/86
|
||||
f 22/146/120 124/147/114 180/148/113 130/149/121
|
||||
f 22/146/120 130/149/121 181/104/83 125/150/122
|
||||
f 22/146/120 125/150/122 160/97/76 76/151/123
|
||||
f 22/146/120 76/151/123 161/152/115 124/147/114
|
||||
f 23/153/124 120/154/125 176/155/126 116/156/127
|
||||
f 23/153/124 116/156/127 156/157/128 87/158/129
|
||||
f 23/153/124 87/158/129 158/118/97 117/159/130
|
||||
f 23/153/124 117/159/130 177/160/131 120/154/125
|
||||
f 24/161/132 97/162/133 177/160/131 121/163/134
|
||||
f 24/161/132 121/163/134 178/101/80 98/100/79
|
||||
f 24/161/132 98/100/79 162/99/78 78/164/135
|
||||
f 24/161/132 78/164/135 159/143/117 97/162/133
|
||||
f 25/165/136 116/166/127 176/167/126 122/168/137
|
||||
f 25/165/136 122/168/137 175/95/74 115/169/138
|
||||
f 25/165/136 115/169/138 157/170/139 88/171/140
|
||||
f 25/165/136 88/171/140 156/172/128 116/166/127
|
||||
f 26/173/141 106/174/142 169/49/37 101/175/143
|
||||
f 26/173/141 101/175/143 157/170/139 89/176/144
|
||||
f 26/173/141 89/176/144 155/116/95 99/115/94
|
||||
f 26/173/141 99/115/94 167/114/93 106/174/142
|
||||
f 27/177/145 87/158/129 156/157/128 100/178/146
|
||||
f 27/177/145 100/178/146 168/30/27 103/29/26
|
||||
f 27/177/145 103/29/26 170/36/30 102/112/91
|
||||
f 27/177/145 102/112/91 158/118/97 87/158/129
|
||||
f 28/179/147 100/180/146 156/172/128 88/171/140
|
||||
f 28/179/147 88/171/140 157/170/139 101/175/143
|
||||
f 28/179/147 101/175/143 169/49/37 104/48/36
|
||||
f 28/179/147 104/48/36 168/47/27 100/180/146
|
||||
f 29/181/148 62/182/29 139/183/9 49/184/8
|
||||
f 29/181/148 49/184/8 140/185/7 53/186/149
|
||||
f 29/181/148 53/186/149 167/114/93 105/113/92
|
||||
f 29/181/148 105/113/92 170/36/30 62/182/29
|
||||
f 30/187/150 48/188/6 144/189/5 59/190/38
|
||||
f 30/187/150 59/190/38 169/49/37 106/174/142
|
||||
f 30/187/150 106/174/142 167/114/93 53/191/149
|
||||
f 30/187/150 53/191/149 140/192/7 48/188/6
|
||||
f 31/193/151 138/194/152 186/81/61 133/195/153
|
||||
f 31/193/151 133/195/153 171/12/12 111/11/11
|
||||
f 31/193/151 111/11/11 173/18/18 134/196/154
|
||||
f 31/193/151 134/196/154 184/197/155 138/194/152
|
||||
f 32/198/156 132/199/157 185/71/54 135/200/158
|
||||
f 32/198/156 135/200/158 184/197/155 134/196/154
|
||||
f 32/198/156 134/196/154 173/18/18 112/40/34
|
||||
f 32/198/156 112/40/34 172/39/33 132/199/157
|
||||
f 33/201/159 55/202/22 146/203/21 61/204/160
|
||||
f 33/201/159 61/204/160 174/205/161 113/206/162
|
||||
f 33/201/159 113/206/162 172/39/33 58/207/32
|
||||
f 33/201/159 58/207/32 142/208/23 55/202/22
|
||||
f 34/209/163 61/210/160 146/211/21 54/212/20
|
||||
f 34/209/163 54/212/20 145/213/14 51/214/13
|
||||
f 34/209/163 51/214/13 171/12/12 114/215/164
|
||||
f 34/209/163 114/215/164 174/216/161 61/210/160
|
||||
f 35/217/165 89/176/144 157/170/139 115/169/138
|
||||
f 35/217/165 115/169/138 175/95/74 119/94/73
|
||||
f 35/217/165 119/94/73 178/101/80 118/218/166
|
||||
f 35/217/165 118/218/166 155/116/95 89/176/144
|
||||
f 36/219/167 75/142/116 161/141/115 96/220/168
|
||||
f 36/219/167 96/220/168 176/155/126 120/154/125
|
||||
f 36/219/167 120/154/125 177/160/131 97/162/133
|
||||
f 36/219/167 97/162/133 159/143/117 75/142/116
|
||||
f 37/221/169 117/159/130 158/118/97 90/117/96
|
||||
f 37/221/169 90/117/96 155/116/95 118/218/166
|
||||
f 37/221/169 118/218/166 178/101/80 121/163/134
|
||||
f 37/221/169 121/163/134 177/160/131 117/159/130
|
||||
f 38/222/170 96/223/168 161/152/115 76/151/123
|
||||
f 38/222/170 76/151/123 160/97/76 95/96/75
|
||||
f 38/222/170 95/96/75 175/95/74 122/168/137
|
||||
f 38/222/170 122/168/137 176/167/126 96/223/168
|
||||
f 39/224/171 77/98/77 160/97/76 125/150/122
|
||||
f 39/224/171 125/150/122 181/104/83 127/103/82
|
||||
f 39/224/171 127/103/82 179/110/89 123/225/172
|
||||
f 39/224/171 123/225/172 162/99/78 77/98/77
|
||||
f 40/226/173 126/144/118 159/143/117 78/164/135
|
||||
f 40/226/173 78/164/135 162/99/78 123/225/172
|
||||
f 40/226/173 123/225/172 179/110/89 128/128/104
|
||||
f 40/226/173 128/128/104 182/127/103 126/144/118
|
||||
f 41/227/174 85/90/69 153/89/68 72/228/175
|
||||
f 41/227/174 72/228/175 180/139/113 129/138/112
|
||||
f 41/227/174 129/138/112 182/127/103 74/126/102
|
||||
f 41/227/174 74/126/102 151/91/70 85/90/69
|
||||
f 42/229/176 72/230/175 153/134/68 84/133/108
|
||||
f 42/229/176 84/133/108 152/106/85 73/105/84
|
||||
f 42/229/176 73/105/84 181/104/83 130/149/121
|
||||
f 42/229/176 130/149/121 180/148/113 72/230/175
|
||||
f 43/231/177 108/70/53 150/69/52 65/76/58
|
||||
f 43/231/177 65/76/58 148/60/44 109/232/178
|
||||
f 43/231/177 109/232/178 184/197/155 135/200/158
|
||||
f 43/231/177 135/200/158 185/71/54 108/70/53
|
||||
f 44/233/179 113/206/162 174/205/161 131/234/180
|
||||
f 44/233/179 131/234/180 183/65/48 137/64/47
|
||||
f 44/233/179 137/64/47 185/71/54 132/199/157
|
||||
f 44/233/179 132/199/157 172/39/33 113/206/162
|
||||
f 45/235/181 131/236/180 174/216/161 114/215/164
|
||||
f 45/235/181 114/215/164 171/12/12 133/195/153
|
||||
f 45/235/181 133/195/153 186/81/61 136/80/60
|
||||
f 45/235/181 136/80/60 183/79/48 131/236/180
|
||||
f 46/237/182 63/59/43 147/58/42 107/82/62
|
||||
f 46/237/182 107/82/62 186/81/61 138/194/152
|
||||
f 46/237/182 138/194/152 184/197/155 109/232/178
|
||||
f 46/237/182 109/232/178 148/60/44 63/59/43
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 257 KiB |
@@ -0,0 +1,80 @@
|
||||
#!/usr/bin/env python
|
||||
r"""Provide the baseball world.
|
||||
"""
|
||||
|
||||
import os
|
||||
import numpy as np
|
||||
|
||||
from pyrobolearn.worlds import BasicWorld
|
||||
|
||||
|
||||
__author__ = "Brian Delhaisse"
|
||||
__copyright__ = "Copyright 2019, PyRoboLearn"
|
||||
__credits__ = ["Brian Delhaisse"]
|
||||
__license__ = "GNU GPLv3"
|
||||
__version__ = "1.0.0"
|
||||
__maintainer__ = "Brian Delhaisse"
|
||||
__email__ = "briandelhaisse@gmail.com"
|
||||
__status__ = "Development"
|
||||
|
||||
|
||||
# TODO: finish to implement the world, create corresponding environment (in `envs` folder) with state and reward.
|
||||
|
||||
class BaseballWorld(BasicWorld):
|
||||
r"""Baseball world
|
||||
|
||||
"""
|
||||
|
||||
def __init__(self, simulator, position=(0., 0., 1.5), scale=(1., 1., 1.)):
|
||||
"""
|
||||
Initialize the baseball world.
|
||||
|
||||
Args:
|
||||
simulator (Simulator): the simulator instance.
|
||||
position (tuple/list of 3 float, np.array[3]): position of the baseball bat.
|
||||
scale (tuple/list of 3 float): scale of the bat.
|
||||
"""
|
||||
super(BaseballWorld, self).__init__(simulator)
|
||||
|
||||
mesh_path = os.path.dirname(os.path.abspath(__file__)) + '/../../meshes/sports/baseball/'
|
||||
position = np.asarray(position)
|
||||
|
||||
# load bat
|
||||
self.bat = self.load_mesh(mesh_path + 'bat.obj', position=[0., 0., 2.], scale=scale, mass=0.94, flags=0)
|
||||
self.bat_grip_radius = 0.035
|
||||
|
||||
# load ball
|
||||
self.ball = self.load_mesh(mesh_path + 'ball.obj', position=[0.2, -0.4, 2.], scale=scale, mass=0.145, flags=0)
|
||||
self.ball_radius = 0.0375
|
||||
|
||||
def reset(self, world_state=None):
|
||||
super(BaseballWorld, self).reset(world_state)
|
||||
|
||||
def step(self, sleep_dt=None):
|
||||
super(BaseballWorld, self).step(sleep_dt)
|
||||
|
||||
|
||||
# Test
|
||||
if __name__ == '__main__':
|
||||
from itertools import count
|
||||
import pyrobolearn as prl
|
||||
|
||||
# create simulator
|
||||
sim = prl.simulators.Bullet()
|
||||
|
||||
# create world
|
||||
world = BaseballWorld(sim)
|
||||
|
||||
# create manipulator
|
||||
robot = world.load_robot('kuka_iiwa')
|
||||
|
||||
# attach bat to robot end effector
|
||||
world.attach(body1=robot, body2=world.bat, link1=robot.end_effectors[0], link2=-1, joint_axis=[0., 0., 0.],
|
||||
parent_frame_position=[0., 0., world.bat_grip_radius], child_frame_position=[0., 0.3, 0.],
|
||||
parent_frame_orientation=[0, 0., 0., 1.])
|
||||
|
||||
# apply force to ball to throw it; f=dp/dt thus dp = f dt (change of momentum)
|
||||
|
||||
# run simulation
|
||||
for t in count():
|
||||
world.step(sim.dt)
|
||||
Reference in New Issue
Block a user