-
Notifications
You must be signed in to change notification settings - Fork 468
Dynamixel Easy SDK update in cpp linux 64bit #664
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: Hyungyu Kim <kimhg@robotis.com>
There was a problem hiding this 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 andDxlRuntimeError
for fatal initialization failures, along with clearenum 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
-
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. ↩
There was a problem hiding this 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>
There was a problem hiding this 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>
There was a problem hiding this 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!
There was a problem hiding this 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>
There was a problem hiding this 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>
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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;
There was a problem hiding this comment.
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
There was a problem hiding this 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>
There was a problem hiding this 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>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good!
There was a problem hiding this 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.
[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 existinglow-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:
Result<T, E>
implementation andDxlRuntimeError
class.Related PR