View Single Post
  #2   Spotlight this post!  
Unread 10-12-2007, 11:06
JesseK's Avatar
JesseK JesseK is offline
Expert Flybot Crasher
FRC #1885 (ILITE)
Team Role: Mentor
 
Join Date: Mar 2007
Rookie Year: 2005
Location: Reston, VA
Posts: 3,659
JesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond reputeJesseK has a reputation beyond repute
Re: Help with Angles and distance

I would start with pseudo code, literally you can framework out your code either using flow charts or writing IF ... THEN. Most white papers that define software requirements do one or the other and coding from there is as easy as knowing any language's syntax.

For starters in syntax, I don't believe EasyC will like the "^" character, so multiply those variables out.

Now for some issues you'll encounter along the way (note, these are NOT answers to these issues; I'm only making you aware of them)What will boggle your mind is that unless your GPS unit is precisly on the center of rotation of your robot, when it moves to the spot you tell it to it will be off by a distance. That distance, minus all negligible mathematical components, is roughly the distance between the GPS unit and the center of rotation.

Also, you'll need to account for the possible sign errors on your arctan (inverse tangent) output. There are several ways to do this, the most intuitive (but most complex) of which is converting the bearing to the first quadrant, doing the calculation, then reversing the quandrant conversion. Do this on paper using the IF...THEN blocks as well. Doing this will also reduce the amount of arctan tables you need to store, fyi .

Finally, what should happen when Y2 == Y1 ? Do you see the problem that happens in your arctan calculation? When, in the real world for your application, does Y2 == Y1 and how will your code deal with that condition?
__________________

Drive Coach, 1885 (2007-present)
CAD Library Updated 5/1/16 - 2016 Curie/Carver Industrial Design Winner
GitHub