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

Plan_cartesian_motion uses Waypoints class #422

Merged
merged 28 commits into from
Jun 14, 2024

Conversation

yck011522
Copy link
Contributor

This is a short PR to migrate the plan_cartrsian_motion to use Waypoints class.

At the moment, only the FrameWaypoints are supported as no implementation is added for PointAxisWaypoints yet. Will do that in next PR.

What type of change is this?

  • Bug fix in a backwards-compatible manner.
  • [] New feature in a backwards-compatible manner.
  • Breaking change: bug fix or new feature that involve incompatible API changes.
  • Other (e.g. doc update, configuration, etc)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I added a line to the CHANGELOG.md file in the Unreleased section under the most fitting heading (e.g. Added, Changed, Removed).
  • I ran all tests on my computer and it's all green (i.e. invoke test).
  • I ran lint on my computer and there are no errors (i.e. invoke lint).
  • I added new functions/classes and made them available on a second-level import, e.g. compas_fab.robots.CollisionMesh.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

CHANGELOG.md Outdated Show resolved Hide resolved
Comment on lines 1324 to 1325
If a tool is attached to the robot, the :meth:`~compas_fab.robots.Waypoints.tool_coordinate_frame` parameter
should be set.
Copy link
Member

Choose a reason for hiding this comment

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

I would rephrase this, I have a hard time parsing what it means.

Comment on lines -1332 to -1334
use_attached_tool_frame : :obj:`bool`, optional
If ``True`` and there is a tool attached to the planning group, it will use its TCF
instead of the T0CF to calculate cartesian paths. Defaults to ``True``.
Copy link
Member

Choose a reason for hiding this comment

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

I'm not convinced with the removal of this. I think we need to review the idea of having tool_coordinate_frame in the targets and waypoints classes. It feels to me like these could contain the name or key of the tool to use, but the coordinate frame should not be attached inside them, otherwise, if we serialize that, and re-measure the tool, the waypoints need to be somehow retrofitted/updated with the new tcf. That doesn't make much sense.

def test_kinematics_cartesian_with_tool_coordinate_frame(frame_waypoints):
if compas.IPY:
return
frame_waypoints.tool_coordinate_frame = Frame([0.01, 0.02, -0.03], [1, 0, 0], [0, 1, 0])
Copy link
Member

@gonzalocasas gonzalocasas Jun 1, 2024

Choose a reason for hiding this comment

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

Again this feel incorrect. When seeing it here in a full example, it's clearer that is wrong imo. The tool needs to be defined with a key and a TCF, and the waypoints should only say e.g. frame_waypoints.tool_id = "suction_gripper"

Copy link
Member

@gonzalocasas gonzalocasas left a comment

Choose a reason for hiding this comment

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

I left a bunch of feedback, some of it might require some refactoring of the existing stuff.

@yck011522 yck011522 closed this Jun 13, 2024
@yck011522 yck011522 deleted the feature_plan_c_motion_uses_waypoints branch June 13, 2024 06:29
@yck011522 yck011522 restored the feature_plan_c_motion_uses_waypoints branch June 13, 2024 06:30
@yck011522 yck011522 reopened this Jun 13, 2024
Comment on lines +513 to +516
# If the user provides a transformation, convert it to a Frame
if isinstance(tool_coordinate_frame, Transformation):
tool_coordinate_frame = Frame.from_transformation(tool_coordinate_frame)
self.tool_coordinate_frame = tool_coordinate_frame
Copy link
Member

Choose a reason for hiding this comment

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

This is problematic because it's redundant information: the tool has its frame defined, but this will repeat the same data, losing track of its source, so if the tool changes frame, the target has no way to know the data is incorrect.

Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@gonzalocasas gonzalocasas left a comment

Choose a reason for hiding this comment

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

We're merging this, with the pending remark about #435 that really needs to be checked and decided on.

@gonzalocasas gonzalocasas merged commit 9195ee5 into main Jun 14, 2024
29 checks passed
@gonzalocasas gonzalocasas deleted the feature_plan_c_motion_uses_waypoints branch June 14, 2024 08:20
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