relative-gps coord system
This commit is contained in:
@@ -12,21 +12,16 @@ if turtle and device.wireless_modem then
|
||||
}
|
||||
Config.load('gps', config)
|
||||
|
||||
local GPS = require('gps')
|
||||
local pt
|
||||
for i = 1, 3 do
|
||||
pt = GPS.getPointAndHeading(2)
|
||||
if pt then
|
||||
break
|
||||
end
|
||||
local s = turtle.enableGPS(2)
|
||||
if not s then
|
||||
s = turtle.enableGPS(2)
|
||||
end
|
||||
|
||||
if not pt and config.destructive then
|
||||
if not s and config.destructive then
|
||||
turtle.setPolicy('turtleSafe')
|
||||
pt = GPS.getPointAndHeading(2)
|
||||
s = turtle.enableGPS(2)
|
||||
end
|
||||
|
||||
if not pt then
|
||||
if not s then
|
||||
error('Unable to get GPS position')
|
||||
end
|
||||
|
||||
@@ -34,18 +29,12 @@ if turtle and device.wireless_modem then
|
||||
turtle.setPolicy('turtleSafe')
|
||||
end
|
||||
|
||||
Util.print('Setting turtle point to %d %d %d', pt.x, pt.y, pt.z)
|
||||
turtle.setPoint(pt)
|
||||
turtle.getState().coordSystem = 'GPS'
|
||||
|
||||
if not turtle.pathfind(homePt) then
|
||||
error('Failed to return home')
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
turtle.setPolicy('none')
|
||||
|
||||
if not s and m then
|
||||
error(m)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user