Posted 01 July 2014 - 05:54 PM
starNav 3.0
(Previous version: starNav 2.0 - The Windows 9 Special Edition :lol:/> )
GPS based Turtle pathfinding with efficient movement algorithm and environment mapping
Install from pastebin: pastebin run rNZx09j4
New version features:
- New tinyMap API which drastically reduces the file size of the map saves.
- Implemented sessions which help to increase successful pathfinding in constantly changing environments.
- Added the ability to limit the search area, to stop your turtle wandering off too far!
- Turtle remembers it's position and heading at all times (not between server restarts though).
Usage:
The API has an easy installer available on pastebin at rNZx09j4.
(See Downloads for individual file list)
Setup process:
Spoiler
To get yourself up and running, follow these three easy steps!1) The turtle requires a reliable GPS network to be able to determine it's position, so make sure to fully cover the area you want to navigate with GPS points.
2) The turtle needs to have a wireless modem to access the GPS network, as well as fuel!!! (You can also optionally equip the turtle with a sensor from openPeripheral to massively speed up it's navigation)
3) Once you have installed all the files, either use the 'starNav.goto' function, or the provided 'goto' program.
Using the 'goto' program: goto x y z
Using the starNav API: starNav.goto(x, y, z)
Downloads:
Programs:
APIs:
Documentation:
Spoiler
goto program - Easy to use program based on the starNav APISpoiler
Simply run the program in shell, providing the co-ordinates you want to pathfind to:
goto x y z
You can provide an additional argument to limit the search area so that the turtle doesn't wander too far:
goto x y z maxDistance
starNav API - Main API that let's you use the pathfinding functions in your own programs
Spoiler
function goto(<number> xPos, <number> yPos, <number> zPos, <(optional)number> maxDistance)
function getPosition()
returns <number> xPos, <number> yPos, <number> zPos, <number> heading
aStar API - The raw A* API
Spoiler
Utility functions:
function newMap()
returns a basic 3D map that can be used to store any values
function vectorEquals(<vector> vec1, <vector> vec2)
returns true if vec1 and vec2 have the same value or false otherwise
function adjacent(<vector> vec1)
returns a table with all 6 adjecent coords to the one at vec1 (e.g up, down, left, right, forward, backward)
function distance(<vector> vec1, <vector> vec2)
return the 1-norm / manhattan distance between two vectors
Main function:
function compute(<function> distanceFunction, <vector> startCoord, <vector> endCoord)
returns an array of the path in vector format or false if no path can be found
pQueue API - A binary heap based priority queue
Spoiler
Create a new by calling the new function:
function new(<(optional)function> compareFunction)
return a new instance of a priority queue with compareFunction as the function used two compare two elements in the queue
The priority queue then has the following methods:
queue:insert(element, value)
returns the position the element is inserted into the queue at
queue:remove(element, <(optional)function> elementEqualsFunction)
queue:pop()
queue:peek()
queue:contains(element, <(optional)function> elementEqualsFunction)
queue:isEmpty()
queue:size()
queue:getValue(element, <(optional)function> elementEqualsFunction)
queue:setValue(element, value, <(optional)function> elementEqualsFunction)
tinyMap API - API used to save 3D data
Spoiler
TODOlocation API - Modified version of an API I found somewhere???, altered to use Minecraft's values for headings
Spoiler
TODOEdited on 12 December 2015 - 03:13 PM