NXT-Spy – Finally found a way to kill the android app completely!

A very annoying problem since I am working with the net2 package of JCSP on the Android phone was to stop the app completely; in fact, when I stopped the experiment by just closing the app it was not closing its process, so every values and processes accessed in a static way were kept in memory.

This very strange behaviour implemented by Android had for effect to make the application crash every two runs because when net2.Node tried to instantiate itself, it discovered that it was already instantiated and that the Wi-Fi sockets it was about to create already existed too!

So today, I decided that this recalcitrant piece of code could not continue to humiliate me like that, so I created a very simple Android application that is just be creating a JCSP.net2 server connection. I ran this application two times and as predicted, it crashed at the second run. I had my test case and won’t stop working on it until I find a solution or die of insomnia.

And after a couple of hours trying to modify net2’s source code, investigating on internet and reading the bug logs of the phone, EUREKA! The solution to this problem was found [here]. It is probably the problem on which I spent most time on during this project (I think I tried to find a solution to this problem more than 10 times) and it was solved in only one line to call when the program closes (by overriding the finalize method) which is:

android.os.Process.killProcess(android.os.Process.myPid()); 

Supervisor’s comment:

The wording of the blog made me laugh out loud; thank you!!
It is sickening to discover that one line of code is all that is required!!

NXT-Spy – Writing week

As planned in the project’s Gantt chart, this week was spent on writing the project report.

Supervisor’s comment:

Good!
More importantly we discussed the Critical Evaluation that goes in the final chapter
This should cover things that were done that could have been done better eg QR and Data Matrix
Use of the Blog to generate reference lists which then enabled checking that stuff had been written so references could be cited.
POSTER prepare an outline poster we can discuss

NXT-Spy – The robot is working… almost!

All the controller has now been tested. The verdict is that it is behaving correctly but it is very slow to operate. In order to fix the object following algorithm, I created a graph on excel to have a better idea of how the robot was behaving based on the position of the ball on the screen

Supervisor’s comment:

I read and commented on the draft report and made a number of structural suggestions.  Including the need for an Introductory chapter and also a conclusion chapter.  We have the meat of the dissertation but not the book ends!

NXT-Spy – First successful implementation of the ball finding / catching.

Today is a big day for this project, the robot now manages to find balls and to catch them on its own.
In fact, all last week problems are solved: A ball of Blu-Tack solved the balancing problem and the solution I thought about last week to solve the lag problem worked quite well, in fact, apart the fact that the robot is moving very slowly, it manages to find balls quite efficiently.
So here is the video that shows the success of the experiment (I accelerated the video of 200% because the robot is operating very slowly):

[yframe url=’http://www.youtube.com/watch?v=arTqjEFSyMQ’]

Today, I also did some testing in the white environment and figured out that Data Matrix 2D barcodes worked way better than the QR code as they are way less complex. I am even wandering why I chose QR codes the first time… maybe because it is more beautiful 🙂

Supervisor’s comment:

Well done; how about finding the Blue and Red corners?  They work most of the time but because the flag goes out of view it makes it hard to know when you have reached the corner.
Has also written up the report so far as he is not here next week.  So he has done two week’s work in one!!!!