From 54822c652698841f96aa483de8be38d6a415f892 Mon Sep 17 00:00:00 2001 From: Tully Foote Date: Wed, 28 Feb 2024 13:16:42 -0800 Subject: [PATCH 1/5] Add draft of velocity transform specification --- source/Concepts/Intermediate/About-Tf2.rst | 99 ++++++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/source/Concepts/Intermediate/About-Tf2.rst b/source/Concepts/Intermediate/About-Tf2.rst index f43fceae6b..bea2522f91 100644 --- a/source/Concepts/Intermediate/About-Tf2.rst +++ b/source/Concepts/Intermediate/About-Tf2.rst @@ -30,6 +30,105 @@ tf2 can operate in a distributed system. This means all the information about the coordinate frames of a robot is available to all ROS 2 components on any computer in the system. tf2 can have every component in your distributed system build its own transform information database or have a central node that gathers and stores all transform information. +.. mermaid:: + + flowchart LR + E((Earth)) + E --> A[[Car A]] + E --> B[[Car B]] + E --> C{{Satellite C}} + E --> D((Moon D)) + +Publishing transforms +..................... + +When publishing transform we typically think of the transforms as the transform from on frame to the other. +The semantic difference is whether you are transforming data represented in a frame or transforming the frame itself. +These values are directly inverse. +Transforms published in the Transform message represent the frame forumlation. +Keep this in mind when debugging published transforms they are the inverse of what you will lookup depending on what direction you're traversing the transform tree. + +.. math:: + + + _{B}T^{data}_{A} = (_{B}T^{frame}_{A})^{-1} + +The TF library handles inverting these elements for you depending on which way you're traversing the transform tree. +For the rest of this document we will just use :math:`T^{data}` but the ``data`` is unwritten. + +Position +........ + +If the driver in car :math:`A` observes something and a person on the ground wants to know where it is relative to it's position, you transform the observation from the source frame to the target frame. + +.. math:: + + _{E}T_{A} * P_{A}^{Obs} = P_{E}^{Obs} + + +Now if a person in car B wants to know where it is too you can compute the net transform. + + +.. math:: + + _{B}T_{E} * _{E}T_{A} * P_{A}^{Obs} = _{B}T_{A} * P_{A}^{Obs} = P_{E}^{Obs} + + +This is exactly what ``lookupTransform`` provides where ``A`` is the *source* ``frame_id`` and ``B`` is the *target* ``frame_id``. + +It is recommended to use the ``transform(target_frame, ...)`` methods when possible because they will read the *source* ``frame_id`` from the datatype and write out the *target* ``frame_id`` in the resulting datatype and the math will be taken care of internally. + +If :math:`P` is a ``Stamped`` datatype then :math:`_A` is it's ``frame_id``. + +As an example, if a root frame ``A`` is one meter below frame ``B`` the transform from ``A`` to ``B`` is positive. + +However when converting data from coordinate frame ``B`` to coordinate frame ``A`` you have to use the inverse of this value. +This can be seen as you'll be adding value to the height when you change to the lower reference frame. +However if you are transforming data from coordinate frame ``A`` into coordinate frame ``B`` the height is reduced because the new reference is higher. + + + +.. math:: + + + _{B}T_{A} = (_{B}{Tf}_{A})^{-1} + + +Velocity +........ + + +For representing ``Velocity`` we have three pieces of information. :math:`V^{moving\_frame - reference\_frame}_{observing\_frame}` +This velocity represents the velocity between the moving frame and the reference frame. +And it is represented in the observing frame. + +For example a driver in Car A can report that they're driving forward(observed in A) at 1m/s (relative to earth) so that would be :math:`V_{A}^{A - E} = (1,0,0)` +Whereas that same velocity could be observed from the view point of the earth (lets assume the car is driving east and Earth is NED), it would be :math:`V_{E}^{A - E} = (0, 1, 0)` + +However transforms can show that these are actually the same with: + +.. math:: + + _{E}T_{A} * V_{A}^{A - E} = V_{E}^{A - E} + + +Velocities can be added or subtracted if they're represented in the same frame, in this case ``Obs``. + +.. math:: + + V_{Obs}^{A - C} = V_{Obs}^{A - B} + V_{Obs}^{B - C} + +TODO: Enumerate test cases for velocity reprojections via reference points(or collapsing). Especially with angular velocities. + +Velocities can be "reversed" by inverting. + +.. math:: + + V_{Obs}^{A - C} = (V_{Obs}^{C - A})^{-1} + +If you want to compare two velocities you must first transform them into the same observational frame first. + + Tutorials --------- From b7692b4ec39b66c4679ac5a912d35f3d5a5d605b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Thu, 14 Mar 2024 18:36:43 +0100 Subject: [PATCH 2/5] make linters happy' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero --- source/Concepts/Intermediate/About-Tf2.rst | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/source/Concepts/Intermediate/About-Tf2.rst b/source/Concepts/Intermediate/About-Tf2.rst index bea2522f91..187a89a1c5 100644 --- a/source/Concepts/Intermediate/About-Tf2.rst +++ b/source/Concepts/Intermediate/About-Tf2.rst @@ -59,14 +59,14 @@ For the rest of this document we will just use :math:`T^{data}` but the ``data`` Position ........ -If the driver in car :math:`A` observes something and a person on the ground wants to know where it is relative to it's position, you transform the observation from the source frame to the target frame. +If the driver in car :math:`A` observes something and a person on the ground wants to know where it is relative to it's position, you transform the observation from the source frame to the target frame. .. math:: _{E}T_{A} * P_{A}^{Obs} = P_{E}^{Obs} -Now if a person in car B wants to know where it is too you can compute the net transform. +Now if a person in car B wants to know where it is too you can compute the net transform. .. math:: @@ -94,7 +94,7 @@ However if you are transforming data from coordinate frame ``A`` into coordinate _{B}T_{A} = (_{B}{Tf}_{A})^{-1} -Velocity +Velocity ........ @@ -112,15 +112,15 @@ However transforms can show that these are actually the same with: _{E}T_{A} * V_{A}^{A - E} = V_{E}^{A - E} -Velocities can be added or subtracted if they're represented in the same frame, in this case ``Obs``. +Velocities can be added or subtracted if they're represented in the same frame, in this case ``Obs``. .. math:: V_{Obs}^{A - C} = V_{Obs}^{A - B} + V_{Obs}^{B - C} -TODO: Enumerate test cases for velocity reprojections via reference points(or collapsing). Especially with angular velocities. +TODO: Enumerate test cases for velocity reprojections via reference points(or collapsing). Especially with angular velocities. -Velocities can be "reversed" by inverting. +Velocities can be "reversed" by inverting. .. math:: From 517535ba505a5839a06e8f8efdc35c1d08063050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Thu, 14 Mar 2024 18:37:04 +0100 Subject: [PATCH 3/5] spelling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero --- source/Concepts/Intermediate/About-Tf2.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Concepts/Intermediate/About-Tf2.rst b/source/Concepts/Intermediate/About-Tf2.rst index 187a89a1c5..aa4da1c901 100644 --- a/source/Concepts/Intermediate/About-Tf2.rst +++ b/source/Concepts/Intermediate/About-Tf2.rst @@ -42,10 +42,10 @@ tf2 can have every component in your distributed system build its own transform Publishing transforms ..................... -When publishing transform we typically think of the transforms as the transform from on frame to the other. +When publishing transforms we typically think of the transforms as the transform from on frame to the other. The semantic difference is whether you are transforming data represented in a frame or transforming the frame itself. These values are directly inverse. -Transforms published in the Transform message represent the frame forumlation. +Transforms published in the Transform message represent the frame formulation. Keep this in mind when debugging published transforms they are the inverse of what you will lookup depending on what direction you're traversing the transform tree. .. math:: @@ -102,7 +102,7 @@ For representing ``Velocity`` we have three pieces of information. :math:`V^{mov This velocity represents the velocity between the moving frame and the reference frame. And it is represented in the observing frame. -For example a driver in Car A can report that they're driving forward(observed in A) at 1m/s (relative to earth) so that would be :math:`V_{A}^{A - E} = (1,0,0)` +For example a driver in Car A can report that they're driving forward (observed in A) at 1m/s (relative to earth) so that would be :math:`V_{A}^{A - E} = (1,0,0)` Whereas that same velocity could be observed from the view point of the earth (lets assume the car is driving east and Earth is NED), it would be :math:`V_{E}^{A - E} = (0, 1, 0)` However transforms can show that these are actually the same with: From 69c11bbdd3c434b7c9fa686cdd5f1e115ad67150 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Wed, 3 Apr 2024 13:21:22 +0200 Subject: [PATCH 4/5] feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero --- source/Concepts/Intermediate/About-Tf2.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source/Concepts/Intermediate/About-Tf2.rst b/source/Concepts/Intermediate/About-Tf2.rst index aa4da1c901..3cf5a1b016 100644 --- a/source/Concepts/Intermediate/About-Tf2.rst +++ b/source/Concepts/Intermediate/About-Tf2.rst @@ -71,7 +71,7 @@ Now if a person in car B wants to know where it is too you can compute the net t .. math:: - _{B}T_{E} * _{E}T_{A} * P_{A}^{Obs} = _{B}T_{A} * P_{A}^{Obs} = P_{E}^{Obs} + _{B}T_{E} * _{E}T_{A} * P_{A}^{Obs} = _{B}T_{A} * P_{A}^{Obs} = P_{B}^{Obs} This is exactly what ``lookupTransform`` provides where ``A`` is the *source* ``frame_id`` and ``B`` is the *target* ``frame_id``. @@ -116,7 +116,7 @@ Velocities can be added or subtracted if they're represented in the same frame, .. math:: - V_{Obs}^{A - C} = V_{Obs}^{A - B} + V_{Obs}^{B - C} + V_{Obs}^{A - C} = V_{Obs}^{A - B} + V_{Obs}^{D - C} TODO: Enumerate test cases for velocity reprojections via reference points(or collapsing). Especially with angular velocities. @@ -124,7 +124,7 @@ Velocities can be "reversed" by inverting. .. math:: - V_{Obs}^{A - C} = (V_{Obs}^{C - A})^{-1} + V_{Obs}^{A - C} = -(V_{Obs}^{C - A}) If you want to compare two velocities you must first transform them into the same observational frame first. From e4e6af5317a9178c25c2174696726f23db60d723 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Thu, 22 Aug 2024 10:51:34 +0200 Subject: [PATCH 5/5] Feedback MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Alejandro Hernández Cordero --- source/Concepts/Intermediate/About-Tf2.rst | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/source/Concepts/Intermediate/About-Tf2.rst b/source/Concepts/Intermediate/About-Tf2.rst index 840ff9d573..f9d1bdfb45 100644 --- a/source/Concepts/Intermediate/About-Tf2.rst +++ b/source/Concepts/Intermediate/About-Tf2.rst @@ -40,12 +40,12 @@ tf2 can have every component in your distributed system build its own transform E --> D((Moon D)) Publishing transforms -..................... +^^^^^^^^^^^^^^^^^^^^^ -When publishing transforms we typically think of the transforms as the transform from on frame to the other. +When publishing transforms we typically think of the transforms as the transform from one frame to the other. The semantic difference is whether you are transforming data represented in a frame or transforming the frame itself. These values are directly inverse. -Transforms published in the Transform message represent the frame formulation. +Transforms published in the ``geometry_msgs/msg/Transform`` message represent the frame formulation. Keep this in mind when debugging published transforms they are the inverse of what you will lookup depending on what direction you're traversing the transform tree. .. math:: @@ -57,7 +57,7 @@ The TF library handles inverting these elements for you depending on which way y For the rest of this document we will just use :math:`T^{data}` but the ``data`` is unwritten. Position -........ +^^^^^^^^ If the driver in car :math:`A` observes something and a person on the ground wants to know where it is relative to it's position, you transform the observation from the source frame to the target frame. @@ -86,8 +86,6 @@ However when converting data from coordinate frame ``B`` to coordinate frame ``A This can be seen as you'll be adding value to the height when you change to the lower reference frame. However if you are transforming data from coordinate frame ``A`` into coordinate frame ``B`` the height is reduced because the new reference is higher. - - .. math:: @@ -95,8 +93,7 @@ However if you are transforming data from coordinate frame ``A`` into coordinate Velocity -........ - +^^^^^^^^ For representing ``Velocity`` we have three pieces of information. :math:`V^{moving\_frame - reference\_frame}_{observing\_frame}` This velocity represents the velocity between the moving frame and the reference frame. @@ -118,8 +115,6 @@ Velocities can be added or subtracted if they're represented in the same frame, V_{Obs}^{A - C} = V_{Obs}^{A - B} + V_{Obs}^{D - C} -TODO: Enumerate test cases for velocity reprojections via reference points(or collapsing). Especially with angular velocities. - Velocities can be "reversed" by inverting. .. math::