Jazzy version of changes to support present temperature, current, voltage, and load#107
Jazzy version of changes to support present temperature, current, voltage, and load#107bueche wants to merge 1 commit intoROBOTIS-GIT:jazzyfrom
Conversation
Summary of ChangesHello @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 Highlights
🧠 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
Using Gemini Code AssistThe 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
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 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
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for reporting 'Present Temperature', 'Present Input Voltage', 'Present Current', and 'Present Load' from Dynamixel servos, addressing Issue #104. The changes include defining new constants for telemetry interface names, a TelemetryHandler struct for processing, and a processTelemetryInterface method to manage data scaling and message field updates. The on_init and read methods have been appropriately modified to initialize and populate these new telemetry fields. A minor issue was identified regarding the scaling factor for 'Present Load', which could lead to incorrect values being reported in the dxl_state message.
| {1.0, // No scaling needed | ||
| [](DynamixelHardware* hw, int16_t val, size_t idx) { | ||
| hw->dxl_state_msg_.present_load.at(idx) = val; | ||
| }}} |
There was a problem hiding this comment.
The scale_factor for TelemetryInterfaces::LOAD should be 10.0 to match the example output and the description in the pull request body. The description states that the consumer needs to divide by 10 to get the percentage (e.g., 146 -> 14.6%), implying the message should store the raw integer 146. If the value parameter to processTelemetryInterface is already the physical value (e.g., 14.6), then multiplying by 10 will restore the raw integer 146 for storage in dxl_state_msg_.present_load.
Currently, with scale_factor = 1.0, if value is 14.6, converted_value becomes 14, which is a loss of precision and does not match the expected output.
{TelemetryInterfaces::LOAD,
{10.0, // Scale to 0.1% units (e.g., 14.6% -> 146)
[](DynamixelHardware* hw, int16_t val, size_t idx) {
hw->dxl_state_msg_.present_load.at(idx) = val;
}}}
his 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 jazzy version (a separate PR was created for the humble branch). 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: