Skip to content

Commit

Permalink
Merge branch 'main' into user/lross03/260-log-sensor-data
Browse files Browse the repository at this point in the history
  • Loading branch information
samdai01 authored Nov 23, 2024
2 parents 95b1ddc + 7d9960d commit 183d6ad
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 14 deletions.
2 changes: 1 addition & 1 deletion docs/current/sailbot_workspace/usage/setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ allowing it to be installed on Windows and macOS in addition to Linux.

[^1]: [Wikipedia Docker page](https://en.wikipedia.org/wiki/Docker_(software)){target=_blank}
[^2]: [Get Docker](https://docs.docker.com/get-docker/){target=_blank}
[^3]: [What is the difference between Docker Desktop for Linux and Docker Engine](https://docs.docker.com/desktop/faqs/linuxfaqs/#what-is-the-difference-between-docker-desktop-for-linux-and-docker-engine){target=_blank}
[^3]: [What is the difference between Docker Desktop for Linux and Docker Engine](https://www.docker.com/blog/how-to-check-docker-version){target=_blank}

=== ":material-microsoft-windows: Windows"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@

import boat_simulator.common.constants as Constants
from boat_simulator.common.generators import MVGaussianGenerator
from boat_simulator.common.sensors import SimWindSensor
from boat_simulator.common.types import Scalar
from boat_simulator.nodes.physics_engine.fluid_generation import FluidGenerator
from boat_simulator.nodes.physics_engine.model import BoatState
Expand Down Expand Up @@ -182,6 +183,10 @@ def __init_private_attributes(self):
generator=MVGaussianGenerator(current_mean, current_cov)
)

# No delay in this instance
sim_wind = self.__wind_generator.next()
self.__sim_wind_sensor = SimWindSensor(sim_wind, enable_noise=True)

def __init_callback_groups(self):
"""Initializes the callback groups. Whether multithreading is enabled or not will affect
how callbacks are executed.
Expand Down Expand Up @@ -318,6 +323,21 @@ def __publish(self):
self.__publish_kinematics()
self.__publish_counter += 1

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.
"""
# Wind parameter in line below introduces noise
self.__sim_wind_sensor.wind = self.__wind_generator.next()
self.__boat_state.step(
self.__sim_wind_sensor.wind,
self.__current_generator.next(),
self.__rudder_angle,
self.__sail_trim_tab_angle,
)

def __publish_gps(self):
"""Publishes mock GPS data."""
# TODO Update to publish real data
Expand Down Expand Up @@ -586,19 +606,6 @@ 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

0 comments on commit 183d6ad

Please sign in to comment.