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

Ryo Chopper v.1.2

Started by Ryo_Pasternak, 07 December 2013 - 10:02 AM
Ryo_Pasternak #1
Posted 07 December 2013 - 11:02 AM
Ryo Chopper v.1.2

Let's me introduce a simple but technology rich program for turtles. Yet another tree chopper. :-) It's aimed primary to run compact IC2 Rubber Farm.

Download
http://pastebin.com/3pxi64UX

Features
* Adjustable farm size
* Returns to work after world disasters (for example after server restarts)
* Never stuck in tree leaves or interrupted by other obstacles

Limitations
* Can handle 1x1 trees only and without branches

System requirements
* Turtle with ability to dig trees (i.e. with axe or pickaxe) and with Wireless Modem installed for GPS
* OpenPeripheral for high-efficient access to chest (or to any machinery with inventory)
* Deployed GPS (i.e. 4 computers running gps host program)

Usage
chop x y z direction length width
where:
* x,y,z - coordinates of the farm base
* direction - "north", "south", "east" or "west" side from base where tree farm was built
* length - length of tree farm in trees
* width - width of tree farm in trees

Example for picture below:
chop 25 64 250 north 3 3

Autostart
It's recommended to create a startup script like this:
shell.run("chop","x y z direction length width")
Now turtle can return to base after server restart or other interruptions.

Initial setup
1. Create a farm by placing a dirt blocks with 1 block gap (see "Top view" picture) and a saplings gathering system below for example "water conveyor" ended with ME Transition Plane
2. Farm base will be a two block above dirt blocks, place chest below base (see "Side view" picture)
3. Place fuel for turtle (coal, charcoal, etc.) to first slot (most top left) of the chest and saplings to the second slot.
NOTE: Fuel and saplings must be automatically renewed by third-party machinery. Also extra saplings and chopped wood (dropped inside chest by turtle) must be immediately removed. I used a ME Interface from Applied Energistics, it's very simple.
4. Place turtle to the farm base and download program to it:
pastebin get 3pxi64UX chop
5. Detect farm base coordinates using GPS program:
gps locate
6. Create startup script
7. Reboot (Ctrl+R)

Farm blueprints


Algorithm
When program starts a turtle obtains its GPS coordinates and returns to farm base. After that it loads a fuel from first slot of the chest below to first slot of internal inventory and saplings correspondingly to the second slot. Turtle uses its second slot for saplings detection in the world and planting a new ones, anything other than saplings will be detected like "tree" and will be chopped. Also turtle sucks all that fall on its track.

Changelog
v.1.2
- Added check for clear sky above sapling

v.1.1
- Reduced saplings minimum from 2 to 1

v.1
- First release
Edited on 29 December 2013 - 10:00 AM
Eyo #2
Posted 07 December 2013 - 11:32 AM
Wow. Wireless/Gps is clearly my next move too :)/>
It seems very efficient and that feature of resisting to server resets/obstacles is very interesting.

Watching your top view scheme, i think you could have a shortest route if you make the turtle turn left before the last row. It implies you have to collect wood during the returning route, it may be a problem in your program.

You seem to compare saplings to know if you have to chop or not. I think it might bug sometimes because the turtle.compare() function fails to detect 'Level2' saplings with 'Level1' saplings (those you have in inventory). I think sapling blocks might have various states of growth that makes the function compare() fail. At least it happened to me until I decided to detect wood instead of saplings. Compare() fails with dirt to (wether there is grass or not on it)