Skip to content

Commit

Permalink
added logs for monitoring, changed timeout value
Browse files Browse the repository at this point in the history
  • Loading branch information
LukasBaecker committed Jul 19, 2024
1 parent ca89278 commit ffd78f8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from typing import TYPE_CHECKING, Any

import numpy as np

import rosys
from nicegui import ui
from rosys.helpers import eliminate_2pi
Expand Down Expand Up @@ -57,6 +58,8 @@ async def _drive(self, distance: float):
else:
target_yaw = self.odometer.prediction.yaw
target_yaw = self.combine_angles(target_yaw, self.crop_attraction, self.odometer.prediction.yaw)
self.log.info(
f'Driving {distance:.2f}m from {self.start_position} with {target_yaw}(yaw) with front_point {front_point}')
await self._drive_to_yaw(distance, target_yaw)

def combine_angles(self, angle1: float, influence: float, angle2: float) -> float:
Expand Down
2 changes: 1 addition & 1 deletion field_friend/automations/navigation/navigation.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ async def _drive(self, distance: float) -> None:
"""Drives the vehicle a short distance forward"""

async def _drive_to_yaw(self, distance: float, yaw: float):
deadline = rosys.time() + 2
deadline = rosys.time() + 5
start_position = self.odometer.prediction.point
yaw -= self.odometer.prediction.yaw # take current yaw into account and only steer the difference
with self.driver.parameters.set(linear_speed_limit=self.linear_speed_limit, angular_speed_limit=self.angular_speed_limit):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ async def _drive(self, distance: float):
closest_point = rosys.geometry.Line.from_points(self.origin, self.target).foot_point(start_position)
local_target = rosys.geometry.Pose(x=closest_point.x, y=closest_point.y, yaw=start_position.direction(self.target), time=0) \
.transform(rosys.geometry.Point(x=1, y=0))
self.log.info(
f'Driving {distance:.2f}m from {start_position} to {local_target} with closest point {closest_point}')
await self._drive_to_yaw(distance, start_position.direction(local_target))

def _should_finish(self):
Expand Down

0 comments on commit ffd78f8

Please sign in to comment.