Skip to content

Commit 7c7587d

Browse files
committed
Fix actuator unit tests
1 parent eca155d commit 7c7587d

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

tests/unit/rocket/test_actuators.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,14 @@ def test_initialization_defaults(self):
106106
assert actuator.name == "Throttle Control"
107107
assert actuator.demand_rate == 100
108108
assert actuator.actuator_range == (0, 1)
109-
assert actuator.throttle == 0.0
109+
assert actuator.throttle == 1.0
110110

111111
def test_initialization_custom(self):
112112
"""Test ThrottleActuator initialization with custom parameters."""
113113
actuator = ThrottleActuator(
114114
name="Custom Throttle",
115115
demand_rate=50,
116-
max_throttle=0.8,
116+
throttle_range=(0, 0.8),
117117
throttle_rate_limit=0.1,
118118
initial_throttle=0.5,
119119
)
@@ -123,13 +123,13 @@ def test_initialization_custom(self):
123123

124124
def test_throttle_property(self):
125125
"""Test throttle getter and setter."""
126-
actuator = ThrottleActuator(max_throttle=1.0)
126+
actuator = ThrottleActuator(throttle_range=(0, 1.0))
127127
actuator.throttle = 0.5
128128
assert actuator.throttle == 0.5
129129

130130
def test_throttle_clamping(self):
131131
"""Test throttle clamping to range."""
132-
actuator = ThrottleActuator(max_throttle=1.0, clamp=True)
132+
actuator = ThrottleActuator(throttle_range=(0, 1.0), clamp=True)
133133
actuator.actuator_output = 1.5
134134
assert actuator.throttle == 1.0
135135
actuator.actuator_output = -0.5
@@ -139,13 +139,13 @@ def test_to_dict(self):
139139
"""Test to_dict serialization."""
140140
actuator = ThrottleActuator(
141141
name="Test Throttle",
142-
max_throttle=0.8,
142+
throttle_range=(0, 0.8),
143143
throttle_rate_limit=0.1,
144144
initial_throttle=0.3,
145145
)
146146
data = actuator.to_dict()
147147
assert data["name"] == "Test Throttle"
148-
assert data["max_throttle"] == 0.8
148+
assert data["throttle_range"] == (0, 0.8)
149149
assert data["throttle_rate_limit"] == 0.1
150150
assert data["initial_throttle"] == 0.3
151151

@@ -154,7 +154,7 @@ def test_from_dict(self):
154154
data = {
155155
"name": "Test Throttle",
156156
"demand_rate": 50,
157-
"max_throttle": 0.8,
157+
"throttle_range": (0, 0.8),
158158
"throttle_rate_limit": 0.1,
159159
"clamp": True,
160160
"initial_throttle": 0.3,
@@ -355,9 +355,10 @@ def test_no_rate_limiting_when_none(self):
355355
def test_time_constant_iir_filter(self):
356356
"""Test IIR filter behavior with time constant."""
357357
actuator = ThrottleActuator(
358-
max_throttle=1.0,
358+
throttle_range=(0, 1.0),
359359
demand_rate=100,
360360
throttle_time_constant=0.1,
361+
initial_throttle=0.0,
361362
)
362363
# With time constant, output should be filtered
363364
# alpha = Ts / (tau + Ts) = 0.01 / (0.1 + 0.01) ≈ 0.0909

0 commit comments

Comments
 (0)