Skip to content

Conversation

GyuH13
Copy link
Member

@GyuH13 GyuH13 commented Aug 29, 2025

[SDK Update] Object-Oriented Motor-Based SDK

Project Goal: Provide a high-level, object-oriented SDK that allows users to control motors more easily and intuitively.
Project Overview: Provide a high-level, motor-object-based control SDK built upon the existing low-level, packet-based communication control.
Supported Protocol: Protocol 2.0
Supported Operating System: Linux 64bit
Supported Language: C++ 17 above
Module Name: Dynamixel Easy SDK

Class Structure:

  • Connector.hpp: Owns PacketHandler and PortHandler, manages objects, and communicates with motors.
  • Motor.hpp: An abstract object for each motor that sends commands via the Connector.
  • control_table.hpp: Parses control table files and automatically recognizes the table for each model.
  • dynamixel_error.hpp: Contains the Result<T, E> implementation and DxlRuntimeError class.
  • GroupExecutor: Execute staged command for group control in simultaneously.

Related PR

Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
@GyuH13 GyuH13 self-assigned this Aug 29, 2025
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.

Summary of Changes

Hello @GyuH13, 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 upgrades the Dynamixel SDK by introducing a new high-level, object-oriented C++ API. The primary goal is to make motor control more intuitive and user-friendly, abstracting away the complexities of low-level packet-based communication. This update streamlines the setup process, automates motor model recognition, and implements a robust error handling strategy, ultimately enhancing the developer experience for Linux 64-bit C++17 projects.

Highlights

  • New Object-Oriented C++ API: Introduces a high-level, object-oriented C++ API for Dynamixel motors, simplifying control and interaction by abstracting low-level communication details.
  • Streamlined Connection Management: Consolidates port and packet handling into a single Connector class, simplifying the setup process for communication with motors.
  • Automatic Model and Control Table Recognition: Enables automatic identification of motor models and their corresponding control tables, eliminating the need for manual memory address management.
  • Enhanced Error Handling: Implements a robust error handling strategy using a custom Result template for recoverable communication errors and DxlRuntimeError for fatal initialization failures, along with clear enum class error codes.
  • Intuitive Motor Control: Provides an intuitive Motor object representation for each physical motor, offering high-level functions for common operations like torque control, position/velocity setting, and LED control.
  • Improved Type Safety: Ensures type safety for signed values read from the motor by explicitly returning appropriate signed integer types, preventing potential casting issues.
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 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.

Copilot

This comment was marked as outdated.

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 introduces a new high-level, object-oriented C++ API for the Dynamixel SDK, which is a significant step towards improving developer experience. The design with Connector and Motor classes is intuitive, and the use of a Result type for error handling is a good modern C++ practice.

My review has identified a few areas for improvement. There is a critical bug in the motor discovery logic that can lead to an infinite loop. I've also pointed out a potential memory safety issue with a raw pointer in the Motor class, a hardcoded file path that impacts portability, and several instances of magic numbers that affect code maintainability. Addressing these points will make the new API more robust and easier to use.

Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Copy link
Member

@yun-goon yun-goon left a comment

Choose a reason for hiding this comment

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

You created a new feature! First, I'll just leave a few reviews.

Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Copy link
Member

@yun-goon yun-goon left a comment

Choose a reason for hiding this comment

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

I've checked that it works well!
Like it!

Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
@GyuH13 GyuH13 requested review from Copilot and yun-goon September 9, 2025 05:52
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces a new high-level, object-oriented Dynamixel API for C++ on Linux 64-bit systems. The API provides motor-object-based control built upon the existing low-level packet-based communication, supporting Protocol 2.0 with automatic model and control table recognition.

  • Implements a comprehensive object-oriented motor control system with Connector and Motor classes
  • Adds automatic control table parsing and model recognition from configuration files
  • Introduces a custom Result<T, E> type for robust error handling and type-safe error codes

Reviewed Changes

Copilot reviewed 90 out of 91 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
c++/include/dynamixel_sdk/dynamixel_api.hpp Main API header file that includes all high-level API components
c++/include/dynamixel_sdk/dynamixel_api/*.hpp Header files for Connector, Motor, ControlTable, and error handling classes
c++/src/dynamixel_sdk/dynamixel_api/*.cpp Implementation files for the new API classes and functionality
control_table/*.model Extensive set of motor model configuration files for automatic control table recognition
c++/build/linux64/Makefile Updates build configuration to include API sources and control table installation
c++/example/dynamixel_api/basic_test.cpp Comprehensive example demonstrating the new API usage
Comments suppressed due to low confidence (1)

control_table/xc330_t288_fw52.model:1

  • Duplicate address mappings detected across multiple control table files. Lines 112-113 have the same addresses as lines 70-71, and lines 114-115 have the same addresses as lines 74-75. This pattern appears in many .model files and could indicate a data inconsistency or unnecessary duplication that may complicate maintenance.
[type info]

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Copy link
Member

@yun-goon yun-goon left a comment

Choose a reason for hiding this comment

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

As I said verbally, you even worked on the bump. Good!

Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
@Woojin-Crive Woojin-Crive changed the title Dynamixel API update in cpp linux 64bit Dynamixel Easy SDK update in cpp linux 64bit Oct 20, 2025
Connector::Connector(const std::string & port_name, int baud_rate)
{
port_handler_ = std::unique_ptr<PortHandler>(PortHandler::getPortHandler(port_name.c_str()));
packet_handler_ = PacketHandler::getPacketHandler(2.0);
Copy link
Member

Choose a reason for hiding this comment

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

It might be better to extract the 2.0 magic number to a named constant like PROTOCOL_VERSION

Copy link
Member

Choose a reason for hiding this comment

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

e.g. static constexpr float PROTOCOL_VERSION = 2.0f;

Copy link
Member Author

Choose a reason for hiding this comment

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

0a4f971
Thanks I reflect your review on it

Copy link
Member

@ola31 ola31 left a comment

Choose a reason for hiding this comment

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

@GyuH13 Great work! I left some minor comments.

Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
Copy link
Member

@yun-goon yun-goon left a comment

Choose a reason for hiding this comment

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

Thank you for your hard work!
But there are a few things to revise.

Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
@GyuH13 GyuH13 requested review from ola31 and yun-goon October 21, 2025 02:07
Copy link

@nhw-robotis nhw-robotis left a comment

Choose a reason for hiding this comment

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

Great work!

Copy link
Member

@yun-goon yun-goon left a comment

Choose a reason for hiding this comment

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

Good!

Copy link
Member

@sunghowoo sunghowoo left a comment

Choose a reason for hiding this comment

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

This project that makes using Dynamixel easier will be a major milestone. From now on, beginners will be able to use Dynamixel actuators more easily, and it is a great contribution to the community.

@GyuH13 GyuH13 requested a review from robotpilot October 23, 2025 01:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: 📝 Pull Request

Development

Successfully merging this pull request may close these issues.

7 participants