OK, then we have a way to get the information into Python!
Next, I’m unsure what your actual requirements are. Is latitude/longitude enough for your application? If not, what else do you need? Where does the synchronization with the PPS signal come into the picture?
In order to navigate from where the vehicle is it needs to know where it is therefor it needs a set of lat/lon coordinates that is acquires from the GPS and store such temporary that will become the starting lat and lon. The user will provide the target lat/lon via keyboard.
The distance and bearing between the start and target sets of coordinates are calculated.
The track value is the acquired from the GPS and also stored temporary, the vehicle must now turn and for simplicity it must always turn clockwise until the track value is ± 0.5 degrees with the calculated bearing value.
The vehicle must then drive towards the target coordinates continuously calculating its bearing and the distance to the target coordinates and make course adjustments to keep the vehicle aligned with the target coordinates and then stop when it is within 20mm’s from the target
It must be as basic as it can get. If that works then the whole picture will change and presently I do not know how
I found this don’t know if it will help
# The GPSD daemon is started in the background
print("The GPSD daemon is started with the USB device /dev/ttyACM0.")
process = subprocess.Popen(["sudo", "gpsd", "-b", "/dev/ttyACM0", "-F", "/var/run/gpsd.sock", "G"])
print("GPSD PID: ", process.pid)
print("The GPSD daemon was started.")
time.sleep(1)
To do this, we just need to combine the gpsd example script with the code you posted above to calculate distance and bearing, and add some user input to select the target:
This is the output and it is constant plus accurate taken into account the unit is indoors and stationery at present. The results are very surprising and accurate. From where the unit is positioned indoors to the target coordinates the distance is accurate to sub decimeter if I physically measure the distance and the bearing is within 5 degrees. The bearing data will improve greatly when the vehicle is moving and the ‘track’ data is also brought into the equation.
Distance: 38.12617763440066
Bearing: 185.51021775633447
Distance: 38.12617763440066
Bearing: 185.51021775633447
Distance: 33.1177284834834
Bearing: 180.4515512976982
Distance: 33.1177284834834
Bearing: 180.4515512976982
Distance: 33.1177284834834
Bearing: 180.4515512976982
I have done code for the motor control to steer and move the vehicle.
Could I send you the code?
This is certainly getting more than interesting
How would one combine the code you did with the motor control in real time?
Hi Anton,
I got it thank you…I too have ventured to take up this project but using a slightly different approach by using semantic web technologies and python…will get in touch with you in case of any serious problems that I encounter with regard to getting gps values or with regard to motor code or any other chassis problem that may be encountered during our venture… Kindly help
Regards,
Srinivas