Skip to content

Add temperature tracking (MOS and rotor) to motor state#14

Merged
kou merged 6 commits into
enactic:mainfrom
ziwen-meng:add-temperature
Jun 24, 2026
Merged

Add temperature tracking (MOS and rotor) to motor state#14
kou merged 6 commits into
enactic:mainfrom
ziwen-meng:add-temperature

Conversation

@ziwen-meng

@ziwen-meng ziwen-meng commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

This PR adds per-motor temperature readings to the driver's state. Each motor now reports both its MOSFET (tmos) and rotor (trotor) temperatures, enabling thermal monitoring during operation.

Changes:
update_state() now reads get_state_tmos() and get_state_trotor() from each motor and stores them in latest_state as tmos / trotor arrays (dtype int).
Added two convenience accessors:
fetch_mos_temperature(refresh=True) — MOS temperature per motor
fetch_rotor_temperature(refresh=True) — rotor temperature per motor
Extended the test MotorStub in tests/test_driver.py with temperature getters and added test_fetch_mos_temperature / test_fetch_rotor_temperature.

@kou kou left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1

How about improving this a bit?

Comment thread src/openarm_driver/driver.py Outdated
Comment thread src/openarm_driver/driver.py Outdated
Comment thread tests/test_driver.py Outdated
ziwen-meng and others added 4 commits June 24, 2026 15:29
avoiding abbreviation

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
avoiding abbreviation

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@ziwen-meng

Copy link
Copy Markdown
Contributor Author

Switched the temperature assertions to temps.tolist() == [25] * 8 so the == list comparison works on the NumPy array

Comment thread tests/test_driver.py Outdated
Comment thread tests/test_driver.py Outdated
Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@kou kou merged commit e78aca4 into enactic:main Jun 24, 2026
4 checks passed
@ziwen-meng ziwen-meng deleted the add-temperature branch June 24, 2026 07:03
kou pushed a commit to enactic/dora-openarm that referenced this pull request Jun 24, 2026
…rray (#17)

Exposes per-motor temperature in the `request_state` → `state` output.
The `openarm_driver.fetch_state()` call already returns MOS and rotor
temperatures (added in openarm_driver enactic/openarm_driver#14), but
the node was dropping
them. This PR surfaces them so downstream nodes can monitor thermals.

- Adds fields to an existing output without changing field order, so
  existing consumers reading `qpos`/`qvel`/`qtorque` by name are
  unaffected.
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.

2 participants