Skip to content

Commit 026d60e

Browse files
committed
Added 'mass' and 'inertia' attributes to BoatProperties class.
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.
1 parent 058ebe4 commit 026d60e

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/boat_simulator/boat_simulator/common/constants.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
from enum import Enum
66
from typing import Dict
77

8+
import numpy as np
9+
810

911
# Class declarations for constants. These are not meant to be accessed directly.
1012
@dataclass
@@ -41,6 +43,8 @@ class BoatProperties:
4143
sail_dist: float # Meters
4244
rudder_dist: float # Meters
4345
hull_drag_factor: float # Dimensionless
46+
mass: float # Kilograms
47+
inertia: np.ndarray # Kilogram meter squared
4448

4549

4650
# Directly accessible constants
@@ -92,4 +96,6 @@ class BoatProperties:
9296
sail_dist=5.0,
9397
rudder_dist=1.5,
9498
hull_drag_factor=0.05,
99+
mass=200.0,
100+
inertia=np.array([[10, 0, 0], [0, 30, 0], [0, 0, 20]], dtype=np.float32),
95101
)

src/boat_simulator/boat_simulator/nodes/physics_engine/physics_engine_node.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def __init_private_attributes(self):
111111
self.__sail_trim_tab_angle = 0
112112
self.__desired_heading = None
113113
self.__boat_state = BoatState(
114-
0.5, 1, np.array([[0.5, 0.5, 0.5], [0.0, 0.5, 0.5], [0.0, 0.0, 0.5]], dtype=np.float32)
114+
0.5, Constants.BOAT_PROPERTIES.mass, Constants.BOAT_PROPERTIES.inertia
115115
)
116116
self.__wind_generator = FluidGenerator(
117117
generator=MVGaussianGenerator(np.array([5, 5]), np.array([[2, 1], [1, 2]]))

0 commit comments

Comments
 (0)