Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Boat state update with new wind and current vectors #415

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,7 @@ def __init_timer_callbacks(self):
# PUBLISHER CALLBACKS
def __publish(self):
"""Synchronously publishes data to all publishers at once."""
self.__update_boat_state()
# TODO Get updated boat state and publish (should this be separate from publishing?)
# TODO Get wind sensor data and publish (should this be separate from publishing?)
self.__publish_gps()
Expand Down Expand Up @@ -554,6 +555,19 @@ def __sail_action_feedback_callback(
.double_value,
)

def __update_boat_state(self):
"""
Generates the next vectors for wind_generator and current_generator and updates the
boat_state with the new wind and current vectors along with the rudder_angle and
sail_trim_tab_angle.
"""
self.__boat_state.step(
self.__wind_generator.next(),
self.__current_generator.next(),
self.__rudder_angle,
self.__sail_trim_tab_angle,
)

# CLASS PROPERTY PUBLIC GETTERS
@property
def is_multithreading_enabled(self) -> bool:
Expand Down
Loading