You are on page 1of 4

Assignment 2, EDAP01

ax3833ro-s
February 2023

1 Statement
I did the peer-review with Ella Hammer (el5416ha-s). In addition to this I have
also discussed the assignment Lisa Bybro, André Frisk, Axel Nåsell, Felix Apell
Skjutar, Linus Åbrink, Joel Bäcker and Hannes Östergren.

2 Summary of the Task


The task in this assignment was to implement an algorithm that could predict
the movements of a simulated robot. This was done using a localiser based on
a Hidden Markov Model as well as a simulator for the robot. Lastly we were
tasked with calculating the successrate of our algorithm.

3 Brief Overview of Implementation


This assignment was completed by implementing two files.These files were Robot-
SimAndFilter.py and Localizer.py. My RobotSIm class is meant to simulate the
behaviour of the robot and mainly uses two methods, they each have a helper-
method, in order to do so. The method nextState is used to calculate the
probability of moving from the current state to the most likely other state. On
the other hand the sense method is used to calculate the probability of different
scenarios and return a reading.

My HMMFilter implements a Hidden Markov Model and applies it to a sensed


position, as generated by the sense-method previously mentioned, and to a a
probability vector given by the localizer class. I wrote the forward filter using
a matrix and vector operations from the transition and observation models.

The Localizer class performs the update cycle.. THis is a method that uses
the previously mentioned methods nextState and sense. These are then fed into
the HMM-filter.

1
3.1 Statement of Change
The peer-review firstly encouraged me to increase the number of iterations I
used in my notebook. Therefore I declared a variable with so that I could easily
change the number, I then increased it to 1000. Additionally my peer suggested
that I should use more of the methods given in models. I tried this by changing
my nextState-method. This resulted in a far more compact code.. I left my
original code for my nextState as a comment since this was very different from
the original. I could have changed my sense-method aswell, however I refrained
from doing so because I felt it would become to familiar to my peers code.

4 Explanation of the Models


The StateModel represents the grid that our robot operates in. The robot
then traverses said grid and the StateModel can transform readings, positions
and poses into states and vice versa. The TransitionModel on the other hand
represents the likelihood of traversing from one state into another, this includes
certain rules such as not being able to traverse through the walls. Lastly the
ObservationModel represents how probable it is for a sensor to reading the states
in the model.

4.1 GUI
The visualisation at the bottom of the notebook can show us a couple of different
things. Firstly by pressing ”Show Transition” will show us the likelihood of
moving from our current state to all other states. Secondly the button ”Show
Sensor” will show us the likelihood for a position to be reported by the sensor.

5 Discussion of Results
The HMM that I implemented managed to get between 30 and 35 percent of
its guesses correct. In addition to this I received a mean error of roughly 1.8.
However the sensor is only correct roughly 10 percent of the time and with a
mean error of around 4.8. This is an indication that my implementation can
make a somewhat good prediction of the next location of the robot. However
the result would most likely not be good enough to base a practical application
on it. We should also note that while picking positions completely at random,
the average error was roughly 5 and it only got the correct in less than 2 percent
of the cases. Thus my implementation at least provides us with better chances
than randomly picking positions.

6 Summary of Article
Here follows a summary of the article ”Monte Carlo localisation: Efficient Po-
sition Estimation for Mobile Robots” written by D. Fox et al. (1999). In the

2
article D. Fox et al. analyse the performance of the Monte Carlo localisation
(MCL), he describes how it works and compares it to other localisation methods
such as Hidden Markov Model and Kalman filter. MCL is an algorithm that
uses sampling-methods in order to approximate a probability distribution. The
algorithm also uses an adaptive sampling technique that uses a large amount of
samples during global localisation. However MCL reduces the sample size dur-
ing tracking when it has an approximation of the robots location. This could be
seen as a type of sampling in proportion to how likely an area is. This means
that MCL can gather the computaional resources on the right regions. This also
allows MCL to reduce the amount of memory used, when compared to HMM.
Furthermore the sampling can alway be stopeed. This means that when when
the algorithm gets a reading or executes an action, the sampling will terminate
and the set can be used in th upcoming calculations. MCL also adds random
samples to the set, this is necessary in order to find the robot if its position is
lost.

6.1 Relation to my Implementation


My solution is based on a Hiden Markov Model, this is a grid-based method
rather than a sampling-based method. The main difference between these two
methods is that the grid-based method requires more computation and memory-
space. The article mentions an experiment where both algorithms were used to
navigate the Smithsonian museum. In this experiment the guidance was vision
base and that led to the MCL being far superior in the experiment. THis was
due to the immense amount of calculations required, however if the experiment
had been conducten in a different setting, the methods might have been mor
comparable.

7 Appendix

3
Peer-review - EDAP01
Ella Hammer (el5416ha-s)
February 2023

1 Peer-review
First the robot simulation was checked. It should produced reasonable senors readings,
never further away than the second ring if ”nothing” and ”nothing” reasonably often, this
matched the expectations of the assignment. In regards to accuracy the two solutions
have results within the same span, a hit-rate between 30-40% and an average Manhattan
distance at approximately 1.6. The results of the solution is within the boundaries, both
Manhattan distance and hit-rate where below respectively over the boundary.
One specific improvement for the solution is a higher amount of moves in the main
function, from 100 to 1000 for example, in order to have less variation in the test trials.
Our solutions had some differences to the structure. One of the biggest dissimilarity’s
was how the given models where incorporated in the implementation. The robot class
RobotSim can use the given models, for example the transition model to simulate
the movements of the robot. The efficiency in this part of the implementation could
have been improved. The models are not used in the most efficient way to simulate
the movement and sensor readings rather computed according to the rules of movement
for the robot and the given scenario, the implementation therefor has an unnecessary
complex to it. This being said the solution is good and does the job.

You might also like