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
16 окт 2024