Commit 363b63f2 authored by lildholdt's avatar lildholdt
Browse files

PDF

parent de901760
\section{Group 7}\label{group-7}
\subsection{Lab Notebook - Lesson 10}\label{lab-notebook---lesson-10}
\textbf{Date:} 21/05 2015
\textbf{Group members participating:} Ivan Grujic, Lasse Brøsted
Pedersen, Steffan Lildholdt, René Nilsson
\textbf{Activity duration:} 5 hours
\subsection{Goal}\label{goal}
The goal of this exercise is to investigate how the method of odometry
and the tachocounter can be used to keep track of position of a LEGO car
with differential drive.
\subsection{Plan}\label{plan}
The plan is to follow the plan described in {[}1{]}.
\subsection{Odometry}\label{odometry}
For this exercise the standard base vehicle from Lesson 6 is used
together with the PilotSquare.java program provided in this lesson. The
parameters of the LEGO car in this program is defined as the following.
\begin{longtable}[c]{@{}lc@{}}
\toprule
Parameter & Value\tabularnewline
\midrule
\endhead
Left wheel diameter & 5.5 cm\tabularnewline
Right wheel diameter & 5.5 cm\tabularnewline
Track width & 16 cm\tabularnewline
\bottomrule
\end{longtable}
The program makes the car drive 20 cm straight forward, turn 90 degrees
to the left and repeat this 4 times in order to get back to the initial
position. A special piece of paper with multiple grids on it is used to
measure the accuracy of the system. This is shown in the following
image.
\begin{figure}[H]
\centering
\includegraphics{Lesson10/Images/Odometry.JPG}
\caption{Measuring physical accuracy of the DifferentialPilot class}
\end{figure}
Optimally, the LEGO car should end up in the exact same position as
prior to the execution of the program. However this is not the case due
to both \textbf{systematic} and \textbf{non-systematic} errors. The
result of the 3 test runs are summarized in the following table.
\begin{longtable}[c]{@{}lcrrr@{}}
\toprule
Attempt & Measured x & Measured y & Calculated x & Calculated
y\tabularnewline
\midrule
\endhead
1 & -2.00 mm & -2.00 mm & 1.00 mm & -1.60 mm\tabularnewline
2 & -2.00 mm & 2.00 mm & 0.40 mm & -0.60 mm\tabularnewline
3 & -4.00 mm & 3.50 mm & 2.50 mm & -1.90 mm\tabularnewline
\bottomrule
\end{longtable}
``Measured'' x and y is the physical error measured by a ruler and
``Calculated'' x and y is computed error displayed in the LCD on the
NXT.
The \textbf{Non-systematic} involves variations in the surface and the
internal uncertainty of \textasciitilde{}2\% {[}2{]}. These errors are
difficult to cope with. However the \textbf{systematic} errors involves
incorrect definition of the LEGO car parameters and these can be
corrected by calibration which is described in the following.
\subsection{Calibration of wheel diameter and the track
width}\label{calibration-of-wheel-diameter-and-the-track-width}
The wheels diameter is calibrated by letting the car drive 50 cm - using
the ``travel()'' function of the DifferentialPilot with 50 as parameter
- and then adjusting the diameter according to where the car stops.
Similarly the track width is calibrated by letting the car spin 360
degrees - using the ``rotate()'' function of the DifferentialPilot with
360 as parameter - and again observing the stopping position and
adjusting the track width accordingly. The calibration setup is shown in
the following image.
\begin{figure}[H]
\centering
\includegraphics[width = 200 pt]{Lesson10/Images/Calibration.JPG}
\caption{Calibration of LEGO car parameters}
\end{figure}
We found out that it was necessary to set the right wheel diameter a
little higher than the left in order to make the LEGO car drive
straight. The calibrated values are shown in the following table.
\begin{longtable}[c]{@{}lc@{}}
\toprule
Parameter & Value\tabularnewline
\midrule
\endhead
Left wheel diameter & 5.539 cm\tabularnewline
Right wheel diameter & 5.544 cm\tabularnewline
Track width & 16.27 cm\tabularnewline
\bottomrule
\end{longtable}
To validate the calibrated values we let the LEGO car drive in a 50 x 50
cm square as shown in following image. The goal is, after the trip, to
end back up in the starting position.
\begin{figure}[H]
\centering
\includegraphics[width = 250 pt]{Lesson10/Images/PilotSquareLeftTurns.JPG}
\caption{Validation of LEGO car parameters - Left turns}
\end{figure}
The result of 3 attempts are summarized in the following table.
\begin{longtable}[c]{@{}lcrrr@{}}
\toprule
Attempt & Measured x & Measured y & Calculated x & Calculated
y\tabularnewline
\midrule
\endhead
1 & -10.00 mm & -13.00 mm & 1.30 mm & -1.30 mm\tabularnewline
2 & -10.00 mm & -10.00 mm & 2.80 mm & -2.80 mm\tabularnewline
3 & -13.00 mm & -15.00 mm & 3.00 mm & -1.80 mm\tabularnewline
\bottomrule
\end{longtable}
Despite what we expected the LEGO car did not end up in the exact
position as it started in. A clear sign of systematic errors is seen due
to the x and y position always are negative. We then tried to calibrate
the parameters of the LEGO car according to the 50 x 50 cm square and
ended up with the following parameters.
\begin{longtable}[c]{@{}lc@{}}
\toprule
Parameter & Value\tabularnewline
\midrule
\endhead
Left wheel diameter & 5.539 cm\tabularnewline
Right wheel diameter & 5.544 cm\tabularnewline
Track width & 16.4 cm\tabularnewline
\bottomrule
\end{longtable}
Apparently, it was only the track width that needed to be adjusted in
order to correct for the systematic errors. The result after four runs
with the updated parameters is shown in the following table.
\begin{longtable}[c]{@{}lcrrr@{}}
\toprule
Attempt & Measured x & Measured y & Calculated x & Calculated
y\tabularnewline
\midrule
\endhead
1 & 5.00 mm & 5.00 mm & 0.60 mm & -0.60 mm\tabularnewline
2 & -1.25 mm & -2.50 mm & 1.90 mm & -2.10 mm\tabularnewline
3 & 2.00 mm & 3.00 mm & 6.30 mm & -1.80 mm\tabularnewline
4 & -1.00 mm & 0.00 mm & 1.80 mm & -2.30 mm\tabularnewline
\bottomrule
\end{longtable}
The measured x and y errors seem to be random with these parameters. To
validate these results the car is programmed to drive the other way
around as shown in the following image.
\begin{figure}[H]
\centering
\includegraphics[width = 250 pt]{Lesson10/Images/PilotSquareRightTurns.JPG}
\caption{Validation of LEGO car parameters - Right turns}
\end{figure}
In this setup the LEGO car performed poorly with much larger errors in
the x and y direction.
\begin{longtable}[c]{@{}lcrrr@{}}
\toprule
Attempt & Measured x & Measured y & Calculated x & Calculated
y\tabularnewline
\midrule
\endhead
1 & 30.00 mm & 40.00 mm & 1.30 mm & 2.30 mm\tabularnewline
2 & -27.50 mm & -30.00 mm & 5.20 mm & 2.70 mm\tabularnewline
\bottomrule
\end{longtable}
Due to these poor results the original calibrated parameter values are
used.
\begin{longtable}[c]{@{}lc@{}}
\toprule
Parameter & Value\tabularnewline
\midrule
\endhead
Left wheel diameter & 5.539 cm\tabularnewline
Right wheel diameter & 5.544 cm\tabularnewline
Track width & 16.27 cm\tabularnewline
\bottomrule
\end{longtable}
It seems like it is near impossible to calibrate the parameters so that
the LEGO car is able to travel a given distance while performing a
number of random turns. Multiple reason can cause this behavior. An
obvious reason is the leJOS maximum precision of 2 \%. So no matter how
much calibration is performed some error will always exist, even though
this probably is non-systematic. Other factors like the position of the
back wheel could also be part of the explanation. If the back wheel is
not aligned with the driving direction the car can be drawn out of
course when pulling the back wheel into the correct direction.
\subsection{Position tracking by means of particle
filters}\label{position-tracking-by-means-of-particle-filters}
\subsubsection{Estimating the noise
factors}\label{estimating-the-noise-factors}
The tests to estimate the noise factors was performed at low speeds, on
a wooden table covered by a single sheet of paper. The low speed reduces
the noise factors because the wheel stops faster, and thus closer to the
intended angle, also the low speed reduces the risk the wheel loosing
grip of the surface. The wooden table covered by paper also reduces the
noise factors, because the surface is homogeneously smooth, without any
irregularities which could introduce errors.
The distance noise factor was determined by having the robot perform
multiple forward travels of 50 cm. The average distance from the target
was \textasciitilde{}0.5 mm, thus the distance noise factor was
estimated as: 0.5/500 = 0.001.
The angle noise factor was determined by two tests, both performed
multiple times. In the first test, the robot performed four 360 degrees
rotation. The second test was similar, but reversed the direction of the
2nd and 4th rotation. For both tests, the average deviation was 0.5
degrees.
\subsubsection{\texorpdfstring{Test with \texttt{PilotMonitor} and
\texttt{PilotRoute}}{Test with PilotMonitor and PilotRoute}}\label{test-with-pilotmonitor-and-pilotroute}
The \texttt{applyMove} function in the \texttt{Particle} class was
initially corrected, so that the addition of the random error is not
dependent of the coordinate system. In the snippet below, the old
implementation is shown. Here the addition of noise depends on the
distance traveled in the x or y direction, meaning that if the Lego car
only moved in the y direction, no noise would be added to the
x-coordinate. And vice versa.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{pose.}\FunctionTok{setLocation}\NormalTok{(}\KeywordTok{new} \NormalTok{Point(}
\NormalTok{(}\DataTypeTok{float}\NormalTok{) (pose.}\FunctionTok{getX}\NormalTok{() + xm + (distanceNoiseFactor * xm * rand.}\FunctionTok{nextGaussian}\NormalTok{())),}
\NormalTok{(}\DataTypeTok{float}\NormalTok{) (pose.}\FunctionTok{getY}\NormalTok{() + ym + (distanceNoiseFactor * ym * rand.}\FunctionTok{nextGaussian}\NormalTok{()))));}
\end{Highlighting}
\end{Shaded}
In the snippet below the corrected implementation is shown. Instead of
using the distance in the x and y direction, the total distance is used.
In this way, the noise addition is independent of the coordinate system.
\begin{Shaded}
\begin{Highlighting}[]
\NormalTok{pose.}\FunctionTok{setLocation}\NormalTok{(}\KeywordTok{new} \NormalTok{Point(}
\NormalTok{(}\DataTypeTok{float}\NormalTok{) (pose.}\FunctionTok{getX}\NormalTok{() + xm + (distanceNoiseFactor * move.}\FunctionTok{getDistanceTraveled}\NormalTok{() }
\NormalTok{* rand.}\FunctionTok{nextGaussian}\NormalTok{())),}
\NormalTok{(}\DataTypeTok{float}\NormalTok{) (pose.}\FunctionTok{getY}\NormalTok{() + ym + (distanceNoiseFactor * move.}\FunctionTok{getDistanceTraveled}\NormalTok{() }
\NormalTok{* rand.}\FunctionTok{nextGaussian}\NormalTok{()))));}
\end{Highlighting}
\end{Shaded}
The particle filter was tested by making the car follow the track as
shown in the picture below. By using the poster with distances it is
possible to see how accurate the car is.
\begin{figure}[H]
\centering
\includegraphics[width = 250 pt]{Lesson10/Images/PilotHorseShoe.jpg}
\caption{Test of particle filter}
\end{figure}
The test was run with two different settings: 1. Speed = 5, distance
noise factor = 0.001 and angle noise factor = 0.5. 2. Speed = 15,
distance noise factor = 0.005 and angle noise factor = 2.5.
Below is a picture of the test results.
\begin{figure}[H]
\centering
\includegraphics[width = 200 pt]{Lesson10/Images/ParticleFilter.JPG}
\caption{Test results with speed = 15, distance noise factor = 0.005 and
angle noise factor = 2.5. The robot was supposed to stop with the black
brick underneath the front pointing on the cross. It is approximately 4
cm away. The PC shows the possible locations calculated using the
particle filter.}
\end{figure}
\subsection{Position tracking while avoiding
obstacles}\label{position-tracking-while-avoiding-obstacles}
We have chosen to answer this exercise based on the exercise \emph{Make
the robot stay within the robot arena} from lesson 11. The following
image shows the setup used, with a sonar sensor, two light sensors, and
a bumper and touch sensor mounted on the front of the vehicle.
\begin{figure}[H]
\centering
\includegraphics[width = 250 pt]{Lesson10/Images/Sonar.JPG}
\caption{Setup for tracking whilst avoiding obstacles}
\end{figure}
We used the bumper and touch sensor to detect obstacles as this was
easier to test. Odometry was used to track the movements performed in
the two behaviors \emph{Avoid obstacle} and \emph{Travel route}.
\begin{figure}[H]
\centering
\includegraphics{Lesson10/Images/BehavioralControl.jpg}
\caption{Behavioral control}
\end{figure}
Travel route was implemented to drive in a straight line to obtain a
simple fixed route. The Avoid Obstacle behavior, which backs the car up
10 cms and turns 90 degrees to the left, is activated by the touch
sensor. Both behaviors use the \texttt{Travel()} and \texttt{Rotate()}
methods of the \texttt{DifferentialPilot}. These methods are both called
with the \texttt{ImmediateReturn} parameter set to true, in order to let
the them be suppressed.
We tested the tracking by placing the vehicle approximately 30 cm in
front of an obstacle. When the car reached the obstacle, it backed up,
turned to the left and continued forward. As can be seen in the video in
{[}3{]}, the odometry was able to keep track of the car.
\subsection{Conclusion}\label{conclusion}
In this exercise we have performed experiments with odometry in a real
world setting. For this to work a highly precise calibration of the
wheel diameter and track width is required. We discovered that this is
not a straight forward task when working with LEGO and the leJOS
environment. The problems we encountered resulted in that we were not
entirely able to remove systematic errors from the system. Many factors
will affect the driving and we were therefore not able to determine the
exact cause of the calibration errors. Our best estimate is that the
orientation of the back wheel plays an important role and should be
aligned precisely according to the direction of driving. When doing
position tracking with the particle filter a distance and an angle noise
factor needs to be determined in order to cope with the non-systematic
errors. Here we found out that speed is a significant factor. When the
speed is increased the different noise factors also needs to be
increased due to a higher uncertainty of the end position.
\subsection{References}\label{references}
{[}1{]}
http://legolab.cs.au.dk/DigitalControl.dir/NXT/Lesson10.dir/Lesson.html
{[}2{]}
http://lejos.sourceforge.net/nxt/nxj/tutorial/WheeledVehicles/WheeledVehicles.htm
\subsubsection{Videos}\label{videos}
{[}3{]} http://youtu.be/JOdNyQy-lQ4
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment