Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[colcon][tf2_py] fix catkin_symlink_install error in tf2_py #1

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1040,6 +1040,13 @@ void doTransform(const geometry_msgs::Wrench& t_in, geometry_msgs::Wrench& t_out
{
doTransform(t_in.force, t_out.force, transform);
doTransform(t_in.torque, t_out.torque, transform);
// add additional torque created by translating the force
tf2::Vector3 offset = {transform.transform.translation.x, transform.transform.translation.y,
transform.transform.translation.z};
tf2::Vector3 added_torque = offset.cross({t_out.force.x, t_out.force.y, t_out.force.z});
t_out.torque.x += added_torque.getX();
t_out.torque.y += added_torque.getY();
t_out.torque.z += added_torque.getZ();
}


Expand Down
10 changes: 5 additions & 5 deletions tf2_geometry_msgs/test/test_tf2_geometry_msgs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -336,19 +336,19 @@ TEST(TfGeometry, doTransformWrench)
v1.torque.z = 3;

geometry_msgs::TransformStamped trafo;
trafo.transform.translation.x = -1;
trafo.transform.translation.y = 2;
trafo.transform.translation.z = -3;
trafo.transform.translation.x = 0;
trafo.transform.translation.y = -2;
trafo.transform.translation.z = 0;
trafo.transform.rotation = tf2::toMsg(tf2::Quaternion(tf2::Vector3(0,0,1), -M_PI / 2.0));

tf2::doTransform(v1, res, trafo);
EXPECT_NEAR(res.force.x, 1, EPS);
EXPECT_NEAR(res.force.y, -2, EPS);
EXPECT_NEAR(res.force.z, 3, EPS);

EXPECT_NEAR(res.torque.x, 1, EPS);
EXPECT_NEAR(res.torque.x, -5, EPS);
EXPECT_NEAR(res.torque.y, -2, EPS);
EXPECT_NEAR(res.torque.z, 3, EPS);
EXPECT_NEAR(res.torque.z, 5, EPS);
}

int main(int argc, char **argv){
Expand Down
2 changes: 1 addition & 1 deletion tf2_py/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ set_target_properties(tf2_py PROPERTIES
# DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
# )

install(FILES $<TARGET_FILE:tf2_py>
install(TARGETS tf2_py
DESTINATION ${CATKIN_PACKAGE_PYTHON_DESTINATION}
)

Expand Down