Skip to content

Commit

Permalink
Added inverse dynamics correlation plots.
Browse files Browse the repository at this point in the history
  • Loading branch information
moorepants committed Apr 24, 2015
1 parent 2841075 commit 331b797
Show file tree
Hide file tree
Showing 4 changed files with 119 additions and 3 deletions.
Binary file not shown.
Binary file not shown.
76 changes: 73 additions & 3 deletions main.tex
Original file line number Diff line number Diff line change
Expand Up @@ -250,11 +250,19 @@ \section*{Results}
%
The formulation above allows one to choose a variety of combinations of
potential sensor, $\mathbf{s}(t)$, and control, $\mathbf{m}(t)$, signals to
generate a controller.
generate a controller. For this analyses we focus on a planar controller that
involves the hip, knee, and ankle joints. The angle and angular rate of each
joint are available as sensors and a torque at each joint are available as the
actuators. Further more the formulation allows for different types of control
that isolate sensors from actuators:

\begin{description}
\item[Joint Isolated Control] The torque generated by a joint is only
affected by the sensors that give information about that joint.
\item[Side Isolated Control] The torque generated at a joint is only affected
by the sensors on the same side of the body.
\item[Full Control] The torque genderated by a joint is affected by all of
the available sensors.
\end{description}

\subsection*{Example Result}
Expand Down Expand Up @@ -290,10 +298,72 @@ \subsection*{Example Result}
\end{center}
\end{figure}
%
\subsection*{$\mathbf{m}^*$ accounts for most of the variation}
%
\subsection*{Random variations predict random gains}
%
If the variation in the sensor and actuator measurements is purely random, the
identified gains should be random. To verify this we follow this procedure:

\begin{itemize}
\item Select the necessary marker coordinates and ground reaction load
measurments for a single gait cycle from normal walking.
\item Compute the inverse dynamics from sensor and actuator measurements.
\item Fit a Fourier series to each time series so that the cycle can be
perfectly cyclic.
\item Form a time series of 500 gait cycles based on the fitted data.
\item Add normal Gaussian noise to each sensor and actuator measurement.
\item Identify a joint isolated controller from this artificially created
data.
\end{itemize}

The identified gains show no apparent correlation.

\todo{Add a gain plot here showing this. The results are shown here:
http://nbviewer.ipython.org/github/csu-hmc/gait-control-direct-id-paper/blob/master/notebooks/artificial_variations.ipynb}

\subsection*{Correlations due to inverse dynamics bias gains}
%
The measurement noise present in the marker coordinates is propogated into both
the sensor values (joint angles and angular rates) and the actuator values
(joint torques) through the inverse kinematic and inverse dynamic computations,
thus the sensors and actuator measurement estimates are correlated simply by
this. We exposed this correlation by the following procedure:

\begin{itemize}
\item Select the necessary marker coordinates and ground reaction load
measurments for a single gait cycle from normal walking.
\item Fit a Fourier series to each time series so that the cycle can be
perfectly cyclic.
\item Form a time series of 500 gait cycles based on the fitted data.
\item Add normal Gaussian noise to each measurement.
\item Compute the inverse dynamics from the noisy data to produce the sensor
and actuator measurements.
\item Identify a joint isolated controller from this artificially created
data.
\end{itemize}

The correlation based entirely on the random noise is shown in the example gain
plot in Figure~\ref{fig:inverse-dynamics=correlation-gains}.
%
\begin{figure}
\begin{center}
\includegraphics{figures/example-inverse-dynamics-correlation-gains.pdf}
\caption{Gait phase percent scheduled gains for right (blue) and left (red) legs.}
\label{fig:inverse-dynamics=correlation-gains}
\end{center}
\end{figure}

The proportional gains show a clear bias that is strikingly similar to a
proportionally scaled vertical ground reaction force.

\subsection*{$\mathbf{m}^*$ accounts for most of the variation}
%
Ideally the variation in the gait cycles is sufficient to identify the
acutation due to feedback encapsulated by the gait matrix. If the feedback
contribution is assumed to be zero, then $\mathbf{m}^*$ can be identified
alone. If the VAF decreases significantly with $\mathbf{K}(\phi}=0$ then one
can assume that the feedback terms are not just contributing to overfitting the
data.

\subsection*{Similar gains are predicted from both unperturbed and perturbed}
%
\subsection*{Increasing the number of sensors for each control increases vaf}
Expand Down
46 changes: 46 additions & 0 deletions src/example_inverse_dynamics_correlation_plot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env python


# standard library
import os

# external
from scipy.constants import golden
import matplotlib.pyplot as plt

# local
import utils

paths = utils.config_paths()

params = {'backend': 'ps',
'axes.labelsize': 8,
'axes.titlesize': 8,
'font.size': 10,
'legend.fontsize': 6,
'xtick.labelsize': 6,
'ytick.labelsize': 6,
'text.usetex': True,
'font.family': 'serif',
'font.serif': ['Computer Modern'],
'figure.figsize': (6.0, 6.0 / golden),
}

plt.rcParams.update(params)

trial_number = '019'
event = 'Artificial Data'
structure = 'joint isolated'

trial = utils.Trial(trial_number)
trial.remove_precomputed_data()
trial.identify_controller(event, structure)

fig, axes = trial.plot_joint_isolated_gains(event, structure)
plt.tight_layout()
filename = 'example-inverse-dynamics-correlation-gains.pdf'
fig.savefig(os.path.join(paths['figures_dir'], filename))

fig, axes = trial.plot_validation(event, structure)
filename = 'example-inverse-dynamics-correlation-fit.pdf'
fig.savefig(os.path.join(paths['figures_dir'], filename))

0 comments on commit 331b797

Please sign in to comment.