Skip to content

Conversation

@Michi-Tsubaki
Copy link

@Michi-Tsubaki Michi-Tsubaki commented Sep 29, 2025

Proposed Feature: Object Alignment (:align A :to B method)

This PR introduces a new method to the CASCADED-COORDS class to simplify the essential operation of aligning an object based on an internal reference point to a target world coordinate.

Goal and Use Case

The current :move-to method can only move an object based on its representative coordinate system (i.e. the object's single representative frame).

Use Case: The :move-to command is inadequate when you need to align a specific feature (e.g. base of a kettle) to a target frame (e.g. or a table surface).

For me, I would like to align needle's specific coordinate to a target coordinate.
2025-09-29 234932

↓Move the needle and align the two coordinates

2025-09-29 235204

The specific goal of this feature is: To move the entire moving object (*tool-body*) so that its internal reference coordinates ($\mathbf{C}_{\text{internal}}$) precisely match the target coordinates ($\mathbf{C}_{\text{target}}$) in the world frame.

Usage

(send *tool-body* :align (send *tool-body* :reference-frame :copy-worldcoords) :to (send *target-object* :target-frame :copy-worldcoords))

@k-okada
Copy link
Member

k-okada commented Sep 30, 2025

will this work for you?

(setq *target-object* (make-cube 200 100 5 :coords (make-coords :pos #f(100 -50 25) :rpy #f(0.1 0.2 0.3))))
(setq *tool-body* (make-cube 20 10 15 :coords (make-coords :pos #f(-10 5 100) :rpy #f(-0.3 -0.2 -0.1))))                                                                         
(send *tool-body* :transform (send *tool-body* :transformation *target-object*))
(objects (list *target-object* *tool-body*))

@Michi-Tsubaki
Copy link
Author

Thank you.
But this does not work for me.
As for your suggestion,
(send (send *kettle* :worldcoords) :draw-on :flush t) is
image
So, the result of executing (send *kettle* :transform (send *kettle* :transformation *world-coords*)) is as shown below.
image
we can use only the representative coordintate = (send self :worldcoords)

However, what I want to do is
(send (car (send *kettle* :handle :worldcoords)) :draw-on :flush t) ← NOT (send self :worldcoords)
image

(send *kettle* :align (car (send *kettle* :handle :worldcoords)) :to *world-coords*))
image

As for my needle, I get 20-division points' coordinates by (send *needle* :point i :copy-worldcoords) (i is {0, 20}) and align this to the target.

Also, I fix it with @pazeshun to simplify the code. What I want to do is actually, ↓

  (:align (from &key to)
     (send self :transform (send from :transformation to :world) :world) ;;self is the object, from is the ANY coords assoc to the object, to is the target coords.
     self)

@Naoki-Hiraoka
Copy link
Contributor

will this work for you?

(send *kettle* :move-coords *world-coords* (car (send *kettle* :handle :worldcoords)))

@Michi-Tsubaki
Copy link
Author

Michi-Tsubaki commented Sep 30, 2025

It works! And my (send *needle* :move-coords (send *pad* :wound :copy-worldcoords) (send *needle* :point 10 :copy-worldcoords)) also works!

Thank you so much!

(ref. euslisp/jskeus#471)
(ref. euslisp/jskeus#486)

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.

3 participants