This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Cozzimoto's profile picture

[WIP] GPS to the MAX

Started by Cozzimoto, 12 October 2012 - 08:13 AM
Cozzimoto #1
Posted 12 October 2012 - 10:13 AM
SO.. ive been working on something i havent yet seen before on here, a GPS tower builder in two forms, the very first GPS tower you build and another program that finds the Position of the turtle and builds a tower off another towers GPS locate function

Current Version: First GPS Tower 0.2 | GPS Tower 0.1


FEATURES:
  • Calculates estimated fuel consumption
  • nice little gui interface on startup of program
  • builds towers all the way at 250 no matter where you are in the world (as long as you input the right Y Coordinates)
  • Orientation system
TODO:
  • rednet application to check when turtle is out of range of towers
  • rednet application to send turtle to build a tower in blind areas (expand the horizons)
  • smart movement to wait or go around any entity so the turtle stays on track
  • if invalid entry attempt from user to place in correct entry
  • check if numbers are numbers and strings are strings
CONS:
  • turtle sets up tower at Coordinates in front of him not where he is at
  • if not the correct vars are set it quits the program
i would love to hear some input on maybe some ideas to add to this little system i have made :)/>/>

file on disk named startup:
[indent=1]

print("Starting up!")
fs.copy("/disk/startup2", "startup")
[/indent]


First GPS Tower (without GPS tracking)
http://pastebin.com/SUp30FTj

GPS Tower (with GPS tracking)
http://pastebin.com/uhFFB9is

My Pastebin
http://pastebin.com/u/cozzimoto
Orwell #2
Posted 12 October 2012 - 10:30 AM
SO.. ive been working on something i havent yet seen before on here,
Did you look in the thread 5 below this one? http://www.computerc...telite-builder/

It might be another way of orienting the turtle around and I don't even know about fuel and a gui in the other one, but the result is kinda the same I guess.
Cozzimoto #3
Posted 12 October 2012 - 10:34 AM
that other one only limits the turtle to go to 100
and the other one doesnt calculate the fuel it needs for the job, since mine can go up anywhere to 250 it calculates how much fuel it would need before it starts, and i just made this today and i plan on expanding on it more
Orwell #4
Posted 12 October 2012 - 10:36 AM
that other one only limits the turtle to go to 100
and the other one doesnt calculate the fuel it needs for the job, since mine can go up anywhere to 250 it calculates how much fuel it would need before it starts, and i just made this today and i plan on expanding on it more

Cool. : ) I just wanted you te be aware of that one. :)/>/> I'll give yours a try later today.
Cozzimoto #5
Posted 12 October 2012 - 10:39 AM
yea i saw that one before, and i didnt want to copy it. so i created my own with a few more features
ChunLing #6
Posted 12 October 2012 - 03:18 PM
The satellite launcher has been updated to go to the max height, and I made a version that checks for an existing GPS and coordinates the new array with the existing system (as well as testing for fuel level), it's included in the basic utility function I posted.
Cozzimoto #7
Posted 12 October 2012 - 09:04 PM
oh i see, i didnt read that but ill check it out and see how it works compared to mine
lokilotus #8
Posted 26 October 2012 - 01:50 AM
Me being a bit of an idiot here, but what do you put on the disk, or is it a blank disk that it writes to? Because on my computers I have set up using firstGPStower, I'm not getting a "serving GPS Requests" line or anything else, as opposed to when I set the positions manually on the computers. Building the thing worked fine though.

Thanks in advance,

-Loki
ChunLing #9
Posted 26 October 2012 - 02:07 AM
Ah,
file on disk named startup:
[indent=1]

print("Starting up!")
fs.copy("/disk/startup2", "startup")
That should be it. I can't verify that this actually works, cause I don't know what is on startup2.[/indent]
Cozzimoto #10
Posted 26 October 2012 - 03:43 AM
startup2 is created by the program to put in the vars it needs and when it restarts the computer it makes sure it doesnt run that just yet so it saves it to startup then reboots the computer and runs the GPS according to the turtles position
ChunLing #11
Posted 26 October 2012 - 05:30 AM
Aha…I use a basic
	local cntntstng = [[fs.copy("disk/rnhst","rnhst") shell.run("rnhst","host",]]
	if fs.exists("rom/programs/rnhst") then  cntntstng = [[shell.run("rnhst","host",]]
	elseif not fs.exists("rnhst") then print("Must have available rnhst program to execute")
	return false end
And
   	 if fs.exists("rnhst") and not fs.exists("disk/rnhst") then fs.copy("rnhst","disk/rnhst") end
		local strtfl = fs.open("disk/startup","w")
		strtfl.writeLine(cntntstng..xPos..","..yPos..","..zPos..","..dmn..")")
		strtfl.close()
Type of thing to make sure that the turtle has a copy of the file I want to run in place of GPS, and that it runs the host with the appropriate gps coordinates. You could adapt it to be like:
local cntntstng = [[fs.copy("disk/startup2","startup") shell.run("gps","host",]]
local cntntstng2 = [[shell.run("gps","host",]]
and
	   local strtfl = fs.open("disk/startup","w")
		strtfl.writeLine(cntntstng..xPos..","..yPos..","..zPos..")")
		strtfl.close()
		strtfl = fs.open("disk/startup2","w")
		strtfl.writeLine(cntntstng2..xPos..","..yPos..","..zPos..")")
		strtfl.close()
That way you don't need to have a specific file on the disk, you just create the files you need.

Haha, whoops, normal gps program doesn't have that fourth parameter.
Edited on 26 October 2012 - 03:38 AM