Go Down

Topic: calculate relative direction to destination (Read 2993 times) previous topic - next topic

AWOL

Well, your debug trace doesn't give any indication of how long it took (hint), but I'd probably go for continuous (1Hz) updates from the GPS, and do a rolling average of lat/long.

Quote
it still does not work good from my side

I'm sorry to hear that.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

cutebuddy6

i am just working on the ranges but not able to define it properly so i need help in defining the ranges if you can do me a favour

AWOL

You can't define the range; the range is simply the distance from where you are to where you want to be, and will obviously vary.
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

cutebuddy6

only worried about the direction
Quote
if ( finaldir < 20 && finaldir > 340 )//if the final direction is +20 or -20 it should go straight
          {
            Serial.println("Straight");
            myLCD.print ("Go Straight");
            //motorForward();//car Forward
            //steering('C');//Steering Centered
          } 
          if(finaldir >180 && finaldir < 339)
          {
            Serial.print("Straight");
            Serial.println("Left");

            myLCD.print ("L");
            //motorForward();
            //steering('L');
          }
          if(finaldir > 20 && finaldir < 179)
          {
            Serial.print("Straight");
            Serial.println("Right");

            myLCD.print ("R");
            //motorForward();
            //steering('R');
          }

AWOL

Code: [Select]
if ( finaldir < 20 && finaldir > 340 )/
Doesn't seem very likely, does it?
"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

strykeroz


Code: [Select]
if ( finaldir < 20 && finaldir > 340 )/
Doesn't seem very likely, does it?
Also you have some gaps where if the value is 179 through 180, 339 through 340, or exactly 20 (as examples) there's no result as you've not tested for >= or <=.
"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

cutebuddy6


AWOL

#37
Apr 13, 2012, 09:46 pm Last Edit: Apr 13, 2012, 09:54 pm by AWOL Reason: 1
Well, as usual, you're ignoring what you're being told.
How many times do you need to be told that adding the same number twenty times and then dividing by twenty is a waste of time?
How many times have I told you that static analysis of software is about the least productive way of debugging?

Again
Code: [Select]
if ( finaldir < 20 && finaldir > 340 )//
Can you list all the values of "finaldir" which are going to trigger this condition?
(Hint: It's a very short list)

"Pete, it's a fool looks for logic in the chambers of the human heart." Ulysses Everett McGill.
Do not send technical questions via personal messaging - they will be ignored.

Go Up