Skip to content
Snippets Groups Projects
Commit 72ee9eb3 authored by Olivier Bertrand's avatar Olivier Bertrand
Browse files

Add doc on orientation as tutorials

parent 73416df1
No related branches found
No related tags found
No related merge requests found
Source diff could not be displayed: it is too large. Options to address this: view the blob.
This diff is collapsed.
This diff is collapsed.
...@@ -382,18 +382,26 @@ class Trajectory(pd.DataFrame): ...@@ -382,18 +382,26 @@ class Trajectory(pd.DataFrame):
raise KeyError('df should contains q_2 or alpha_2') raise KeyError('df should contains q_2 or alpha_2')
return self return self
def from_markers(self, markers, triangle_mode, error=None): def from_markers(self, markers, triangle_mode,
error=None, markers_labels=[0, 1, 2]):
indeces = markers.index
# Reinit the pandas dataframe super class
# because we now know the indeces
super().__init__(index=indeces, columns=self.columns, dtype=float)
# If error is provided, we can propagate the error
if error is not None: if error is not None:
self.trajectory_error = pd.DataFrame(data=np.nan, self.trajectory_error = pd.DataFrame(data=np.nan,
index=self.index, index=self.index,
columns=self.columns) columns=self.columns)
mark0 = markers.loc[:, 0] markers2use = markers.loc[:, markers_labels]
mark1 = markers.loc[:, 1] markers2use = markers2use.dropna()
mark2 = markers.loc[:, 2] mark0 = markers2use.loc[:, markers_labels[0]]
mark1 = markers2use.loc[:, markers_labels[1]]
mark2 = markers2use.loc[:, markers_labels[2]]
x = np.zeros(9) # 3points with x,y,z x = np.zeros(9) # 3points with x,y,z
kwargs = {'triangle_mode': triangle_mode, kwargs = {'triangle_mode': triangle_mode,
'euler_axes': self.rotation_mode} 'euler_axes': self.rotation_mode}
for index_i in self.index: for index_i in markers2use.index:
# Assign mark to pos # Assign mark to pos
x[0:3] = mark0.loc[index_i, ['x', 'y', 'z']].values x[0:3] = mark0.loc[index_i, ['x', 'y', 'z']].values
x[3:6] = mark1.loc[index_i, ['x', 'y', 'z']].values x[3:6] = mark1.loc[index_i, ['x', 'y', 'z']].values
...@@ -420,6 +428,7 @@ class Trajectory(pd.DataFrame): ...@@ -420,6 +428,7 @@ class Trajectory(pd.DataFrame):
self.loc[index_i, 'location'] = position self.loc[index_i, 'location'] = position
self.loc[index_i, self.rotation_mode] = orientation self.loc[index_i, self.rotation_mode] = orientation
return self
def world2body(self, markers): def world2body(self, markers):
""" Transform markers in world coordinate to body coordinate """ Transform markers in world coordinate to body coordinate
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment