Look along path while approaching beds

This commit is contained in:
Tanner
2026-11-07 23:21:41 +00:00
parent 9cbadbd551
commit 11add13779
4 changed files with 64 additions and 6 deletions
+14 -1
View File
@@ -2,7 +2,10 @@ import unittest
from munch import Munch
from mosfet.bot import look_direction_from_eye, update_pitch, update_yaw
from mosfet.bot import (
look_direction_from_eye, navigation_look_target, update_pitch,
update_yaw,
)
from mosfet.vector import Point3D, Vector3D
@@ -58,6 +61,16 @@ class TestFarmingPitch(unittest.TestCase):
self.assertGreaterEqual(state.yaw, -180.0)
self.assertLess(state.yaw, 180.0)
def test_path_navigation_looks_at_the_block_above_its_waypoint(self):
path = [(index, 64, 0) for index in range(6)]
target = navigation_look_target(path)
self.assertEqual(target.tuple(), (4, 65, 0))
self.assertEqual(navigation_look_target([(1, 64, 2)]).tuple(),
(1, 65, 2))
self.assertIsNone(navigation_look_target([]))
def test_pitch_tracks_look_target_instead_of_a_fixed_farming_angle(self):
state = Munch(pitch=0.0)
direction_to_crop = LookDirection(45.0)