Skip to content

Commit 4dc7f5b

Browse files
committed
Fix: use warning instead of printf
1 parent 9f8a93b commit 4dc7f5b

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

rocketpy/rocket/actuator/actuator.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from abc import ABC, abstractmethod
2-
2+
import warnings
33
import numpy as np
44

55

@@ -86,8 +86,8 @@ def _update_iir_coefficients(self):
8686
self.actuator_time_constant + demand_period
8787
)
8888
else:
89-
print(
90-
f"Warning: Actuator time constant currently only implemented on discrete controllers. '{self.name}' dynamics not applied."
89+
warnings.warn(
90+
f"Actuator time constant currently only implemented on discrete controllers. '{self.name}' dynamics not applied."
9191
)
9292
self._alpha = 1.0 # No filtering, direct pass-through
9393
else:
@@ -120,21 +120,21 @@ def actuator_output(self, value):
120120
change = value - self._actuator_output
121121
if abs(change) > max_change:
122122
value = self._actuator_output + np.sign(change) * max_change
123-
print(
124-
f"Warning: Actuator '{self.name}' output change {change:.3f} exceeds rate limit of {max_change:.3f} per time step."
123+
warnings.warn(
124+
f"Actuator '{self.name}' output change {change:.3f} exceeds rate limit of {max_change:.3f} per time step."
125125
)
126126
else:
127-
print(
128-
f"Warning: Actuator rate limit currently only implemented for discrete controllers. '{self.name}' rate limit not applied."
127+
warnings.warn(
128+
f"Actuator rate limit currently only implemented for discrete controllers. '{self.name}' rate limit not applied."
129129
)
130130

131131
# Apply range limits if specified
132132
if self.clamp:
133133
value = np.clip(value, self.actuator_range[0], self.actuator_range[1])
134134
else:
135135
if value < self.actuator_range[0] or value > self.actuator_range[1]:
136-
print(
137-
f"Warning: Actuator '{self.name}' output {value:.3f} exceeds range limits {self.actuator_range}."
136+
warnings.warn(
137+
f"Actuator '{self.name}' output {value:.3f} exceeds range limits {self.actuator_range}."
138138
)
139139

140140
self._actuator_output = value

0 commit comments

Comments
 (0)