andretamm / sdpwinners

STABILITY - making your robots stable since 2014
0 stars 0 forks source link

Vision: Fix orientation direction of Yellow/Blue plates #8

Closed CalvinTMurray closed 10 years ago

andretamm commented 10 years ago

We're also seeing some cases where the orientation flutters between the correct angle and its 180 degree opposite. Usually seems to happen near the top part of the pitch.

andretamm commented 10 years ago

Gray circle detection is slightly better now. I also had the idea of possibly trying to fit a line through three points: 1) Centre of gray points 2) Centre of green points 3) Centre of coloured points

@CszMurray, @mkirova, @Claudiu23 - thoughts?

andretamm commented 10 years ago

@CszMurray. @mkirova, @Claudiu23 ......................................

Claudiu23 commented 10 years ago

Think it's worth a shot to try and see how it behaves. On Sunday, March 30, 2014 5:58 AM, andretamm notifications@github.com wrote:

@CszMurray. @mkirova, @Claudiu23 ...................................... — Reply to this email directly or view it on GitHub.

mkirova commented 10 years ago

But for this to work these 3 points would have to line up perfectly - what if they don't? (i.e. how exactly do we want to fit the line)

Claudiu23 commented 10 years ago

Fit a line that goes from one of the points (e.g. the lower one) to the middle of the line created by the other two, so you'd get a sort of average. On Sunday, March 30, 2014 5:15 PM, mkirova notifications@github.com wrote:

But for this to work these 3 points would have to line up perfectly - what if they don't? (i.e. how exactly do we want to fit the line) — Reply to this email directly or view it on GitHub.

mkirova commented 10 years ago

Okay, that makes sense, I thought about it as well, but detection of centres needs to be really good for it... What if for example the centre of the green plate is really off for some reason - then this method wouldn't produce very accurate results, methinks. Still, maybe it's worth a try. :)

andretamm commented 10 years ago

What @Claudiu23 said might work as well, but in general a line that's 'fitted' to points may not actually go through any of the points you're fitting the line to! If you took IAML, then you'll remember the "least squares" fitting method that could fit any polynomial line to a set of points.

We don't need to be so fancy when just fitting a straight line though, there's tons of material on the internets if you google "fit straight line to points". A fairly clear cut solution is e.g. here http://faculty.cs.niu.edu/~hutchins/csci230/best-fit.htm

This is an example with many points:

andretamm commented 10 years ago

Yeah, still @mkirova and @CszMurray as well ^^

CalvinTMurray commented 10 years ago

@andretamm So I'm a little confused of exactly what we want from the position of the robot. I agree that using the green points as the location of the robot would be a better and more accurate representation of where our robot actually is. In this case should we make the changes in ImagePocessor to do this? Furthermore, where do we want to apply distortion and perspective fix. Should we correct the robot's position point in ImageProcessor before we store it in the world state or only correct them when we use them, for example in orientation?

andretamm commented 10 years ago

1) If it's actually from the middle of the coloured points, then I think we'll just live with that, we adjusted the grabbing distances today, so anything to do with the position of the robots shouldn't be changed any more.

2) The robot's position is currently corrected in updateWorldState(), so that's already there.

3) Everything else should be only 'fixed' when used, e.g. yes, when finding the angles in Orientation. You need to make sure you actually always create a new point for this, as things can have interdependencies, so making a permanent change somewhere would be scary and will have repercussions that we will discover probably in the middle of the finals.

andretamm commented 10 years ago

Averaging the orientation over three points didn't work so well as expected, we're not sure why, possibly the fluctuation of the three points is too big, so we went back to using just the centre of the coloured points and the grey circle.

This was still a little bit wobbly, but was precise enough for playing purposes. Closing.