Closed mitiguy closed 2 years ago
Well, to be more precise, some half dozen out of maybe five dozen PRs have been filed.
In Anzu, I'm still using a heavy mixture of Isometry3
and RigidTransform
for my portion of the perception bits.
I want to use RigidTransform
for the advantages mentioned above, but I still prefer Isometry3
(esp. in Python code) as it's still used throughout MultibodyPlant
, and I dislike having to do excessive conversions.
Is there a way we can accelerate fixing this by permitting temporary implicit conversions in C++ + Python, and spew compile-time or run-time warnings that will turn into errors, and just convert all existing APIs within the next couple of weeks?
BTW: Minor nit, but this issue states that RigidTransform
has Python bindings, but I'm not sure if that's a valid contrast as Isometry3
already has bindings?
@mitiguy and @amcastro-tri also proposed a temporary implicit conversion from RigidTransform to Isometry3. I've been resisting that because I thought it would entail hidden performance cost and delay the eventual conversion. But I'll change my mind if that's better -- can you say more? Are you proposing that the implicit conversion operator should issue a deprecated warning right away?
My proposal was:
::linear()
, toIsometry3()
, etc.::linear()
, toIsometry3()
, etc.)Would that work?
If the overall goal is to accelerate and finish the transition, then I think the most relevant factor is who is working on it, not the particular API details. If we want to get it done more quickly, then we simply should assign developers besides @mitiguy to work on it. For what conversions or overloads we offer, that should be judged based on their nature (are the correct, usable, compatible, etc.), not waffled on based on the low PR velocity.
I think the critical gating item is converting the APIs for MBP and SG from accepting and returning Isometry3s to RigidTransforms (and similary Matrix3 to RotationMatrix). If that were done would it still make sense to have implicit conversions?
Isn't the best way to answer "are implicit conversion operaions needed" to inspect our using-code and see if it would be improved by (/ would take advantage of) such conversions? I'd rather trust a PR that adds conversions and by doing so cleans up the calling code, than trust some issue-comment hypotheticals without any basis in empirical reality.
We discussed this topic at our Monday morning meeting (March 18, 2019). The consensus (as of now) was to proceed as quickly as possible to change the Isometry3 arguments to public methods/functions to RigidTransform. The utility of implicit conversions was unclear. To be continued. I'll restart changing Isometry3 to RigidTransform in SceneGraph (with Sean) and Multibody soon.
See spike test in #10959.
I'll propose an additional related task: Update the RigidTransform class overview API with the "justify your existence" / "contrast with Isometry3d" rationale provided in this issue's overview post.
PR #11026 is in process to address issue #11020 (Update RigidTransform doc to explain why it is better than Isometry3).
Please everyone start using RigidTransform instead of Isometry3!
Now that #10959 was merged, issue #11064 was created to track the progress on migrating call sites within Drake. Looking for volunteers to address it jointly.
What is the remaining work for this epic? I see #11064 and #10742 referenced that are opened still. Are these the remaining work for the scope of this issue?
Are these the remaining work for the scope of this issue?
Yes. #10742 refers to RotationMatrix rather than RigidTransform but they are related because a RigidTransform contains a RotationMatrix (plus a Vector3).
Putting a note that there's a need to port SG to RigidTransform. Not time critical right now, but needs to be tracked.
Resolved HongKai's issue #10816 which does two things: a. Provided RigidTransform operator to multiply n position vectors (similar to Eigen Isometry functionality needed by Hongkai for upcoming work). b. Ensured RigidTransform operator disallows multiplication with weirdly-sized matrices -- which was previously possible due to what appears to be a bug in Eigen.
Landed PR# which made RigidTransform easy to use with Eigen::Translation3 in C++.
Progress update Monday May 20th -- background information only All progress last week was on updating the Jacobian interface (Issue in progress #10155), none on this issue. Merged PR#11414 12 days ago which checked off the following boxes in this issue: multibody/benchmarks/kuka_iiwa_robot/drake_kuka_iiwa_robot.h: 1 @mitiguy multibody/benchmarks/kuka_iiwa_robot/make_kuka_iiwa_model.cc: 1 @mitiguy multibody/plant/test/frame_kinematics_test.cc: 7 @mitiguy multibody/plant/test/kuka_iiwa_model_tests.h: 1 @mitiguy multibody/plant/test/multibody_plant_jacobians_test.cc: 1 @mitiguy multibody/plant/test/multibody_plant_test.cc: 11 @mitiguy
Update as of June 11, 2019:
Removed instance of GetAsIsometry() in MultibodyTree
Update as of June 17, 2019: No substantial progress recently as I am working on Jacobians.
@mitiguy, @jwnimmer-tri just realized that we forgot to add to our checklist the deprecation of RigidTransform::linear()
and sibling methods within the DRAKE_DOXYGEN_CXX
in rigid_transform.h
.
Essentially everything here must be deprecated and ultimately removed.
I am working towards eventually deprecating .linear(). However, it is not a first priority as it is in high use in the code and Isometry is still awaiting conversion to RigidTransform in SceneGraph (via Sean, Paul, ...). The reasons for deprecating .linear() are twofold (or more). Firstly, it returns a generic Matrix3 not a RotationMatrix&. Secondly, the semantics of .linear() are poor in the context of the RigidTransform class.
Zenhub update June 24, 2019: Planning for progress this week, concurrent with work on Jacobians.
@mitiguy can we close this now?
I did a grep for Isometry on the project.
Other than the attic (soon to disappear), there are about 340 instances of Isometry.
The vast majority are related to Python or examples.
Given this, can I ask what the next action item is, and who's on point for it? I'm happy to help on some of the Python examples (~25%).
There are a couple in geometry
that are inescapable -- SceneGraph
has to convert from RigidTransform
to Isometry3
to talk to FCL (note: this is strictly internal and not art of the public API). In all of geometry, that accounts for six incarnations.
The one exception is SceneGraph
's current dependence on PoseBundle
which has an Isometry3
. Ultimately, we want the dependency on PoseBundle
to simply go away -- a system that strictly uses QueryObject
to communicate with DrakeVisualizer
. If PoseBundle
were to change its contents, then SceneGraph
would lose the Isometry3
as well, whether we introduce the visualization system or not.
Ultimately, we want the dependency on
PoseBundle
to simply go away -- a system that strictly usesQueryObject
[...]
Relates #10482
Notes that #11888 already calls out some acute uses of Isometry3 to be fixed.
I landed here because we've again had three months pass with little to no progress, and so the deprecation date is going to bump forward again another three months.
The vast majority are related to Python or examples.
I don't think that's a helpful summary. It might be factually accurate, but is is not the relevant metric to survey. Most of the pydrake uses are just mirroring whatever C++ uses exist. (So when the C++ goes away, so does the Python.) There are several novel uses of Isometry3
elsewhere.
For example, there's a whole bunch of //drake/manipulation/perception
uses that need to be ported. Also the DiffIK API, bot_core integration, and some miscellany.
I've opened #13595 to measure how close we are to being able to deprecate the implicit conversions. That's an important milestone to lock in progress.
Beyond that question, for a "Priority: High" issue we really need someone to step up and create a checklist of things remaining to be ported. So far, I've been poking at it with:
find . -name bindings -prune -o -name doc -prune -o -name attic -prune -o -type f -exec grep --color -l -e Isometry3 {} + | sort
It's possible that a big part of finishing this is just deprecate dead code. For example, ./manipulation/util/bot_core_lcm_encode_decode.h:28:void EncodePose(...)
is dead code that mentions Isometry3. Once we deprecation-badge it, then we wait three months and that's one less thing on the hitlist here.
FTR I've updated Anzu to remove deprecations, which seems to indicate that all Anzu Python code has now switched from Isometry3
to RigidTransform
, except for usages of DiffIk
.
I just arrived here because I'm touching DiffIK, which (as Eric noted) still has Isometry3. I know it will involve changes to drake + anzu, but if we resolve it now, I can be sure to avoid introducting Isometry3 in my course notes. @mitiguy -- perhaps you can take a look once #13877 merges?
@RussTedrake Yes, I'll take another look at what I can do to push this issue forward, some of which may be to encourage others to update the parts of the code in which they are well versed.
In Drake I think the only Isometrys that ought to be RigidTransforms are just a couple of simple uses in optitrack_sender.cc and in symbolic_expression_transform_test.cc. @mitiguy do you want to fix those and then call this done? Or did I miss some?
The symbolic_expression_transform_test is a unit test for #6604. You should not change or remove the test unless you also change or remove the operator*
overloads.
I think Global IK also has uses that should be changed \CC @hongkai-dai ?
The PoseSmoother
class under manipulation/perception
has Value<Isometry3>
on input and output ports. We should also fix that?
I'll take a look and see what simple ones that I can change.
One year later, we still have inverse kinematics and perception-related systems using Isometry3d. I'll work on fixing those and/or farming out the fixes.
Edited to add a checklist:
./examples/manipulation_station/differential_ik.py
./multibody/parsing/process_model_directives.cc:21:using Eigen::Isometry3d;
./bindings/pydrake/systems/meshcat_visualizer.py:15:from pydrake.common.eigen_geometry import Quaternion, Isometry3
./bindings/pydrake/systems/test/rendering_test.py:30: Isometry3,
./examples/manipulation_station/manipulation_station_hardware_interface.cc:27:using Eigen::Isometry3d;
./examples/manipulation_station/end_effector_teleop_sliders.py:145: @param pose is an Isometry3.
./examples/manipulation_station/end_effector_teleop_dualshock4.py:181: @param pose is an Isometry3.
./examples/manipulation_station/end_effector_teleop_mouse.py:152: @param pose is an Isometry3.
./systems/sensors/optitrack_sender.cc:13:void PopulateRigidBody(const Eigen::Isometry3d& T_WF,
./systems/sensors/optitrack_sender.cc:55: const Eigen::Isometry3d& pose = poses.value(frame.first).GetAsIsometry3();
./common/eigen_types.h:148:using Isometry3 = Eigen::Transform<Scalar, 3, Eigen::Isometry>;
~
RigidTransform<T>
) and is not any kind of real problem, so we can keep it around.@mitiguy may want to participate in nuking some of those
All done. All unwanted uses of Isometry3
are now either deprecated or fixed already, filed as pull requests, or filed as separate issues.
Woo hoo!
Drake's C++ source code currently employs an Isometry to relate the orientation and position of two frames.
Isometry stores the frames' relative orientation in a 3x3 rotation matrix and the frames' relative position in a 3x1 vector. Isometry has the following defects:
Isometry is being replace by RigidTransform, which has the following advantages:
Related issue, Upgrade Matrix3 to RotationMatrix: #10742