A while back I built a simple waypoint navigation script for vehicles, and I thought I would share it.
I modified
M7's Tiger 2 as a basic demonstration of this functionality, and share it with the hope that someone will help improve it!
At the moment it is a real hack-job, as I only spent a short amount of time on it. The vehicle script has functions to 1) calculate latitude and longitude from the ECEF position, 2) I calculate the forward azimuth from the current position to the target waypoint, and 3) calculate the true relative bearing to follow. Once it gets within 10 meters of the waypoint the vehicle will stop. Sometimes it may go in circles, especially if the vehicles is too far away from the waypoint, but if it is not too far it should correct the course after a few seconds. A PID controller would probably fix this problem.
One functionality I would like to develop is obstacle avoidance. This is getting into the domain of building a basic AI construct, which isn't too difficult and is really a matter of calling the correct methods to the OT interface to determine if the current course is clear, blocked or cannot be passed.
In this version, you must set the waypoint manually, by editing the variables near the top of the script for the latitude and longitude of the target waypoint in radians. Currently, these are set for a point near the OT default location: Airport 2, Lower Himalayas.
var lat_tgt_rad = 0.48663567294854004; //Latitude Radians
var lon_tgt_rad = 1.4642145502211033; //Longitude Radians
Here is the download link for the package:
http://www.mediafire.com/download/1bajxk9hgb5zijl/tiger2.m7c7.otxBest regards,
Uriah