Skip to content

Instantly share code, notes, and snippets.

@moorepants
Last active November 10, 2020 09:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save moorepants/4f79f6c58fde8858ffcfe009e0be1689 to your computer and use it in GitHub Desktop.
Save moorepants/4f79f6c58fde8858ffcfe009e0be1689 to your computer and use it in GitHub Desktop.
BEP Assignment: Generalized Variables From Two IMUs
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
\title{Assignment: Generalized Variables From Two IMUs}
\author{Jason K. Moore}
\date{\today}
\documentclass[]{article}
\usepackage[a4paper,margin=25mm]{geometry}
\begin{document}
\maketitle
The IMU measures angular velocity of the rigid body and the linear acceleration
of a single point on that rigid body both with respect to an observer in the
Earth reference frame. The components of these vectors values are expressed
with respect to reference frame attached to the IMU which is moving in the
Earth's reference frame. IMU's with onboard orientation estimates also
typically provide the Euler angles of the phone with respect to a coordinate
system attached to the Earth. We will assume you have the orientation estimate
Euler angles.
If you attach one IMU to the bicycle's rear frame $R$ at point $P$ and one IMU
to the bicycle's front frame (handlebars \& fork) $F$ at point $Q$ you get 18
measures: 3 Euler angles, 3 components of angular velocity, and 3 components of
linear acceleration for each IMU.
The tire force function I provided needs 8 time varying values: roll angle
$q_4$, steer angle $q_7$, roll angular rate $u_4$, rear wheel angular rate
$u_6$, steer angular rate $u_7$, and the derivatives of roll angular rate
$\dot{u}_4$, wheel angular rate $\dot{u}_6$, steer angular rate $\dot{u}_7$.
To simplify the need to measure $u_6$ and $\dot{u}_6$, you can start by
estimating forces from constant speed circles with the bicycle. Note your speed
from a speedometer and assume there is no acceleration. You could also add an
IMU to the spinning wheel or use a magnetic speedometer to extract $u_6$, but
best to keep it simple at first.
For the remaining 6 variables, you need to find a mapping from the two IMUs' 18
measures to these variables. To do so, you need to calculate the angular
velocities and linear accelerations measured by the IMUs in terms of these 6
variables and then solve for the variables.
Using a coordinate frame with, $z$ pointing down and normal to the ground, $x$
in the forward direction, and $y$ pointing out the right side of the bike, you
can yaw about $z$ through $q_3$ and then roll about the new $x'$ through $q_4$
to give the yawed and rolled coordinate system $x'$,$y'$,$z'$. You should be
able to write a transformation matrix for this Euler $z$-$x$ rotation. To
capture the steering motion, you will then define a frame $F$ that rotates
relative to $R$ about the steer axis (pointing downwards) through steer angle
$q_7$. You can then write the transformation matrix relating $R$ and $F$.
Matrix multiplying the first transformation matrix with the second one will
give you the transformation matrix that that includes the yaw, roll, and steer
rotations. These transformations give a nonlinear relationship between the
Euler angles from the phone and the needed $q_3$, $q_4$ and $q_7$. You'll need
to use a numerical solver to solve this set of nonlinear equations. Make sure
to give a smart guess to the solver!
Once you have the transformation matrices, you should be able to write the
definitions of the angular velocities of $R$ and $F$. This will give a linear
mapping between the IMU angular velocity components and the variables $u_3,
u_4$ and $u_7$. Linear least squares can help you solve for these variables.
Lastly, you will need to write the acceleration of the point $P$ on $R$ and the
acceleration of point $Q$ on $F$. This will give you linear relationships
between the IMU accelerometer readings and $\dot{u}_3,\dot{u}_4,\dot{u}_7$.
Linear least squares can help you solve for these variables.
\section*{Tips \& Notes}
\begin{itemize}
\item You'll need the position vectors to the two accelerometers. There are
placements of $P$ which make it easier to calculate the position vector and
acceleration of $Q$. Think what would be the smartest location to simplify
your calculation.
\item You'll also need to think about the best orientation to attach the IMUs
to the frames. You may want to align them such that your transformation
matrices are as simple as possible.
\item Also, note that the accelerometer measures include the acceleration due
to gravity. You'll need to subtract that component from your accelerometer
readings using the orientation information.
\item All of the $u$ variables are defined to be the derivative of the
associated $q$ variable, e.g. $\dot{q}_i = u_i$ and $\ddot{q}_i =
\dot{u}_i$.
\item Don't forget that the steer axis is at an angle (steer axis tilt or
head tube angle, depending on your view).
\end{itemize}
\section*{Deliverables}
Write a Matlab/Octave function or script that calculates
$q_4,q_7,u_4,u_7,\dot{u}_4,\dot{u}_5$ given the measurements from the two IMUs
and give recommendations on placement and orientation of the IMUs on the two
frames. I'll provide a function and some values to check your answers.
\end{document}
Display the source blob
Display the rendered blob
Raw
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment