Skip to content

Conversation

vidurvij-apptronik
Copy link
Contributor

@vidurvij-apptronik vidurvij-apptronik commented Aug 25, 2025

Add Thermal Plugin for Actuator Temperature Modeling

Summary

This PR introduces a new thermal plugin for MuJoCo that models the temperature dynamics of actuators.
The plugin simulates heat generation from electrical resistance, heat dissipation to the
environment, and temperature-dependent motor characteristics.

Description

Physics Model

The thermal plugin implements a first-order lumped thermal model with the following components:

1. Temperature-Dependent Torque Constant

The motor torque constant varies linearly with temperature:
Kt(T) = Kt25 + ((Kt130 - Kt25) / (403.15 - 298.15)) × (T - 298.15)
where:

  • Kt25: Torque constant at 25°C (298.15 K)
  • Kt130: Torque constant at 130°C (403.15 K)
  • T: Current temperature in Kelvin

This can be replace by a constant value in the future

2. Motor Current Calculation

From the actuator force and torque constant:
I = F / (Kt(T) × G)
where:

  • F: Actuator force (N)
  • G: Gear ratio
  • I: Motor current (A)

3. Temperature-Dependent Electrical Resistance

The electrical resistance increases with temperature:
R(T) = RNorm × (1 + α × (T - 298.15))
where:

  • RNorm: Nominal resistance at 25°C (Ω)
  • α: Temperature coefficient of resistance (1/K)

4. Thermal Dynamics

The temperature evolution follows the heat balance equation:
C × dT/dt = Pin - Pout
where:
Pin = I² × R(T) (Joule heating)
Pout = (T - Tambient) / Rth (Heat dissipation)

  • C: Thermal capacitance (J/K)
  • Rth: Thermal resistance (K/W)
  • Tambient: Ambient temperature (K)

The temperature is updated using Euler integration:
T(t + Δt) = T(t) + (dT/dt) × Δt

Implementation Details

Files Added:

  • plugin/thermal/thermal.h: Plugin header with configuration structure
  • plugin/thermal/thermal.cc: Core implementation of thermal model
  • plugin/thermal/register.cc: Plugin registration
  • plugin/thermal/CMakeLists.txt: Build configuration
  • test/plugin/thermal/thermal_test.cc: Unit tests
  • test/plugin/thermal/testdata/thermal_test.xml: Test configuration
  • test/plugin/thermal/CMakeLists.txt: Test build configuration

Key Features:

  • Per-actuator temperature state tracking
  • Configurable thermal parameters via XML attributes
  • Sensor output for temperature monitoring
  • Reset functionality to ambient temperature
  • Comprehensive input validation

Configuration Parameters

Parameter Symbol Unit Description
C C J/K Thermal capacitance
Rth Rth K/W Thermal resistance
RNorm R₀ Ω Nominal electrical resistance at 25°C
TempCoeff α 1/K Temperature coefficient of resistance
Kt25 Kt₂₅ Nm/A Torque constant at 25°C
Kt130 Kt₁₃₀ Nm/A Torque constant at 130°C
G G - Gear ratio

Usage Example

<mujoco>
  <extension>
    <plugin plugin="mujoco.sensor.thermal">
      <instance name="motor_thermal">
        <config key="C" value="42"/>
        <config key="Rth" value="3.4"/>
        <config key="TempCoeff" value="0.039"/>
        <config key="RNorm" value="0.46"/>
        <config key="Kt25" value="0.068"/>
        <config key="Kt130" value="0.061"/>
        <config key="G" value="3141.59"/>
      </instance>
    </plugin>
  </extension>

  <custom>
    <numeric name="ambient_temperature" data="298.15"/>
  </custom>

  <sensor>
    <plugin name="thermal_sensor" instance="motor_thermal"
            objtype="actuator" objname="motor"/>
  </sensor>
</mujoco>

Testing

- Unit tests verify correct temperature evolution and parameter validation
- Test ensures plugin properly initializes, computes, and resets
- Validates that temperature state is properly tracked per actuator
- Confirms ambient temperature initialization and proper sensor data output

@yuvaltassa yuvaltassa requested a review from quagla August 26, 2025 10:04
@vidurvij-apptronik
Copy link
Contributor Author

@quagla @yuvaltassa It needed the number of plugins to be updated in the test. Just did it!

@@ -0,0 +1,20 @@
# Copyright 2022 DeepMind Technologies Limited
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2025

@@ -0,0 +1,107 @@
// Copyright 2025 Vidur Vij
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vidur Vij -> DeepMind Technologies Limited

@@ -0,0 +1,61 @@
// Copyright 2025 Vidur Vij
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same

}
}

} // namespace mujoco::plugin::thermal No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add terminating blank line

@@ -0,0 +1,24 @@
// Copyright 2023 DeepMind Technologies Limited
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2025

@@ -0,0 +1,42 @@
# Copyright 2022 DeepMind Technologies Limited
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants