Skip to content

Conversation

@bueche
Copy link

@bueche bueche commented Feb 8, 2026

This PR is meant to address Issue #104 by enabling the ros2 /dynamixel_hardware_interface/dxl_state state to return servo values of "Present Temperature", "Present Input Voltage", "Present Current", and/or "Present Load". Some servo's return "Present Current" (XL330's) while others "Present Load" (e.g., XL430's). Whether or not they return these depends on the model files.

This PR is for the humble version (a jazzy version will be submitted separately). This has been tested in an environment in which both XL330's and XL430's are present to confirm that the Present current is always zero for XL430's and Present Load is always zero for XL330s. This is shown below with the slightly annotated output. In this example id's 1 & 2 are XL430's and id's 3 - 6 are XL330's.

The return values are not adjusted in any way, the consumer will need to do so (e.g., convert the Present Load from its raw value by dividing by 10 .. to change 146 to 14.6% and to divide by 10 do adjust the voltage values 121 becomes 12.1 v.

Example use:

$ ros2 topic echo /dynamixel_hardware_interface/dxl_state --once
header:
  stamp:
    sec: 1770579229
    nanosec: 459868213
  frame_id: ''
comm_state: 0
id:
- 1
- 2
- 3
- 4
- 5
- 6
torque_state:
- false
- false
- false
- false
- false
- false
dxl_hw_state:
- 0
- 0
- 0
- 0
- 0
- 0
present_temperature:
- 32
- 41
- 21
- 20
- 20
- 23
present_input_voltage:
- 121
- 121
- 57
- 56
- 57
- 56
present_current:
- 0  <--- ALWAYS ZERO FOR XL430's
- 0 <--- ALWAYS ZERO FOR XL430's
- -19
- 15
- -12
- 21
present_load:
- 0 
- 146
- 0 <--- ALWAYS ZERO FOR XL330's 
- 0 <--- ALWAYS ZERO FOR XL330's
- 0 <--- ALWAYS ZERO FOR XL330's
- 0 <--- ALWAYS ZERO FOR XL330's
---

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @bueche, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the /dynamixel_hardware_interface/dxl_state ROS2 topic by integrating additional telemetry data from Dynamixel servos. It specifically enables the publication of 'Present Temperature', 'Present Input Voltage', 'Present Current', and 'Present Load' values, addressing Issue #104. This allows consumers of the topic to access more detailed operational data from connected servos, with considerations for different servo models (e.g., XL330 vs. XL430) and raw value handling, providing a more comprehensive state overview.

Highlights

  • Telemetry Data Support: Added support for publishing 'Present Temperature', 'Present Input Voltage', 'Present Current', and 'Present Load' values from Dynamixel servos to the /dynamixel_hardware_interface/dxl_state ROS2 topic.
  • Message Array Resizing: The on_init function now resizes the internal message arrays to accommodate the new telemetry data fields (temperature, voltage, present_current, present_load).
  • Telemetry Value Extraction and Initialization: The read function has been updated to initialize these new telemetry values to zero for each servo and then extract and populate them from the available state interfaces. Voltage values are scaled by 10, while current values are used as raw units (mA).

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • src/dynamixel_hardware_interface.cpp
    • Resized internal message arrays (temperature, voltage, present_current, present_load) within the on_init function to prepare for new telemetry data.
    • Modified the read function to initialize the new telemetry values to zero for each servo before processing.
    • Implemented logic in the read function to iterate through state interfaces and extract 'Present Temperature', 'Present Input Voltage', 'Present Current', and 'Present Load' values, casting them to int16_t and applying a scaling factor of 10 for voltage.
Activity
  • No human activity (comments, reviews) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@bueche
Copy link
Author

bueche commented Feb 8, 2026

see https://github.com/bueche/ros2_robot_arm for additional details on the test environment.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request successfully adds support for publishing additional telemetry data (temperature, voltage, current, and load) from the Dynamixel servos, addressing issue #104. The implementation correctly handles different servo models that may provide different sets of data. The changes are clear and follow the logic described. I have one suggestion to improve the maintainability of the code by refactoring the if-else if chain used for processing telemetry data.

@Noa-Thouard-Nexxis
Copy link

Noa-Thouard-Nexxis commented Feb 9, 2026

I ran a test on my system using this PR. At first I was confused, since the majority of the added diagnostics were empty during runtime i.e. 0. However Present Current worked.

I figured out the issue in my case, and I thought I'd mention it here. I was missing the xacro tags required by this feautre. I'd add into the in the example adding the tags for each diag type into the xacro/urdf.

i.e.

<gpio name="...">
<state_interface name="Present Temperature"/>
....

good stuff!

@bueche
Copy link
Author

bueche commented Feb 9, 2026

I ran a test on my system using this PR. At first I was confused, since the majority of the added diagnostics were empty during runtime i.e. 0. However Present Current worked.

I figured out the issue in my case, and I thought I'd mention it here. I was missing the xacro tags required by this feautre. I'd add into the in the example adding the tags for each diag type into the xacro/urdf.

i.e.

<gpio name="...">
<state_interface name="Present Temperature"/>
....

good stuff!

ah. I should have pointed out the relevant URDF that I was using. It is located here. Excerpt:

<!-- Motor 2: XL430-W250 (shoulder_lift) -->
  <gpio name="dxl2">
    <param name="type">dxl</param>
    <param name="ID">2</param>
    <command_interface name="Goal Position"/>
    <state_interface name="Present Position"/>
    <state_interface name="Present Velocity"/>
    <state_interface name="Present Load"/>
    <state_interface name="Present Temperature"/>
    <state_interface name="Present Input Voltage"/>
  </gpio>
  
  <!-- Motor 3: XL330-M288 (elbow_flex) -->
  <gpio name="dxl3">
    <param name="type">dxl</param>
    <param name="ID">3</param>
    <command_interface name="Goal Position"/>
    <state_interface name="Present Position"/>
    <state_interface name="Present Velocity"/>
    <state_interface name="Present Current"/>
    <state_interface name="Present Temperature"/>
    <state_interface name="Present Input Voltage"/>
  </gpio>

I wonder there is some additional documentation that I need to update? At a minimum, will add an additional comment to the msg file.

You should get non-zero readings without much movement for temperature and input voltage. The current and load get more interesting when the robot is moving through various poses.

…oltage

Signed-off-by: bueche <ed.bueche64@gmail.com>
Signed-off-by: bueche <ed.bueche64@gmail.com>
@bueche
Copy link
Author

bueche commented Feb 10, 2026

also, this PR covers ros2-humble. Once the approach has been finalized on this version I can work to support the other versions of ros2 supported for the dynamixel servos.

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