-
Notifications
You must be signed in to change notification settings - Fork 505
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
[Servo] Make conversion operations into free functions #2149
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #2149 +/- ##
==========================================
+ Coverage 50.47% 50.51% +0.04%
==========================================
Files 387 387
Lines 31815 31816 +1
==========================================
+ Hits 16056 16068 +12
+ Misses 15759 15748 -11
☔ View full report in Codecov by Sentry. |
9f5aba9
to
ff92ebf
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice refactoring. In a follow-up PR we could think about adding unit tests here. Would you mind opening an issue for that?
ff92ebf
to
7cdf7cd
Compare
If the cost of computing the transformation is not significant , we can compress the void toPlanningFrame(geometry_msgs::msg::TwistStamped& cmd, const std::string& planning_frame, const moveit::core::RobotStatePtr& current_state)
{
if (cmd.header.frame_id.empty())
{
RCLCPP_WARN(LOGGER, "No frame specified for command , will use planning_frame");
cmd.header.frame_id = planning_frame;
}
Eigen::Vector3d translation_vector(cmd.twist.linear.x, cmd.twist.linear.y, cmd.twist.linear.z);
Eigen::Vector3d angular_vector(cmd.twist.angular.x, cmd.twist.angular.y, cmd.twist.angular.z);
const auto tf_moveit_to_incoming_cmd_frame =
current_state->getGlobalLinkTransform(planning_frame).inverse() *
current_state->getGlobalLinkTransform(cmd.header.frame_id);
translation_vector = tf_moveit_to_incoming_cmd_frame.linear() * translation_vector;
angular_vector = tf_moveit_to_incoming_cmd_frame.linear() * angular_vector;
// Put these components back into a TwistStamped
cmd.header.frame_id = planning_frame;
cmd.twist.linear.x = translation_vector(0);
cmd.twist.linear.y = translation_vector(1);
cmd.twist.linear.z = translation_vector(2);
cmd.twist.angular.x = angular_vector(0);
cmd.twist.angular.y = angular_vector(1);
cmd.twist.angular.z = angular_vector(2);
} |
7cdf7cd
to
9c74536
Compare
Tested the functionality and it seems good 👍 |
@AndyZe should we include this compressed version or go with the original ? |
Prob want to throttle the warning:
Keep this comment too:
Seems good to me besides that |
320044a
to
2e16c37
Compare
Description
Should be merged after #2146
This PR makes the following conversions into free functions and moves them into utilities.
Pose
These changes help in keeping the code more readable and will make writing tests easier.
Checklist