I have a blog about my new project concerning robot Monte Carlo Localization. You can read my blog and the progress of my project at
http://lejosnxt.blogspot.com/
Moderators: roger, 99jonathan, imaqine
lawrie wrote:Have you looked at the MCL classes in lejos.localization and the code I posted on this forum some time ago?
lawrie wrote:I see you run the particle filtering on the PC. The first version I wrote also did this but I now run the particle filtering on the NXT.
lawrie wrote:I have updated lejos.localization in SVN for the 0.8 release.
lawrie wrote:.I will look at your implementation in more detail if I get time. I have also been sent MCL from from Professor David Cohen at London University . I have not studied it in detail yet, to see how it differs from my version in lejos.localization. His version is based on RobotC code that is available from www.itee.uq.edu.au/~wyeth/NXT/.
lawrie wrote:I am interested in adding support to leJOS for other probabalistic robotics algorithms.
public interface MCLfunction{
ParticleSet initialize();
float weightFunction();
float noiseFunction();
}lawrie wrote:You can look at the latest code in SVN at http://lejos.svn.sourceforge.net/viewvc ... alization/. I have tidied it up quite a bit including making border a variable.
I will look at your MCLFunction interface suggestion. I send the particle set back and forth to the PC and NXT and it does not take too long, and the algorithm is fairly slow in the NXT anyway (particularly resample).
private void chooseNewPoseSet(){
Pose [] oldPoses = displayPanel.getPose();
Pose [] newPoses = new Pose[oldPoses.length];
for(int k = 0; k < oldPoses.length; k++){
double choice = Math.random();
boolean notFound = true;
int lower = 0;
int upper = oldPoses.length - 1;
int trialPose = 0;
int count = 0;
while(notFound){
count++;
if(count> 20){
System.out.println("Too many times.");
System.exit(0);
}
trialPose = (int)Math.floor(((upper - lower)/2.0)) + lower;
//System.out.print("Trial: ");
//System.out.println(trialPose);
if(choice <= oldPoses[trialPose].getCumWeight() &&
choice > (oldPoses[trialPose].getCumWeight()-
oldPoses[trialPose].getWeight())){
notFound = false;
}
else if(choice > oldPoses[trialPose].getCumWeight()){
lower = trialPose+1;
}
else
{
upper = trialPose-1;
}
if(lower == upper || upper < lower) break;
}
//newPoses[k] = new Pose(oldPoses[trialPose].getHeading(),
// oldPoses[trialPose].getX(),oldPoses[trialPose].getY());
int noise = -2 + (int)Math.random()+4;
newPoses[k] = new Pose(oldPoses[trialPose].getHeading() + noise,
oldPoses[trialPose].getPoint().getX()+noise,
oldPoses[trialPose].getPoint().getY()+noise);
}
System.arraycopy(newPoses, 0, oldPoses, 0, newPoses.length);
}
I have added methods in ParticleSet to dump to and load from a data stream to make this easier. I show a graphical representation of the progress of the algorithm on the PC. I think the current lejos.localization code will run on the PC or NXT. Currently you have to use classes.jar in a PC program to use it on the PC, but that will change in the 0.8 release.
One reason I did not use Point in Pose is that I want the Particle object to be as small as possible so that I can use as many particles as possible on the NXT. (I can currently support at least 300). Each object has an overhead so using Point would reduce the number of particles I can use.
I hope to improve the lejos support for probabilistic algoithms as I learn more about the subject. I am currently working my way through Sebastian Thrun's book: Probabistics Robotics.
I will send you David Cohen's Java code. The URL was to the RobotC implementation that he based his code on.
Users browsing this forum: No registered users and 1 guest