Monitors motor current, detects overcurrent (soft 5A, hard 8A), models thermal
state using I^2R heating model, and applies speed derating for safe operation.
Overcurrent Protection:
- Soft limit: 5A (warning, trigger speed derating)
- Hard limit: 8A (fault, immediate shutdown)
- Monitors both left and right motor currents
- Triggers emergency stop on hard fault
Thermal Derating (I^2R Model):
Heat generation: P_loss = I^2 * R (both motors combined)
Heat dissipation: P_cool = cooling_constant * ΔT
Temperature dynamics: dT/dt = (P_loss - P_cool) / thermal_mass
Temperature-based speed derating:
- Full speed at ambient temperature
- Linear derating from 25°C to 80°C limit
- Aggressive derating near 80°C limit
- Zero speed at or above 80°C
Combined Protection:
- Speed derate = min(current_derate, thermal_derate)
- Hard fault → 0% speed (immediate stop)
- Soft fault → gradual derating based on current
- High temperature → gradual derating approaching zero
- Provides protective action before damage
Published Topics:
- /saltybot/motor_protection (std_msgs/String) - JSON status
* state (NORMAL/SOFT_FAULT/HARD_FAULT)
* current_left, current_right, current_max (A)
* motor_temp (°C)
* soft/hard limits
- /saltybot/speed_limit (std_msgs/Float32) - Thermal derate [0, 1]
Subscribed Topics:
- /saltybot/motor_current_left (std_msgs/Float32) - Left motor (A)
- /saltybot/motor_current_right (std_msgs/Float32) - Right motor (A)
Package: saltybot_motor_protection
Entry point: motor_protection_node
Frequency: 50Hz (20ms cycle)
Thermal Model Parameters:
- Motor resistance: 1.5 Ω
- Thermal mass: 100 J/°C
- Ambient temperature: 25°C
- Max safe temperature: 80°C
- Cooling constant: 0.05 1/s
Features:
✓ Multi-motor current monitoring (worst-case approach)
✓ I^2R Joule heating with passive cooling
✓ Exponential temperature dynamics
✓ Two-level overcurrent protection
✓ Combined current+thermal derating
✓ Soft fault duration tracking
✓ Automatic recovery on current drop
✓ JSON telemetry with state and metrics
Tests: 25+ unit tests covering:
- ThermalModel initialization and parameters
- Current subscription and clamping
- Overcurrent detection (soft, hard)
- Fault recovery and state transitions
- Joule heating calculation (I^2R)
- Temperature rise and cooling
- Speed derating (normal, soft fault, thermal, hard fault)
- Derate clipping and bounds
- JSON status format
- Realistic scenarios (thermal rise, overcurrent spike, asymmetric loading)
- Combined current+thermal derating
Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
30 lines
1.0 KiB
XML
30 lines
1.0 KiB
XML
<?xml version="1.0"?>
|
|
<?xml-model href="http://download.ros.org/schema/package_format3.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
|
|
<package format="3">
|
|
<name>saltybot_motor_protection</name>
|
|
<version>0.1.0</version>
|
|
<description>
|
|
Motor current protection node for SaltyBot: overcurrent detection (soft 5A, hard 8A)
|
|
and thermal derating using I^2R model. Monitors motor current, calculates thermal
|
|
state, applies speed derating, and triggers emergency stop on hard fault.
|
|
</description>
|
|
<maintainer email="sl-controls@saltylab.local">sl-controls</maintainer>
|
|
<license>MIT</license>
|
|
|
|
<depend>rclpy</depend>
|
|
<depend>geometry_msgs</depend>
|
|
<depend>std_msgs</depend>
|
|
<depend>std_srvs</depend>
|
|
|
|
<buildtool_depend>ament_python</buildtool_depend>
|
|
|
|
<test_depend>ament_copyright</test_depend>
|
|
<test_depend>ament_flake8</test_depend>
|
|
<test_depend>ament_pep257</test_depend>
|
|
<test_depend>python3-pytest</test_depend>
|
|
|
|
<export>
|
|
<build_type>ament_python</build_type>
|
|
</export>
|
|
</package>
|