Skip to content

Conversation

arynrosh
Copy link
Contributor

  • Created a private instance of the WindSensor class in the physics engine node.
  • Added a new private method: __update_wind_sensor(). This method updates the wind attribute of the WindSensor instance using the wind generator (self.__wind_generator).
  • Integrated __update_wind_sensor() call right before self.__update_boat_state() in the __publish() function.
  • Modified the self.__update_boat_state() method to use data from the WindSensor instead of the wind generator, introducing realistic noise into the simulation.
  • Resolves Update physics engine node to use WindSensor #426

Update the BOAT_PROPERTIES instance to include mass and inertia values.

Replaced second and third parameters in the initialization of self.__boat_state with BOAT_PROPERTIES.
… engine node.

- Added a new private method: `__update_wind_sensor()`. This method updates the `wind` attribute of the `WindSensor` instance using the wind generator (`self.__wind_generator`).
- Integrated `__update_wind_sensor()` call right before `self.__update_boat_state()` in the `__publish()` function.
- Modified the `self.__update_boat_state()` method to use data from the `WindSensor` instead of the wind generator, introducing realistic noise into the simulation.
- Resolves #426
@arynrosh arynrosh requested a review from eomielan as a code owner August 16, 2024 22:17
def __update_wind_sensor(self):
"""Updates the wind sensor with the latest wind data from the wind generator."""
wind_data = self.__wind_generator.next()
self.__wind_sensor.speed.speed = wind_data[0]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just happened to stumble upon this. You shouldn't have to assign the private members in this way. The update method is there to help you out, and you get additional functionality with noise/delays if you want. Try self.update(wind=wind_data[0])?

See the wind sensor tests for an example of this type of call.

"""Updates the wind sensor with the latest wind data from the wind generator."""
wind_data = self.__wind_generator.next()
self.__wind_sensor.speed.speed = wind_data[0]
self.__wind_sensor.direction = wind_data[1]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

direction doesn't look like a field in the WindSensor class, you'll have to add it by following the pattern of other fields in these classes (ex: wind field)

@eomielan
Copy link
Member

Issue with be addressed in a separate PR

@eomielan eomielan closed this Oct 19, 2024
@eomielan eomielan deleted the user/arynrosh/update-physics-eng-to-use-wind-sensor-426 branch October 19, 2024 21:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update physics engine node to use WindSensor
4 participants