Autonomous GPS Robot
mitesh22
Posts: 12
Hey Guys
This is Mitesh and Sanjeev from Chicago,
We are building up an autonomous GPS robot, and need help from all of you experts.
So far we have got all the hardware, as far as the designing is concern, the ultrasonic sensor, and servos have been designed.
We will be posting the codes for·that and also looking to get help for the GPS coding.
Thank You
This is Mitesh and Sanjeev from Chicago,
We are building up an autonomous GPS robot, and need help from all of you experts.
So far we have got all the hardware, as far as the designing is concern, the ultrasonic sensor, and servos have been designed.
We will be posting the codes for·that and also looking to get help for the GPS coding.
Thank You
Comments
Basically right now, i was trying to understand that code that was developed by the parallax in order to get the values of Long, Latti. from GPS, found that code at parallax website.
Now I wanted to create a final point for our Robot where it should br lead by the GPS.
I might have to come up with a loop that compares the Data received by the GPS module and also the Data of our final set point.
I will be posting the source code for that tomorrow.
Thank you for your courtesy though.
Looking forward to talk to you!
Mitesh
Attached is an example of a GPS guided car that uses the Parallax Hitachi compass and the Parallax GPS.
It will provide you with an example of the challenges that you are facing.
Regards,
TCIII
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
If you are going to send·a Robot·to save the world, you·better make sure it likes it the way it is!
Here are the two codes that we have so far, one is for an ultrasonic sensor that senses an object within 2 feet.
and the other one is as followed:
[noparse][[/noparse] I/O Definitions ]
Sio PIN 15 ' connects to GPS Module SIO pin
' GPS Module Commands
GetInfo CON $00
GetValid CON $01
GetSats CON $02
GetTime CON $03
GetDate CON $04
GetLat CON $05
GetLong CON $06
GetAlt CON $07
GetSpeed CON $08
GetHead CON $09
'
[noparse][[/noparse] Variables ]
char VAR Byte
workVal VAR Word ' for numeric conversions
eeAddr VAR workVal ' pointer to EE data
ver_hw VAR Byte
ver_fw VAR Byte
valid VAR Byte ' signal valid? 0 = not valid, 1 = valid
sats VAR Byte ' number of satellites used in positioning calculations
degrees VAR Byte ' latitude/longitude degrees
minutes VAR Byte ' latitude/longitude minutes
minutesD VAR Word ' latitude/longitude decimal minutes
dir VAR Byte ' direction (latitude: 0 = N, 1 = S, longitude: 0 = E, 1 = W)
speed VAR Word ' speed in 0.1 knots
des_deg VAR Word
des_min VAR Word
des_mind VAR Word
COUNTER VAR WORD
[noparse][[/noparse] EEPROM Data ]
NotValid DATA "No", 0
IsValid DATA "Yes", 0
'
[noparse][[/noparse] Initialization ]
Initialize:
PAUSE 250 ' let DEBUG open
DEBUG CLS ' clear the screen
DEBUG "Parallax GPS Receiver Module Test Application", CR,
"
"
Draw_Data_Labels:
DEBUG MoveTo, 0, 3, " Hardware Version: "
DEBUG MoveTo, 0, 4, " Firmware Version: "
DEBUG MoveTo, 0, 6, " Signal Valid: "
DEBUG MoveTo, 0, 7, " Acquired Satellites: "
DEBUG MoveTo, 0, 12, " Latitude: "
DEBUG MoveTo, 0, 13, " Longitude: "
DEBUG MoveTo, 0, 15, " Speed: "
DEBUG MoveTo, 0, 16, " Direction of Travel: "
[noparse][[/noparse] Program Code ]
Main:
GOSUB Get_Info
GOSUB Get_Valid
GOSUB Get_Sats
GOSUB Get_Lat
GOSUB Get_Long
GOSUB Get_Speed
GOSUB Get_Head
des_deg = xxxxx
des_min = yyyyy
des_mind = zzzzz
IF(des_mind > minutesD)
FOR COUNTER = 1 TO 100
PULSOUT LeftServo, 850 ' Left Servo Left Pulse Value
PULSOUT RightServo, 850 ' Right Servo Left Pulse Value
PAUSE 20
NEXT
FOR COUNTER = 1 TO 100
PULSOUT LeftServo, 850 ' Left Servo Left Pulse Value
PULSOUT RightServo, 650 ' Right Servo Left Pulse Value
PAUSE 20
NEXT
ELSE IF(des_mind < minutesD)
FOR COUNTER = 1 TO 100
PULSOUT LeftServo, 650 ' Left Servo Left Pulse Value
PULSOUT RightServo, 650 ' Right Servo Left Pulse Value
PAUSE 20
NEXT
FOR COUNTER = 1 TO 100
PULSOUT LeftServo, 850 ' Left Servo Left Pulse Value
PULSOUT RightServo, 650 ' Right Servo Left Pulse Value
PAUSE 20
NEXT
The rest of the code is same as what they have posted at their homesite.
But do you have any suggestions on this code:
If my car starts a certain point, it is going to read three variables for GPS.
1. degree 2. minutes and 3. fractional minutes.
Now we have readings that every 7.5 feet the fractional minute changes by 0.1
And since we are testing it in the parking lot(relatively small area), as the robot moves a bit, the only reading that changes is fractional minutes.
In the code, I tried to compare the final reading (taken manually) with the one that we get from the GPS.
Direct us in the logic or coding from here onwards
Thank you
Looking forward to see some feed back
Mitesh
Smart Sensors and Applications - PingMeasureCmAndIn.bs2
' Measure distance with Ping))) sensor and display in both in & cm
' {$STAMP BS2}
' {$PBASIC 2.5}
'
[noparse][[/noparse] I/O Definitions ]
RightServo PIN 12 ' Right Servo
LeftServo PIN 13 ' Left Servo
Ping PIN 15 ' PING))) Sensor
'
[noparse][[/noparse] Variables ]
pulseCount VAR Byte ' Used For Measuring Turns
' Conversion constants for room temperature measurements.
CmConstant CON 2260
InConstant CON 890
cmDistance VAR Word
inDistance VAR Word
time VAR Word
task VAR Nib ' Current Task
DO
PULSOUT 11, 5
PULSIN 11, 1, time
inDistance = inConstant ** time
DEBUG HOME, "The distance is ", DEC2 inDistance, " in"
IF (inDistance < 18) THEN ' Wait For 10 Servo Pulses
GOSUB Turn_Right
PAUSE 200
GOSUB Go_Forward
PAUSE 200
GOSUB Turn_Left
PAUSE 200
GOSUB Go_Forward
PAUSE 200
GOSUB Turn_Left
PAUSE 200
GOSUB Go_Forward
PAUSE 200
GOSUB Turn_Right
PAUSE 200
GOSUB Go_Forward
ELSE
GOSUB Go_Forward
ENDIF
'PAUSE 1
LOOP
Turn_Left: ' Left Turn, About 45 Degrees
FOR pulseCount = 0 TO 40 ' Number Of Pulses To Turn
PULSOUT LeftServo, 650 ' Left Servo Left Pulse Value
PULSOUT RightServo, 650 ' Right Servo Left Pulse Value
PAUSE 20 ' Refresh Delay
NEXT
RETURN
Turn_Right: ' Right Turn, About 45 Degrees
FOR pulseCount = 0 TO 40 ' Number Of Pulses To Turn
PULSOUT LeftServo, 850 ' Left Servo Right Pulse Value
PULSOUT RightServo, 850 ' Right Servo Right Pulse Value
PAUSE 20
NEXT ' Refresh Delay
RETURN
Go_Forward: ' Right Turn, About 45 Degrees
FOR pulseCount = 0 TO 200 ' Number Of Pulses To Turn
PULSOUT LeftServo, 850 ' Left Servo Right Pulse Value
PULSOUT RightServo, 650 ' Right Servo Right Pulse Value
PAUSE 20 ' Refresh Delay
NEXT
RETURN
Go_Backward: ' Right Turn, About 45 Degrees
FOR pulseCount = 0 TO 100 ' Number Of Pulses To Turn
PULSOUT LeftServo, 650 ' Left Servo Right Pulse Value
PULSOUT RightServo, 850 ' Right Servo Right Pulse Value
PAUSE 20 ' Refresh Delay
NEXT
RETURN
One quick word of caution:
GPS speed and heading are only good while the GPS is in motion; when stopped, the GPS cannot calculate the heading as the heading is internally calculated from successive lat/long data. IF you have the bandwidth, adding a compass (such as the Hitachi HM55B) will give a rough heading regardless of motion.
As for your testing, in a small area such as a parking lot, fractional minutes is fine. Just remember, GPS accuracy is limited to +/- 1 meter (best case), so your error in position may be equal to your movement unless you have 3 satellites or better. You may have to add a test for that and presume dead-reckoning at times. If you have the ability, what I would do would be to have the code wait until Get_Stats returns 3 (or higher), then sprint at least 3 meters (10 feet) to get an accurate relative heading. Store this heading and use it as a reference (increment heading for so many pulses of Left/Right servo to do a dead-reckoning). After every 10 feet or so, find new heading from GPS and compare to expected value. This would a rough substitute for a compass in a pinch.
Good Luck.
But here is the thing, I am not more concern about the direction, but I have to create a final point of that path which has set manually in the program by me, and then the other point is the one which uses the data of the GPS.
I am sure you are understanding me.
Here look at the attachment, and give me some suggestion, do I still use the compass?