-
Notifications
You must be signed in to change notification settings - Fork 3
Manage links and joints via ID #123
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: master
Are you sure you want to change the base?
Conversation
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.
Hello @Nicogene, 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
This pull request addresses issue #104 and focuses on managing links and joints using their IDs within the Creo2Urdf converter. The core change involves modifying the populateExportedFrameInfoMap
and addMeshAndExport
functions to accept a LinkInfo
object instead of a pfcModel_ptr
and a separate mesh transform string. This allows these functions to access all necessary information about a link (name, handle, transforms) through a single object, improving code organization and readability.
Highlights
- Refactoring: The
populateExportedFrameInfoMap
andaddMeshAndExport
functions are refactored to accept aLinkInfo
object instead of separate arguments. - Data Encapsulation: The
LinkInfo
struct is used to encapsulate all relevant information about a link, simplifying function signatures and improving code clarity. - Mesh Export: The mesh export functionality is updated to use the
LinkInfo
object to access the model handle and transform information.
Changelog
- src/creo2urdf/include/creo2urdf/Creo2Urdf.h
- Modified
populateExportedFrameInfoMap
to acceptLinkInfo&
instead ofpfcModel_ptr
. - Modified
addMeshAndExport
to acceptLinkInfo&
instead ofpfcModel_ptr
andconst std::string& mesh_transform
.
- Modified
- src/creo2urdf/src/Creo2Urdf.cpp
- Removed commented-out debug print statement.
- Modified
processAsmItems
to passLinkInfo
topopulateExportedFrameInfoMap
andaddMeshAndExport
. - Modified
populateExportedFrameInfoMap
to useLinkInfo
to access link name and model handle. - Modified
addMeshAndExport
to useLinkInfo
to access model handle and link frame name for mesh export.
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.
With IDs clear, links align,
Joints managed, a structure fine.
Code's design,
A clearer sign,
Of robots moving, truly divine.
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
The pull request addresses issue #104 by managing links and joints via ID. The changes involve modifying the Creo2Urdf
class to use LinkInfo
objects instead of pfcModel_ptr
for managing link information. This approach seems reasonable and should improve code clarity and maintainability. However, there are a few areas that could be improved, as detailed below.
Summary of Findings
- Redundant
link_info_map
lookup: InpopulateExportedFrameInfoMap
, thelink_info
is already available as an argument, but the code still performs a lookup inlink_info_map
. This is redundant and can be simplified. - Inconsistent parameter passing: The
addMeshAndExport
function was modified to acceptLinkInfo
instead ofpfcModel_ptr
andmesh_transform
. However, themesh_transform
parameter was replaced withlink_info.link_frame_name
, which might not be the intended behavior ifmesh_transform
was meant to represent a different transform.
Merge Readiness
The pull request introduces significant changes that require careful review. While the overall approach seems sound, the identified issues should be addressed before merging. I am unable to directly approve this pull request, and recommend that others review and approve this code before merging. Specifically, the redundant link_info_map
lookup and the potentially incorrect parameter passing in addMeshAndExport
should be investigated and corrected. It is recommended that this pull request not be merged until these issues are addressed.
src/creo2urdf/src/Creo2Urdf.cpp
Outdated
link_info.modelhdl->Export(mesh_file_name.c_str(), pfcExportInstructions::cast(pfcSTLBinaryExportInstructions().Create(link_info.link_frame_name.c_str()))); | ||
} | ||
else if(meshFormat =="stl_ascii") { | ||
component_handle->Export(mesh_file_name.c_str(), pfcExportInstructions::cast(pfcSTLASCIIExportInstructions().Create(mesh_transform.c_str()))); | ||
link_info.modelhdl->Export(mesh_file_name.c_str(), pfcExportInstructions::cast(pfcSTLASCIIExportInstructions().Create(link_info.link_frame_name.c_str()))); |
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.
The original code used mesh_transform.c_str()
here. Now it's using link_info.link_frame_name.c_str()
. Are you sure this is the correct transform to pass? It seems like mesh_transform
might have been intended to be different from link_info.link_frame_name
. Please confirm that this change is intentional and correct.
link_info.modelhdl->Export(mesh_file_name.c_str(), pfcExportInstructions::cast(pfcSTLBinaryExportInstructions().Create(link_info.link_frame_name.c_str()))); | |
} | |
else if(meshFormat =="stl_ascii") { | |
component_handle->Export(mesh_file_name.c_str(), pfcExportInstructions::cast(pfcSTLASCIIExportInstructions().Create(mesh_transform.c_str()))); | |
link_info.modelhdl->Export(mesh_file_name.c_str(), pfcExportInstructions::cast(pfcSTLASCIIExportInstructions().Create(link_info.link_frame_name.c_str()))); | |
link_info.modelhdl->Export(mesh_file_name.c_str(), pfcExportInstructions::cast(pfcSTLBinaryExportInstructions().Create(mesh_transform.c_str()))); | |
} | |
else if(meshFormat =="stl_ascii") { | |
link_info.modelhdl->Export(mesh_file_name.c_str(), pfcExportInstructions::cast(pfcSTLASCIIExportInstructions().Create(mesh_transform.c_str()))); |
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.
The name was misleading, it is actually a frame name
bool ret{ false }; | ||
iDynTree::Transform csys_H_additionalFrame {iDynTree::Transform::Identity()}; | ||
iDynTree::Transform csys_H_linkFrame {iDynTree::Transform::Identity()}; |
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.
The link_info
is already passed as an argument to this function. Accessing it again via link_info_map.at(link_name)
is redundant and less efficient. Consider removing this line and using the passed-in link_info
directly.
bool ret{ false }; | |
iDynTree::Transform csys_H_additionalFrame {iDynTree::Transform::Identity()}; | |
iDynTree::Transform csys_H_linkFrame {iDynTree::Transform::Identity()}; | |
auto& exported_frame_info = exported_frame_info_map.at(csys_name); | |
bool ret{ false }; |
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.
Isn't what I am doing?
e3cc52a
to
22bbc41
Compare
22bbc41
to
1d97696
Compare
It fixes #104