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

Add utility functions to get limits and trajectory message #2861

Merged
merged 8 commits into from
Jun 6, 2024

Conversation

sjahr
Copy link
Contributor

@sjahr sjahr commented Jun 5, 2024

Description

Please explain the changes you made, including a reference to the related issue if applicable

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • Extend the tutorials / documentation reference
  • Document API changes relevant to the user in the MIGRATION.md notes
  • Create tests, which fail without this PR reference
  • Include a screenshot if changing a GUI
  • While waiting for someone to review your request, please help review another open pull request to support the maintainers

Eigen::VectorXd lower_limits(group.getActiveVariableCount());
Eigen::VectorXd upper_limits(group.getActiveVariableCount());
const moveit::core::JointBoundsVector& group_bounds = group.getActiveJointModelsBounds();
int joint_index = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

Would variable_index be more correct?

Copy link
Contributor Author

@sjahr sjahr Jun 6, 2024

Choose a reason for hiding this comment

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

Not sure but I like joint index better, are you fine with keeping it like this?

Copy link
Contributor

Choose a reason for hiding this comment

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

The reason why I'm proposing variable_index is because a joint can have multiple variables and this function iterates over those variables, not over joints.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll rename it

for (std::size_t i = 0; i < bounds.size(); ++i)
{
assert(bounds[i]->size() == 1); // single-variable joints.
max_joint_velocities[i] = std::min(-bounds[i]->at(0).min_velocity_, bounds[i]->at(0).max_velocity_);
Copy link
Contributor

Choose a reason for hiding this comment

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

If max. velocities or accelerations are not symmetric (e.g. [-1, 2]), this function will return the most limiting element (i.e. 1). Maybe worth clarifying that in the doc in the header, and maybe rename the function to getMostLimitingSymmetricVelocitiesAndAccelerations, which I realize it's probably too long...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I named it getMaxVelocitiesAndAccelerationBounds what do you think about that?

moveit_core/robot_model/src/joint_model_group.cpp Outdated Show resolved Hide resolved
Eigen::VectorXd lower_limits(group.getActiveVariableCount());
Eigen::VectorXd upper_limits(group.getActiveVariableCount());
const moveit::core::JointBoundsVector& group_bounds = group.getActiveJointModelsBounds();
int joint_index = 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

The reason why I'm proposing variable_index is because a joint can have multiple variables and this function iterates over those variables, not over joints.

moveit_core/robot_model/src/joint_model_group.cpp Outdated Show resolved Hide resolved
moveit_core/robot_model/src/joint_model_group.cpp Outdated Show resolved Hide resolved
moveit_core/robot_model/src/joint_model_group.cpp Outdated Show resolved Hide resolved
sjahr and others added 3 commits June 6, 2024 13:03
Co-authored-by: Mario Prats <mario.prats@picknik.ai>
Co-authored-by: Mario Prats <mario.prats@picknik.ai>
@sjahr sjahr requested a review from marioprats June 6, 2024 11:15
@sjahr sjahr merged commit 627d282 into moveit:main Jun 6, 2024
3 of 9 checks passed
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.

None yet

3 participants