You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Covariance is not transformed in do_transform_pose_with_covariance_stamped #431
Hi guys!
I am relatively new to ROS and wanted to try and contribute. I can see that this change has been made for the C++ API so I wanted to try and help for the Python API as well as it seems to not have been done.
I wrote up the following code below. It's nothing but a copy paste of #430 but I translated the relevant parts to Python code. I couldn't find the equivalent of tf::Matrix3x3 in Python so I just used np.array instead. I also couldn't find a transform.getBasis() method so I just used this link instead
And this just gets added to do_transform_pose_with_covariance_stamped(pose, transform) as res.pose.covariance = transformCovariance(pose.pose.covariance, transform)
Welcome! Thanks for the write up. What you have looks mostly fine - and is the path that I would've taken to fix this issue too.
However, I believe I didn't pursue this issue earlier because the Python API actually does not get installed (see snippet from CMakeLists.txt file), since there are some pending TODOs for #110 (specifically #90 (comment)).
# TODO(ros2/geometry2#110) Port python once PyKDL becomes usable in ROS 2
# ament_python_install_package(${PROJECT_NAME}
# PACKAGE_DIR src/${PROJECT_NAME})
# TODO(ros2/geometry2#110) Port python once PyKDL becomes usable in ROS 2
# install(PROGRAMS scripts/test.py
# DESTINATION lib/${PROJECT_NAME}
# )
I will look into if the Python API can be installed now. Regardless, if you don't mind opening a draft PR with what you suggested, I can give you a proper review there. Please remember to update the tests as necessary for the changes you introduce.
Activity
oss-vineet commentedon Sep 4, 2021
Hi guys!
I am relatively new to ROS and wanted to try and contribute. I can see that this change has been made for the C++ API so I wanted to try and help for the Python API as well as it seems to not have been done.
I wrote up the following code below. It's nothing but a copy paste of #430 but I translated the relevant parts to Python code. I couldn't find the equivalent of
tf::Matrix3x3in Python so I just usednp.arrayinstead. I also couldn't find atransform.getBasis()method so I just used this link instead`
def transformCovariance(cov_in, transform):
import numpy as np
q0 = transform.transform.rotation.w
q1 = transform.transform.rotation.x
q2 = transform.transform.rotation.y
q3 = transform.transform.rotation.z
And this just gets added to
do_transform_pose_with_covariance_stamped(pose, transform)asres.pose.covariance = transformCovariance(pose.pose.covariance, transform)aprotyas commentedon Sep 4, 2021
Welcome! Thanks for the write up. What you have looks mostly fine - and is the path that I would've taken to fix this issue too.
However, I believe I didn't pursue this issue earlier because the Python API actually does not get installed (see snippet from CMakeLists.txt file), since there are some pending TODOs for #110 (specifically #90 (comment)).
geometry2/tf2_geometry_msgs/CMakeLists.txt
Lines 21 to 28 in 8b12844
I will look into if the Python API can be installed now. Regardless, if you don't mind opening a draft PR with what you suggested, I can give you a proper review there. Please remember to update the tests as necessary for the changes you introduce.
oss-vineet commentedon Sep 5, 2021
Thanks for the feedback! I have the PR ready, I need to confirm the tests. I will try and submit a PR before the day's end
clalancette commentedon Sep 5, 2021
Unfortunately not. We still need to finish ros2/orocos_kinematics_dynamics#19 before we can re-enable Python for this package.
Fix for issue #431 - Covariance is not transformed in do_transform_po…
aprotyas commentedon Dec 21, 2021
I think this issue is actually solved since #453 was merged? If so, feel free to close it please!
clalancette commentedon Feb 3, 2022
I'm going to close this out per the last comment. Thanks for the PR.