Skip to content
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

Refactor joint properties data structure (#110) #111

Merged
merged 2 commits into from
Mar 20, 2023

Conversation

scchow
Copy link
Contributor

@scchow scchow commented Mar 16, 2023

This PR addresses #110 for Noetic:

  • Refactored joint_properties to use a map of maps for streamlined access to joint properties
  • Removed JointProperty struct as information contained is redundant.
  • Updated tests to account for new signature for getJointProperties().

After doing incorporating these changes, I realized that this would significantly change functionality in the following ways:

  • Changed function signatures for getJointProperties()
  • Removal of JointProperty struct

As a result, if this PR gets merged, I will need to update my PR in MoveIt! (moveit/moveit#3359) to account for the modified data structures here.

Since the backport that I did for ROS1 is relatively new, merging this shouldn't cause many problems, as I doubt anyone else has started using the features I backported 2 weeks ago.

However, we should be careful about doing the same for ROS2, since it will likely break things in MoveIt2 (such as the same test in MoveIt2 here and as well as anyone else who were relying on the original joint properties data structure/function signatures).

I can definitely work on a similar PR for ROS2, but wanted to get your thoughts first.

Cheers!

@scchow scchow force-pushed the dev/joint-property-refactor branch 2 times, most recently from c0267fa to 2d121c0 Compare March 16, 2023 02:49
- Addresses moveit#110
- Refactored joint_properties to use a map of maps
  for streamlined access to joint properties
- Removed JointProperty struct as information contained is redundant.
- Updated tests to account for new getJointProperties signature
@scchow scchow force-pushed the dev/joint-property-refactor branch from 2d121c0 to 06ccb85 Compare March 16, 2023 02:52
Copy link
Contributor

@rhaschke rhaschke left a comment

Choose a reason for hiding this comment

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

Approving with some small nitpicks, which I addressed in a subsequent commit.

// Empty joint property vector
static const std::vector<JointProperty> empty_vector_;
// joint name -> (property name -> property value)
std::map<std::string, std::map<std::string, std::string>> joint_properties_;
Copy link
Contributor

Choose a reason for hiding this comment

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

I prefer introducing descriptive alias names for such types.

std::map<std::string, std::map<std::string, std::string>> joint_properties_;

// Empty joint property map
static const std::map<std::string, std::string> empty_map_;
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest to move this into the function requiring it.

- Use type aliases
- Move static empty_map into the function it is used within
@rhaschke rhaschke merged commit aebc031 into moveit:noetic-devel Mar 20, 2023
@rhaschke
Copy link
Contributor

Please adapt your MoveIt PR accordingly.

@rhaschke
Copy link
Contributor

Thanks for cleaning this up!

@scchow
Copy link
Contributor Author

scchow commented Mar 20, 2023

Thanks for the helpful comments! Good call on using the descriptive aliases.

I'll put together a similar patch for the ROS2 branch if I can find some time this/next week.

scchow added a commit to scchow/moveit that referenced this pull request Apr 10, 2023
- Due to moveit/srdfdom#111, accessing
  Joint Properties has changed since properties now use a map
  instead of a vector.
- Fixed tests/checking of joint properties to reflect this change
scchow added a commit to scchow/moveit that referenced this pull request Apr 13, 2023
- Due to moveit/srdfdom#111, accessing
  Joint Properties has changed since properties now use a map
  instead of a vector.
- Fixed tests/checking of joint properties to reflect this change
rhaschke added a commit to moveit/moveit that referenced this pull request Apr 14, 2023
backport from moveit/moveit2#390 with several improvements:
- accessing joint properties via map of maps (moveit/srdfdom#111)
- fixing joint properties parsing, using `moveit::utils::toDouble` instead of `std::stod`
- cleanup parsing of joint properties

Co-authored-by: Robert Haschke <[email protected]>
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.

2 participants