From 8351bf16aa568cc2c18f37a4c7db29ab98faf64c Mon Sep 17 00:00:00 2001 From: Guillaume ARM Date: Wed, 8 May 2024 22:43:36 +0200 Subject: [PATCH] fix: orient the robot in the correct direction when returning to home --- miner.lua | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/miner.lua b/miner.lua index d9b81de..49a26b2 100644 --- a/miner.lua +++ b/miner.lua @@ -196,6 +196,10 @@ local function returnHomeProcedure() if robotState.x == 0 and robotState.y == 0 and robotState.z == 0 then miner.mission = 'unload' elseif robotState.x == 0 and robotState.z == 0 then + while miner.robot.getState().dir ~= 'FORWARD' do + miner.robot.turnRight() + end + miner.robot.up() elseif robotState.x > 0 then if robotState.dir == 'FORWARD' then