Skip to content

Conversation

sjahr
Copy link
Contributor

@sjahr sjahr commented Apr 21, 2023

Description

Continues #462

Original description

Adding a tutorial that showcases how to use IK cost functions with MoveIt. Please use the branch from https://github.com/ros-planning/moveit2/pull/1386

Checklist

  • Required by CI: Code is auto formatted using clang-format
  • While waiting for someone to review your request, please consider reviewing another open pull request to support the maintainers

@sjahr sjahr requested review from tylerjw and wyattrees April 21, 2023 10:50
…unction_tutorial.launch.py

Co-authored-by: Sebastian Castro <4603398+sea-bass@users.noreply.github.com>
Copy link
Contributor

@sea-bass sea-bass left a comment

Choose a reason for hiding this comment

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

Following our latest PR to this repo, since this work is up to date with ROS 2 should it go in the how to guides vs. the examples?

Comment on lines 224 to 226
const auto frac = moveit::core::CartesianInterpolator::computeCartesianPath(
start_state.get(), joint_model_group, traj, joint_model_group->getLinkModel("panda_link8"), target, true,
max_eef_step, jump_thresh, callback_fn, opts, cost_fn);
Copy link
Contributor

Choose a reason for hiding this comment

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

Might be worth saying if you don't want to use the cost function (for comparison), how do you leave it out? Would you just omit that last argument?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Exactly, if you leave it out it will just use an empty std::function object, alternatively, you can pass it an empty function object.

  static Distance computeCartesianPath(
      RobotState* start_state, const JointModelGroup* group, std::vector<std::shared_ptr<RobotState>>& traj,
      const LinkModel* link, const Eigen::Vector3d& translation, bool global_reference_frame,
      const MaxEEFStep& max_step, const JumpThreshold& jump_threshold,
      const GroupStateValidityCallbackFn& validCallback = GroupStateValidityCallbackFn(),
      const kinematics::KinematicsQueryOptions& options = kinematics::KinematicsQueryOptions(),
      const kinematics::KinematicsBase::IKCostFn& cost_function = kinematics::KinematicsBase::IKCostFn());

Since the tutorial is about using the cost function API and we assume the users to have some C++ skills I would not explain this.

…tion_tutorial.cpp

Co-authored-by: Sebastian Castro <4603398+sea-bass@users.noreply.github.com>
std::vector<moveit::core::RobotStatePtr> traj;
moveit::core::MaxEEFStep max_eef_step(0.01, 0.1);
// Here, we're effectively disabling the jump threshold for joints. This is not recommended on real hardware.
moveit::core::JumpThreshold jump_thresh(0.0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sea-bass Looks to me like jump checking is disabled completely (see here) but I don't know why 🤷 I guess the cost function prevent joint jumps here, since we're minimizing joint motions

@mergify
Copy link

mergify bot commented Apr 24, 2023

This pull request is in conflict. Could you fix it @sjahr?

@sjahr sjahr requested a review from sea-bass April 26, 2023 14:45
@sea-bass
Copy link
Contributor

I think this will serve as a good reference point for doing the same with pick_ik once we make tutorials for that!

@tylerjw tylerjw merged commit 9557290 into moveit:main Apr 27, 2023
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.

4 participants