Jump to content




Aware API v1.0


33 replies to this topic

#1 Biopsy

  • New Members
  • 22 posts

Posted 27 April 2012 - 08:39 PM

Please read all instructions and install required files before installing and asking questions. Suggestions and constructive criticism are always appreciated.


aware 2.0
Aware is an API that I've developed to handle turtle advanced turtle movement tracking.

Spoiler
Requirements:
utils 2.0
Download:
aware 2.0

biodesign 2.0
biodesign is a program that runs on a terminal that allows you to design, save, and later modify anything you can imagine that will fit in a 33x12 space using up to 9 block types. These designs can then be built using a compatible version of biobuild.

Spoiler
Requirements:
utils 2.0
matrix 2.0
Download:
biodesign 2.0

biobuild 2.0
biobuild automatically builds something designed with biodesign using aware and blocks from inventory.

Spoiler
Requirements:
aware
utils
matrix
Download:
biobuild 2.0

biomine 2.0
biomine is a program that makes use of the aware api to mine in a (I think) very effective way.

Spoiler


biolisten 2.0
biolisten is a fun little project I made that works with turtles and rednet to display the turtle's current position on a terminal screen or monitor.

Spoiler

utils 2.0
utils contains some common functions used in my other programs
Spoiler
Download:
utils 2.0

matrix 2.0
matrix is my solution to annoyance with computercraft nested tables and is used to create and modify 2 dimensional matricies.
Spoiler
Download:
matrix 2.0

Misc:
goto
calibrate

#2 OmegaVest

  • Members
  • 436 posts

Posted 27 April 2012 - 08:52 PM

Question: Does Aware support GPS? Having a turtle find its location from GPS, at least for the startup, would be a nice inclusion here, I think.

#3 Biopsy

  • New Members
  • 22 posts

Posted 27 April 2012 - 09:03 PM

 OmegaVest, on 27 April 2012 - 08:52 PM, said:

Question: Does Aware support GPS? Having a turtle find its location from GPS, at least for the startup, would be a nice inclusion here, I think.
Right you are! That was on my list of things to do this morning that I completely forgot about! I haven't actually played with the GPS as the range seemed extremely limited but those were my thoughts exactly. Having a gps system in my house/base would allow much faster setup. I'll get on that.

#4 Biopsy

  • New Members
  • 22 posts

Posted 27 April 2012 - 09:26 PM

I don't have the gps API enabled on this computer, but i've made a change that should attempt to use gps to locate. Let me know if it works and i'll update.
Does the gps.locate() command come back with decimals? If so I will likely have to round off the numbers to keep it from breaking

http://adf.ly/7tMHg

EDIT: the version posted here 1.1 included gps - but it likely won't work.
GPS is back out for later versions as it will not - at least not without movement - determine orientation.

#5 Robd

  • New Members
  • 32 posts

Posted 27 April 2012 - 10:06 PM

Looks pretty decent, I'm downloading and I'll have to see about playing with it some.

#6 Biopsy

  • New Members
  • 22 posts

Posted 27 April 2012 - 11:01 PM

 Robd, on 27 April 2012 - 10:06 PM, said:

Looks pretty decent, I'm downloading and I'll have to see about playing with it some.
any feedback would be appreciated

#7 Bunny83

  • New Members
  • 2 posts

Posted 29 April 2012 - 01:58 AM

Well, i guess almost every real coder has already done this in a similar way (including myself) :)/>

I don't really play MP. I just mess around in SP. However it looks quite solid, but i would hook all native move functions so you can still use the "go" program and others. You can use rawset to overwrite the functions with your own, but don't forget to backup the native ones :)/>

Also i just like to add that most game engines have this axis setup (at least all pure 3D engines). It's derived from the usual view direction which is along the ground. An unaltered transformation matrix (identity) will make you look along the z-axis since x and y belong to the screen coordinates. Depending on the mathematical system used (left or right handed) the z axis might be inverted. OpenGL uses usually the mathematically correct right-handed system, while DirectX usually uses a left-handed system, but both consider y as up and x as right.

#8 Biopsy

  • New Members
  • 22 posts

Posted 30 April 2012 - 06:05 PM

 Bunny83, on 29 April 2012 - 01:58 AM, said:

Well, i guess almost every real coder has already done this in a similar way (including myself) :)/>
I figured as much - I was just looking for ideas on how I could improve and expand it.

 Bunny83, on 29 April 2012 - 01:58 AM, said:

I don't really play MP. I just mess around in SP. However it looks quite solid, but i would hook all native move functions so you can still use the "go" program and others. You can use rawset to overwrite the functions with your own, but don't forget to backup the native ones :)/>
Cool! I had no idea you could do that. Lua seems rather closed-minded when it comes to function overloading so I hadn't really considered the possibility. That would make daughter applications much less annoying to write.

 Bunny83, on 29 April 2012 - 01:58 AM, said:

Also i just like to add that most game engines have this axis setup (at least all pure 3D engines). It's derived from the usual view direction which is along the ground. An unaltered transformation matrix (identity) will make you look along the z-axis since x and y belong to the screen coordinates. Depending on the mathematical system used (left or right handed) the z axis might be inverted. OpenGL uses usually the mathematically correct right-handed system, while DirectX usually uses a left-handed system, but both consider y as up and x as right.
Interesting! The only background I have in this sort of coding is in army simulations which are decidedly not 3D. My approach in mapping turtle coordinates was purely from a top-down perspective, where f=2 is north, f=0 is south, so x increases to the east, and y increases to the south the same way screen coordinates often do. Then Z as depth is sort of an abstract 'state' rather than position. That made it really easy to write my listener app because it just takes into account screen size to create a scale multiplier and then applies that to x and y with relation to their min/max reported state to display my turtle on a screen that can 'infinitely' scale to display turtle movement in relation to its home point, mining point and dropoff point. Unfortunately because i'm scaling the x and y axis independently, the ratio gets skewed, and I need to fix that. It's also severely limited by the maximum range of rednet. I've been trying to come up with a message rebroadcasting system that would allow me to monitor from farther away, but i hit limitations with textutils.unserialize with nested tables and haven't gone back to re-think it.

#9 Biopsy

  • New Members
  • 22 posts

Posted 30 April 2012 - 06:09 PM

I just wish i could change color values on the screen to reflect depth. It's disconcerting when the turtle on my display stops moving to ascend 64 blocks and there's no feedback about what it's doing.

#10 Nada

  • New Members
  • 1 posts

Posted 06 May 2012 - 03:37 AM

Sorry for my english ..
I could not start "aware"
you may describe more detailed how to install it properly ..?
I tried to follow the instructions to install it, but I must have done something wrong because it does not start.
thanks in advance

#11 digpoe

  • Members
  • 92 posts

Posted 07 May 2012 - 04:28 PM

I couldn't start it on my friends SMP server, i told him to install it and he installed it correctly, but for some reason it says the API doesn't exist.
And.. on SSP, I get a Rednet error:
rednet:322: attempt to call nil

#12 Biopsy

  • New Members
  • 22 posts

Posted 11 May 2012 - 11:45 PM

the rednet error would likely be because i'm assuming it's a wireless mining turtle, there should really be a toggle for that.
are you using the os.loadapi function to initialize it?

Sorry for the slow replies, folks - still looking for a tekkit or CC server where computercraft isn't broken or severely limited to test on.

#13 Biopsy

  • New Members
  • 22 posts

Posted 11 May 2012 - 11:51 PM

installation instructions updated/clarified

#14 Biopsy

  • New Members
  • 22 posts

Posted 14 May 2012 - 08:57 PM

Today I finished a couple new programs that make use of this API.
biodesign
-allows you to, using the terminal, design any structure up to 18x46 (height unlimited)
- these are saved to a directory structure based on the design name
biobuild
- run from a turtle, automatically builds a structure designed in the application above

these will be posted soon, after some further testing (likely later tonight)

#15 Biopsy

  • New Members
  • 22 posts

Posted 16 May 2012 - 03:57 PM

I settled down to post the new source code and make a couple demo videos last night and ended up retooling every single program.
Version 2.0 is imminent and should be easier to set up (no longer resides in a directory)
  • Designer program is a bit more polished and will allow you to design and build any structure up to ~46x16xN, with the ability to copy/paste entire levels.
  • Builder works with updated designer files. Uses aware to build any structure you can create inside designer autonomously. Though you may have to manually refill if you use too many of the same inventory slot.
  • Listener now attempts to roughly scale display feedback from miner so it's not stretched on a non-square display
  • 2 new 'api' libraries required for some of the applications: utils and matrix, these will also be posted here
  • utils includes the ability to download a text file off the internet if http api is installed, making installing/updating all of these files easier


#16 Biopsy

  • New Members
  • 22 posts

Posted 17 May 2012 - 03:38 AM

As promised, the majority of 2.0 is now posted.
Feedback please :-)
biomine and biolisten are coming, but i'm tired and the video prep for biomine is going to be a bit of a pain.

#17 Biopsy

  • New Members
  • 22 posts

Posted 17 May 2012 - 09:35 PM

No way biomine and biolisten are going up tonight - going to be working into the night at the office. And i have tickets to the Black Keys tomorrow :-)
look forward to it this weekend.

#18 Biopsy

  • New Members
  • 22 posts

Posted 21 May 2012 - 10:41 PM

anyone making use of this?

I need suggestions/feedback for features etc for the next version.
I've already changed how all the files are saved to use a more centralized prefs-file style format that saves and reads n key/value pairs to file. In the next version all aware locations are stored in 1 file, and each design is its own file rather than a directory containing separate layer files.
With this approach, a design can (and will, if there's interest) support an inventory section that defines what blocks go in which slot, allowing for more than 63 of a block type before needing a refill - this would be part of the design program. I'd also like to add views that would allow a front to back, or side to side view rather than just top-down.
Perhaps also the ability to generate standard shapes (rectangle, hollow/filled, size n at x location)

I've also been testing the download function to allow any of the programs to be downloaded from the internet provided the http api is enabled, this works well :-).

Likely won't fuss with any of these things more if people aren't interested.

#19 kazagistar

  • Members
  • 365 posts

Posted 21 May 2012 - 10:58 PM

Man, you have really upped the ante. Basically, you did a lot of the stuff I was working on, so now I have to make something even harder.

Hmm... fully networked turtle swarms with proper spacial awareness doing all of the above tasks seems like a good new target point. Let the games begin!

(I mean, I could just use your APIs and stuff, but I think part of the problem with computercraft is that 95% of the fun is writing the code).

#20 Biopsy

  • New Members
  • 22 posts

Posted 22 May 2012 - 12:57 AM

true enough :-)
most of what I've done so far is geared towards single turtles, for sure - mostly because of a lack of collusion avoidance.
All the solutions i came up with in the past would require the entire turtle work on some sort of action queue allowing it to listen for rednet signals and keep a running list of other turtle positions - but that won't work for non-wireless turtles and that annoys me. Plus, it would have to somehow negotiate what is a turtle that was broken at X location, and what turtles are simply idle - lots of things i don't really want to deal with for my own purposes.

I did get a pretty awesome idea yesterday that solves all of that -- in theory -- passively.
But i haven't yet started in on it or tested the mechanics really.
Also need to figure out conflict negotiation using logic rather than communication, because i don't want to have to rely on rednet at all.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users