Skip to content

Fix for DYNAMIXEL-Y control table error & Arduino Uno R4 build error #148

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jun 9, 2025

Conversation

jonghee-son
Copy link
Member

  • Fixed build error when using ARM Cortex-M based Arduino (Such as Arduino UNO R4 Minima and UNO R4 WiFi).
  • Fixed data width of ControlTableItem::PRESENT_MOTOR_TEMPERATURE for DYNAMIXEL-Y.
    Link to e-Manual

@jonghee-son jonghee-son requested a review from sookyungson May 30, 2025 00:38
@jonghee-son jonghee-son self-assigned this May 30, 2025
Copy link

@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.

Hello @jonghee-son, 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!

Summary of Changes

Hello team, gemini-code-assist here to provide a summary of this pull request. This PR by @jonghee-son addresses two key issues: fixing a build error encountered when using ARM Cortex-M based Arduino boards like the UNO R4, and correcting a data width error in the control table definition for DYNAMIXEL-Y series actuators. Additionally, it includes a renaming of control table items related to the LED functionality for clarity and consistency across different DYNAMIXEL models.

Highlights

  • Arduino UNO R4 Build Fix: This PR includes changes necessary to resolve build errors specifically affecting ARM Cortex-M based Arduino boards, such as the Arduino UNO R4 Minima and UNO R4 WiFi. While the specific code changes for this fix aren't detailed in the provided patches, the PR description explicitly states this is addressed.
  • DYNAMIXEL-Y Control Table Correction: The data width for the PRESENT_MOTOR_TEMPERATURE control table item for DYNAMIXEL-Y series actuators has been corrected in the library's internal control table definition (src/actuator.cpp). It was previously incorrectly set to 4 bytes and is now corrected to 1 byte, aligning with the official e-Manual specification.
  • LED Control Table Item Renaming: Control table items related to LED functionality (LED, LED_RED, LED_GREEN, LED_BLUE) have been renamed to include a DXL_ prefix (DXL_LED, DXL_LED_RED, DXL_LED_GREEN, DXL_LED_BLUE) in both the header file (src/actuator.h) and their usage within the library (src/Dynamixel2Arduino.cpp, src/actuator.cpp). This improves clarity and avoids potential naming conflicts.

Changelog

Click here to see the changelog
  • library.properties
    • Updated the library version from 0.8.0 to 0.8.1 (line 2).
  • src/Dynamixel2Arduino.cpp
    • Updated calls to writeControlTableItem in the setLedState function to use the new DXL_LED* enum values instead of the old LED* values (lines 613, 614, 616, 620).
  • src/actuator.cpp
    • Updated the control_table_1_0 definition to use ControlTableItem::DXL_LED instead of ControlTableItem::LED (line 36).
    • Updated the control_table_1_1 definition to use ControlTableItem::DXL_LED instead of ControlTableItem::LED (line 88).
    • Updated the xl320_control_table definition to use ControlTableItem::DXL_LED instead of ControlTableItem::LED (line 147).
    • Updated the control_table_2_0 definition to use ControlTableItem::DXL_LED instead of ControlTableItem::LED (line 200).
    • Updated the pro_r_control_table definition to use ControlTableItem::DXL_LED_RED, DXL_LED_GREEN, and DXL_LED_BLUE instead of the old LED* values (lines 322-324).
    • Updated the pro_ra_pro_plus_control_table definition to use ControlTableItem::DXL_LED_RED, DXL_LED_GREEN, and DXL_LED_BLUE instead of the old LED* values (lines 380-382).
    • Updated the y_control_table definition to use ControlTableItem::DXL_LED instead of ControlTableItem::LED (line 478).
    • Corrected the data width for ControlTableItem::PRESENT_MOTOR_TEMPERATURE in the y_control_table definition from 4 to 1 (line 496).
  • src/actuator.h
    • Renamed the enum members LED, LED_RED, LED_GREEN, and LED_BLUE to DXL_LED, DXL_LED_RED, DXL_LED_GREEN, and DXL_LED_BLUE respectively within the ControlTableItem namespace (lines 334-337).
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 in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

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 issue 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 is currently in preview and 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 to provide feedback.

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.


Code needs a small fix,
UNO R4 builds now click,
Temps read just right.

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.

Copy link

@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 introduces two valuable fixes: correcting the data width for PRESENT_MOTOR_TEMPERATURE on DYNAMIXEL-Y series devices and resolving a build error for ARM Cortex-M based Arduinos, likely by renaming LED-related control table items. These changes enhance the library's correctness and robustness. The version bump to 0.8.1 is appropriate for these updates.

Overall, the changes are clear, well-targeted, and improve the library. Well done!

Summary of Findings

  • Control Table Data Correctness: The data width for PRESENT_MOTOR_TEMPERATURE for DYNAMIXEL-Y was corrected from 4 bytes to 1 byte. This is a critical fix for accurate sensor readings, aligning the library with the official hardware documentation.
  • Improved Naming and Build Stability: LED-related control table items were renamed with a DXL_ prefix (e.g., LED to DXL_LED). This enhances code clarity, reduces the risk of naming collisions, and is the likely solution for the build errors reported on ARM Cortex-M based Arduino boards.
  • Versioning (Not commented due to severity settings): The library version was appropriately incremented from 0.8.0 to 0.8.1 in library.properties to reflect these fixes. This is standard practice and was considered a low-severity item.

Merge Readiness

The changes in this pull request effectively address a data correctness issue and a build error, improving the library's reliability and usability. The code modifications are clear and well-justified. Based on this review, the PR appears to be in good shape for merging. As a reviewer, I am not authorized to approve the pull request, but I recommend that these changes be merged after any final checks by the maintainers.

@@ -493,7 +493,7 @@ const ModelControlTableInfo_t y_control_table[] PROGMEM = {
{ControlTableItem::VELOCITY_TRAJECTORY, 564, 4},
{ControlTableItem::PRESENT_INPUT_VOLTAGE, 568, 2},
{ControlTableItem::PRESENT_TEMPERATURE, 570, 1}, // Present Inverter Temperature
{ControlTableItem::PRESENT_MOTOR_TEMPERATURE, 571, 4},
{ControlTableItem::PRESENT_MOTOR_TEMPERATURE, 571, 1},

Choose a reason for hiding this comment

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

high

This correction of the data width for PRESENT_MOTOR_TEMPERATURE from 4 bytes to 1 byte for the DYNAMIXEL-Y series is an important fix. It aligns with the e-Manual (address 571, size 1 byte) and is crucial for ensuring accurate motor temperature readings. An incorrect data width here would lead to erroneous temperature values and could potentially affect other operations if data is read in bulk. Great catch!

Comment on lines +334 to +337
DXL_LED,
DXL_LED_RED,
DXL_LED_GREEN,
DXL_LED_BLUE,

Choose a reason for hiding this comment

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

medium

Renaming the LED-related enum members from LED, LED_RED, LED_GREEN, LED_BLUE to DXL_LED, DXL_LED_RED, DXL_LED_GREEN, DXL_LED_BLUE respectively is a solid improvement.

This DXL_ prefix offers several benefits:

  • Clarity: It explicitly indicates that these constants relate to the Dynamixel's LED.
  • Collision Avoidance: This is likely the key to fixing the build error on ARM Cortex-M platforms (like the Arduino UNO R4). Generic names like LED are prone to collisions with macros or constants defined in Arduino core libraries or other third-party libraries, especially across different microcontroller architectures.
  • Maintainability: It makes the codebase easier to understand and maintain.

This change significantly enhances the library's robustness and portability.

@jonghee-son jonghee-son merged commit cfbbaf7 into ROBOTIS-GIT:master Jun 9, 2025
1 check passed
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.

UNO R4 - Library(libraries) - will not build on new Arduino boards... And may not work at all. Dynamixel2Arduino does not compile for STM32
1 participant
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy