|
41 | 41 | IMPEDANCE_A = 0.00028444 |
42 | 42 | IMPEDANCE_C = 0.0007812 |
43 | 43 |
|
44 | | -DEFAULT_MIN_TORQUE_CONSTANT = 0.07 |
| 44 | +DEFAULT_MIN_TORQUE_CONSTANT = 0.08 |
| 45 | +DEFAULT_MAX_TORQUE_CONSTANT = 0.25 |
45 | 46 |
|
46 | 47 | DEPHY_ACTUATOR_CONSTANTS = MOTOR_CONSTANTS( |
47 | 48 | MOTOR_COUNT_PER_REV=16384, |
48 | | - NM_PER_AMP=0.145, |
| 49 | + NM_PER_AMP=0.1133, |
49 | 50 | MAX_CASE_TEMPERATURE=80, |
50 | 51 | MAX_WINDING_TEMPERATURE=110, |
51 | 52 | ) |
@@ -139,19 +140,19 @@ def __init__( |
139 | 140 | baud_rate: int = 230400, |
140 | 141 | frequency: int = 500, |
141 | 142 | debug_level: int = 4, |
142 | | - torque_constant: float = 0.145, # old motor constant 0.1133 Nm/A |
| 143 | + torque_constant: float = 0.1133, # new motor constant 0.145 Nm/A |
143 | 144 | dephy_log: bool = False, |
144 | 145 | offline: bool = False, |
145 | 146 | stop_motor_on_disconnect: bool = True, |
146 | 147 | ) -> None: |
147 | | - if torque_constant <= DEFAULT_MIN_TORQUE_CONSTANT: |
| 148 | + if torque_constant < DEFAULT_MIN_TORQUE_CONSTANT or torque_constant > DEFAULT_MAX_TORQUE_CONSTANT: |
148 | 149 | LOGGER.error( |
149 | | - f"[{str.upper(tag)}] torque_constant={torque_constant} Nm/A is unusually low. " |
| 150 | + f"[{str.upper(tag)}] torque_constant={torque_constant} Nm/A is outside the valid range. " |
150 | 151 | "Low torque constant will cause the motor to draw more current for the same torque. " |
151 | | - "Verify your value: typical Dephy defaults are 0.1133 Nm/A (older motors)" |
| 152 | + "Verify your value: typical Dephy torque constants are 0.1133 Nm/A (older motors)" |
152 | 153 | " and 0.145 Nm/A (newer motors)." |
153 | 154 | ) |
154 | | - raise ValueError("Torque constant is too low") |
| 155 | + raise ValueError("Torque constant is outside the valid range") |
155 | 156 | motor_constants = dataclasses.replace(DEPHY_ACTUATOR_CONSTANTS, NM_PER_AMP=torque_constant) |
156 | 157 | ActuatorBase.__init__( |
157 | 158 | self, |
@@ -802,7 +803,6 @@ def motor_torque(self) -> float: |
802 | 803 | >>> actuator.start() |
803 | 804 | >>> print(f"Motor torque: {actuator.motor_torque} Nm") |
804 | 805 | """ |
805 | | - print(self.MOTOR_CONSTANTS.NM_PER_MILLIAMP) |
806 | 806 | if self._data is not None: |
807 | 807 | return float(self._data["mot_cur"] * self.MOTOR_CONSTANTS.NM_PER_MILLIAMP) |
808 | 808 | else: |
@@ -1236,18 +1236,18 @@ def __init__( |
1236 | 1236 | baud_rate: int = 230400, |
1237 | 1237 | frequency: int = 500, |
1238 | 1238 | debug_level: int = 4, |
1239 | | - torque_constant: float = 0.145, # old motor constant 0.1133 Nm/A |
| 1239 | + torque_constant: float = 0.1133, # new motor constant 0.145 Nm/A |
1240 | 1240 | dephy_log: bool = False, |
1241 | 1241 | offline: bool = False, |
1242 | 1242 | ) -> None: |
1243 | | - if torque_constant <= DEFAULT_MIN_TORQUE_CONSTANT: |
| 1243 | + if torque_constant < DEFAULT_MIN_TORQUE_CONSTANT or torque_constant > DEFAULT_MAX_TORQUE_CONSTANT: |
1244 | 1244 | LOGGER.error( |
1245 | | - f"[{str.upper(tag)}] torque_constant={torque_constant} Nm/A is unusually low. " |
| 1245 | + f"[{str.upper(tag)}] torque_constant={torque_constant} Nm/A is outside the valid range. " |
1246 | 1246 | "Low torque constant will cause the motor to draw more current for the same torque. " |
1247 | | - "Verify your value: typical Dephy defaults are 0.1133 Nm/A (older motors)" |
| 1247 | + "Verify your value: typical Dephy torque constants are 0.1133 Nm/A (older motors)" |
1248 | 1248 | " and 0.145 Nm/A (newer motors)." |
1249 | 1249 | ) |
1250 | | - raise ValueError("Torque constant is too low") |
| 1250 | + raise ValueError("Torque constant is outside the valid range") |
1251 | 1251 | motor_constants = dataclasses.replace(DEPHY_ACTUATOR_CONSTANTS, NM_PER_AMP=torque_constant) |
1252 | 1252 | ActuatorBase.__init__( |
1253 | 1253 | self, |
|
0 commit comments