Skip to content

Add shape drawing modules#363

Closed
csharon0218 wants to merge 15 commits into
mainfrom
feature-drawing-shape
Closed

Add shape drawing modules#363
csharon0218 wants to merge 15 commits into
mainfrom
feature-drawing-shape

Conversation

@csharon0218

@csharon0218 csharon0218 commented Feb 6, 2026

Copy link
Copy Markdown

Overview
This PR refactors traj_pub_node.py by separating kinematics, IK, and trajectory generation logic into dedicated Python modules.

  • omx_drawing_shape.py: Implements a ROS 2 node for OMX that generates predefined shape trajectories (circle, rectangle, heart), solves inverse kinematics using a DLS-based solver, and publishes joint trajectories to the controller.

@csharon0218 csharon0218 self-assigned this Feb 6, 2026
@csharon0218 csharon0218 added the enhancement New feature or request label Feb 6, 2026
@github-project-automation github-project-automation Bot moved this to 🌱 Todo in Platform Feb 6, 2026
@gemini-code-assist

Copy link
Copy Markdown

Summary of Changes

Hello @csharon0218, 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 open_manipulator_playground by restructuring the robotic arm control logic. It extracts kinematics, inverse kinematics, and trajectory generation into dedicated, reusable Python modules. This change streamlines the main ROS2 node, making it primarily responsible for execution flow and parameter management, while delegating complex calculations to specialized components. The result is a more organized, maintainable, and extensible system for controlling the robot's end-effector to draw various shapes.

Highlights

  • Modular Refactoring: The traj_pub_node.py has been refactored to separate kinematics, inverse kinematics, and trajectory generation logic into dedicated Python modules, enhancing code organization and maintainability.
  • Kinematics Module: A new module, traj_kinematics.py, has been introduced to handle URDF-based Forward Kinematics (FK), Jacobian calculations, and essential rotation mathematical utilities (RPY, quaternion, skew, log map).
  • Inverse Kinematics Solver: The traj_ik.py module has been added, providing a Damped Least Squares (DLS) Inverse Kinematics (IK) solver with configurable parameters via an IKConfig dataclass.
  • Task-Space Trajectory Generators: A new module, traj_traj.py, now contains functions for generating various task-space trajectories, including circles, rectangles (with rounded corners), and heart shapes.
  • Enhanced Trajectory Node: traj_pub_node.py now serves as the central ROS2 node, orchestrating the use of the new kinematics, IK, and trajectory modules, and includes interactive parameter configuration for trajectory modes and IK settings.

🧠 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
  • open_manipulator_playground/src/traj_ik.py
    • Added a new Python module for Damped Least Squares (DLS) inverse kinematics solving.
    • Introduced an IKConfig dataclass to manage configurable IK parameters such as damping, step scale, and tolerances.
  • open_manipulator_playground/src/traj_kinematics.py
    • Added a new Python module containing mathematical utilities for rotation conversions (RPY to rotation, quaternion to rotation, rotation to quaternion, skew, rotation log map).
    • Implemented the SimpleURDFChain class for parsing URDF and performing forward kinematics (FK) and Jacobian calculations for a robot chain.
  • open_manipulator_playground/src/traj_pub_node.py
    • Refactored the main ROS2 node to import and utilize the newly created traj_kinematics, traj_ik, and traj_traj modules.
    • Updated parameter declarations to support a wide range of IK and trajectory settings, including interactive configuration options.
    • Modified the control loop (_tick_cb) to compute target end-effector positions using traj_traj, solve for joint angles using traj_ik, and publish these as joint trajectories.
    • Added debug publishers for visualizing end-effector feedback and target positions.
  • open_manipulator_playground/src/traj_traj.py
    • Added a new Python module dedicated to generating 2D task-space trajectory points for various shapes.
    • Included functions for circle_point, heart_point, and rectangle_point (supporting rounded corners).
    • Provided a plane_embed utility to project 2D trajectory points into 3D space based on a specified plane (XY, XZ, or YZ).
Activity
  • The pull request was created by csharon0218.
  • No reviews or comments have been made 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.

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

Copy link
Copy Markdown

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 is a great refactoring effort, separating concerns into dedicated modules for kinematics, inverse kinematics, and trajectory generation. The code is well-structured and the new modules are clear.

My review focuses on a few key areas:

  • Correctness: I found a critical bug in the Jacobian calculation that doesn't handle prismatic joints, and a numerical instability in the rot_log function.
  • Security: There's a potential DoS vulnerability from parsing URDF XML with the standard library.
  • Maintainability: I've pointed out a few places where code can be made more robust (e.g., exception handling) and more readable by removing redundant type casts.

Overall, this is a solid contribution. Addressing these points will make the code more robust and maintainable.

Comment thread open_manipulator_playground/src/traj_kinematics.py Outdated
Comment thread open_manipulator_playground/src/traj_kinematics.py Outdated
Comment thread open_manipulator_playground/src/traj_ik.py Outdated
Comment thread open_manipulator_playground/src/traj_kinematics.py Outdated
Comment thread open_manipulator_playground/src/traj_pub_node.py Outdated
Comment thread open_manipulator_playground/src/traj_pub_node.py Outdated
Comment thread open_manipulator_playground/src/traj_pub_node.py Outdated
@sunghowoo sunghowoo moved this from 🌱 Todo to 📝 Pull Request in Platform Feb 10, 2026

@sunghowoo sunghowoo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

  • It looks like copy light support should be added.
  • A package version update may be necessary.
  • There appear to be too many files; merging related files could improve maintainability.
  • Explicitly including the OMX model in the naming would improve clarity.

@GyuH13 GyuH13 assigned kimtaehyeong99 and unassigned csharon0218 Feb 11, 2026
@github-project-automation github-project-automation Bot moved this from 📝 Pull Request to 🚩Done in Platform Feb 11, 2026
@csharon0218 csharon0218 reopened this Feb 11, 2026
@csharon0218 csharon0218 force-pushed the feature-drawing-shape branch from fa070d5 to 6898379 Compare February 12, 2026 08:41
Signed-off-by: csharon0218 <csharon0218@gmail.com>
Signed-off-by: csharon0218 <csharon0218@gmail.com>
Signed-off-by: csharon0218 <csharon0218@gmail.com>
Signed-off-by: csharon0218 <csharon0218@gmail.com>
Signed-off-by: csharon0218 <csharon0218@gmail.com>

@yun-goon yun-goon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

There are unnecessary install, log folders.
Please check the EOF.

@csharon0218 csharon0218 requested a review from yun-goon February 19, 2026 00:59

@yun-goon yun-goon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Good!

Signed-off-by: kimtaehyeong99 <kth@robotis.com>
@sunghowoo

Copy link
Copy Markdown
Member

This PR has been replaced by the Cyclo Control drawing demo, so I will close it.

@sunghowoo sunghowoo closed this Apr 24, 2026
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

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants