Skip to content

Tool mounting base frame - #33

Open
gonzalocasas wants to merge 3 commits into
mainfrom
tool-base-frame
Open

Tool mounting base frame#33
gonzalocasas wants to merge 3 commits into
mainfrom
tool-base-frame

Conversation

@gonzalocasas

Copy link
Copy Markdown
Member

After endless talks with @yck011522 about what was the correct way to define tool mounting according to ROS-I conventions and also our own experience beyond ROS-I, I believe I have found an approach that is sane, defaults to proper stuff, aligns well with what is intuitive, and it is also backwards compatible (for the most part).

The change is fundamentally simple: rely on the fact that ToolModels are robots, and each link can define its origin (origin==frame in urdf, not just point), so instead of leaving the base origin (ie. frame) empty, we can allow the user to define it, and that will be the mounting plane to whatever end-effector plane is detected on the target robot. This means that tools don't have to be defined in X+ or Z+, they can be defined in whatever the fuck the user feels like, as long as they provide a meaningful base plane. X+ needs a matching base plane, and Z+ would default to the XY world plane, which is the most sensible default for the vast majority of our users.

This PR is only one half of the change. The other is on compas_fab and it includes an automated test with visual verification for mounting tools across robots, planner backends and tool model orientations.

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 have added tests that prove my fix is effective or that my feature works.
  • I have added necessary documentation (if appropriate)

gonzalocasas and others added 2 commits July 31, 2026 11:45
`Joint._create` transformed `current_axis` in place instead of
recomputing it from `axis`, so it only produced the right answer the
first time it ran. Re-initializing the tree of a model that has joints
rotated every axis once more — 90 degrees per extra call for a joint
whose origin is rotated by 90 degrees.

Nothing hit this while models were built or loaded in a single pass,
which is why it went unnoticed, but it makes any structural edit
followed by a re-initialization silently wrong.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
The geometry of a ToolModel had to be modelled in the tool's own base
frame, because that frame was hardcoded to the origin: the mesh
coordinates *were* the base frame. So a tool drawn the natural way in a
CAD document had to be redrawn to mount correctly on a robot.

Add `reframe_base`, and a `base_frame` shorthand on the constructor, to
state that the flange takes hold of the tool at a given frame instead,
re-expressing the tool accordingly. Nothing is baked into the geometry:
the frame is folded into the `origin` of the link and joint elements,
the same mechanism URDF uses, so it survives serialization and is
honoured by every consumer of the model.

Tools with joints are re-framed as a whole — the base link's geometry,
the joints leaving it, and the TCF all follow — so a gripper keeps
articulating around the correct axes. Verified against the 3-link
kinematic gripper of compas_fab's ToolLibrary as well.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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.

1 participant