Pages: 1 2 [3]   Go Down
Author Topic: calculate relative direction to destination  (Read 2007 times)
0 Members and 1 Guest are viewing this topic.
Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24312
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"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.

Offline Offline
Full Member
***
Karma: 0
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24312
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

"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.

Offline Offline
Full Member
***
Karma: 0
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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');
          }
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24312
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
if ( finaldir < 20 && finaldir > 340 )/
Doesn't seem very likely, does it?
Logged

"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.

Brisbane, Australia
Offline Offline
Edison Member
*
Karma: 29
Posts: 1071
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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 <=.
Logged

"There is no problem so bad you can't make it worse"
- retired astronaut Chris Hadfield

Offline Offline
Full Member
***
Karma: 0
Posts: 196
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

tell me the mistakes if any

* uncheck_asad_test_new_2.pde (10.18 KB - downloaded 9 times.)
Logged

Global Moderator
UK
Offline Offline
Brattain Member
*****
Karma: 238
Posts: 24312
I don't think you connected the grounds, Dave.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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)

« Last Edit: April 13, 2012, 02:54:14 pm by AWOL » Logged

"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.

Pages: 1 2 [3]   Go Up
Jump to: