bmegli / ev3dev-mapping

The ev3dev-mapping project meta repository
http://www.ev3dev.org/projects/2016/08/07/Mapping/
16 stars 6 forks source link

Trigonometry algorithm issue #4

Closed Gamma-Software closed 7 years ago

Gamma-Software commented 8 years ago

Hi, I saw your tutorial on using the Lidar NXV11 and particulary your algorithm used to calculate the angle Alpha from the angle Phi. double alpha = 180 - 82 + angle; Line 261 from MainWindow.xaml.cs I know that the sum of the angles in a triangle is 180° so it should be double alpha = 180 - 82 - angle; Regards ;) Valentin Rudloff

bmegli commented 8 years ago

Hi Gamma-Software,

Thanks for the comment.

This formula comes from:

It's for Revo LDS. You can get it working with XV11 LIDAR by manipulating the correction signs.

As for the formula itself, you have to keep in mind that those are oriented angles.

How about if we draw it like in attached scheme where all the angles are positive?

scheme

Now we have alpha=beta - phi

XV11 has geometyry like in attached xv11 photo without cover.

xv11

To adapt the formula for XV11 you would still have to take into account its geometry. For phi=0 you would have to add the correction for x and subtract for y.

You can write this in concise manner as alfa= - (beta-phi) and add the correction.

In fact the above is the most concise way I found for XV11.

You can test it all here:

https://github.com/bmegli/ev3dev-mapping/blob/master/xv11test/xv11plot.ods

Where you have phi/distance data captured from XV11 in a small rectangular box.

The formulas there have different coordinate system there (Y axis as ahead of XV11) but you can change them.

bmegli commented 8 years ago

Another notes:

So all of that is taken into account.

If you have any simplier idea how to explain the correction needed for XV11 I will happily read.

Gamma-Software commented 8 years ago

Hi @bmegli :) Thanks taking your time explaining me a little bit of your code, I really appreciate. Yes I understand now how it works. When I make the correction on the spreadsheet of what I supposed it was the right solution, the representation of the map started to skew a bit. So it seem that it's about the axis taken. If I have some more questions I'll be there to ask you ;)

bmegli commented 8 years ago

You're welcome @Gamma-Software,

For the record - I had similiar doubts about formula from Revo LDS paper (yes, why had they chosen this alfa, is this a mistake?) but then I took a scan in small rectangular box and simply checked what is the right correction.

bmegli commented 7 years ago

In case you have some more questions just ask!

This issue is for:

ev3dev-mapping-abandoned

and is dead for months so I am closing it.

Gamma-Software commented 7 years ago

No that's good @bmegli ;) Thanks for your answer.