Stationeers - Interesting Robot (LArRE) Farming Solution V1
Вставка
- Опубліковано 6 вер 2024
- Describes an interesting approach for automating farming using the robot arm (LArRE) without any hydroponics devices.
Script used to control the robot and import bin:
alias dRobotArm d0
alias dImportChute d1
define MinTrayStationIndex 0
define MaxTrayStationIndex 34
define ImportStationIndex 35
alias varFarmStationIndex r8
alias varPrevStationIndex r9
alias varRobotArmOccupied r10
alias paramIndex r12
initialize:
move varFarmStationIndex MinTrayStationIndex
move varPrevStationIndex MaxTrayStationIndex
mainLoop:
jal fnGotoFarmStation
jal fnPickFirstAndPlantPrev
jal fnPickRemaining
jal fnIncStationIndex
endMainLoop:
j mainLoop
fnPickFirstAndPlantPrev:
push ra
jal fnActivateArm
jal fnGotoPrevStation
jal fnActivateArm
jal fnGotoFarmStation
pop ra
j ra
fnPickRemaining:
push ra
jal fnActivateArm
breqz varRobotArmOccupied 3
jal fnPutImport
jr -3
pop ra
j ra
fnPutImport:
push ra
jal fnGotoImportStation
jal fnActivateArm
s dImportChute Open 0
yield
s dImportChute Open 1
jal fnGotoFarmStation
pop ra
j ra
fnGotoStation:
push ra
s dRobotArm Setting paramIndex
jal fnWaitForIdle
pop ra
j ra
fnGotoFarmStation:
push ra
move paramIndex varFarmStationIndex
jal fnGotoStation
pop ra
j ra
fnGotoPrevStation:
push ra
move paramIndex varPrevStationIndex
jal fnGotoStation
pop ra
j ra
fnGotoImportStation:
push ra
move paramIndex ImportStationIndex
jal fnGotoStation
pop ra
j ra
fnIncStationIndex:
move varPrevStationIndex varFarmStationIndex
add varFarmStationIndex varFarmStationIndex 1
brle varFarmStationIndex MaxTrayStationIndex 2
move varFarmStationIndex MinTrayStationIndex
j ra
fnActivateArm:
push ra
s dRobotArm Activate 1
jal fnWaitForIdle
ls varRobotArmOccupied dRobotArm 0 Occupied
pop ra
j ra
fnWaitForIdle:
yield
l r0 dRobotArm Idle
beqz r0 fnWaitForIdle
j ra
This is a nice, clean, and effective setup and coding.
It's not fast, but it is constant.
Great idea. Even better execution. ❤
To make it faster without too much work, just reduce the number of trays. Then add some logic to slow down a little if first picks are not seeds. And/or just replicate the entire setup. Imagine ten running in parallel .
Idea. Feed the output into a Stacker ;)
Yep, I believe I did comment that a stacker could be used with the output. The assumption is the output will be used as input for some automated process, so the use of the stacker may not be required.
For the investment that seems very simple and efficient to my inexperienced eye. I would definitely need to put this in a separate room out of earshot. Too noisy!
The audio didn't work out as I like. This was a live capture and I typically do voice overs (so the game sounds and voice are different tracks). In the future, I will just disable the game sounds if doing live video for automation videos.
Future Improvements (so far):
1. Check that the robot arm is empty after dropping item in import bin, if not then signal alarm, sleep, and retry.
2. If on a "first pick", nothing is acquired, signal alarm.
3. If on a "first pick", if not a seed, sleep for 1 minute and continue. (will permit reducing trays to speed up operation)
I expect this starts again at zero whenever you reload the game or tweak the code? Maybe an external memory chip would help it remember where to resume?
If the code is updated, then could manually update the two lines in the "initialize:" section with hard coded number. Smart restarting is difficult as it needs to know if in a first pick or next pick state, or in the middle of dropping something off in the import bin. It would be possible to put all that state in memory (shifting bits around), but would increase code complexity and difficult to test.