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

TurtleTracker(TM) v1.0b

Started by GopherAtl, 20 March 2014 - 08:21 PM
GopherAtl #1
Posted 20 March 2014 - 09:21 PM
Initial release ready in time for v1.6! been tested in 1.58 and 1.6pr6, seems to work fine in both.

What is Turtle Tracker, you ask?

It's a handy program that allows tracking and (for now) pretty basic management of your turtles remotely, over rednet. The clever bit is that it's not something you build into your programs; it runs invisibly on the turtles, behind the shell, while your turtles do whatever they were gonna do anyway.

What are the features?
  • track any number of turtles at once from one computer
  • track the distance from the computer and, if gps is available, positions of the turtles
  • remotely halt a turtle, terminating whatever programs it is running and dropping it into a shell
  • summon turtles, causing them to abort their programs and immediately move to within 2m of the computer that summoned them.
[indent=2]Be warned! When summoned, turtles will stop at nothing to get to the computer that summoned them. If they are not mining-equipped turtles, well, they're quite probably gonna get stuck, unless they're in the sky with no obstacles in the way. Summoning a turtle from, say, a computer deep in the heart of your super-special base, where there are lots of walls and machines and chests and other things in the way, is probably a bad idea.[/indent]

How do I use it?
SpoilerFirst, just put the program on all the turtles you want to track and run it from the shell. This will launch the background coroutine that handles rednet messages and generally manages things, and launch another shell under that for you to use the turtle normally.

Then, just use the turtle as you normally would, you shouldn't notice any change.

Then put the same program on whatever computer you want to track them from and run it. Any number of turtle IDs can be passed as arguments at the command line (ex, "turtletracker 1 5 7" would launch tracking turtles with ids 1, 5, and 7), but you can also start tracking more turtles from inside the program. The computer side of the program has a list of commands built-in, displayed on start, so you should be able to work out the rest!

But what if my program needs to run in the turtle's startup?
SpoilerNot a problem. You can tell TurtleTracker™ what program to run instead of a shell, if you want. Say your startup file currently launches "excavate 16". You run TurtleTracker™ from your startup file like this:

--in startup file...
shell.run("turtletracker","excavate 16")
And that's that! tracker will run in background, while your turtle excavates, with you able to track and override it from a remote computer.


But Gopher, my turtle's program isn't run from startup, it is startup! What am I supposed to do?
1) rename your startup file to something else. For this example, I will assume you called it "notstartup"
2) make a new startup file containing
shell.run("turtletracker","notstartup")
3) profit

Why don't you have any screenshots in this thread? I NEVER download things that don't have screenshots!
Because there's not much to see in screenshots at this point, it's a pretty simple text-based program. And also because I'm lazy. If that's a deal-breaker for you, well, that's just your loss!

Is there any way you could possibly make this more awesome in the future?
SpoilerSurprisingly, yes! For one thing, if we get modem-enabled tablet computers in 1.6, as some are expecting, it will be at least 500% more awesome just by virtue of running on one of those instead of a computer.
Things coming in the perhaps-not-so-distant future:
  • a gui version of the computer side interface
  • turtles reporting more detailed information about their status (current fuel level, rough info on inventory, etc).
  • temporarily suspending and resuming the running program
  • remote manual control mode
  • following turtles - with a modem-enabled tablet, a turtle could be instructed to stay within some distance of the player, following them around by tracking the tablet's modem without any influence from the player!
  • Possibly other things not mentioned here!

Where to get it

Right here!

With http api enabled, you can use pastebin, just type

pastebin get h1hQFspz TurtleTracker

and it'll be downloaded to your turtle or computer. It's just one program for the turtle or computer sides, it detects which it runs on and acts accordingly!
Edited on 20 March 2014 - 08:37 PM
Lyqyd #2
Posted 20 March 2014 - 09:43 PM
Does this play well with nsh/vncd? :)/>
GopherAtl #3
Posted 20 March 2014 - 09:46 PM
Does this play well with nsh/vncd? :)/>

not tried it, but in principle, it ought to. Just realised the computer-side version is not currently handling resize events, will make a note to add that, needed even for multishell in vanilla now, but while it does use redirects, it doesn't do any term.native hoodoo.
Edited on 20 March 2014 - 08:46 PM