-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add nav2_gps_waypoint_follower #2111
Changes from 1 commit
5f33ac5
277c1e1
c6ee437
7b6f8cf
ac94d2d
cd9a287
9c0e408
f94e3b3
e4fe184
c2f4d95
98804f1
e95f55a
960bb13
623c6a6
ef57df0
063b8e7
e544fde
84c7ef0
d2c4127
aee13ca
4f83167
6e322ea
81c7c64
7c69520
7889ae3
c28b93e
c6613a8
0d0d59c
d7e2ad4
d6527d2
f99ebff
e0a3aa6
5fcfb83
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -320,7 +320,7 @@ void WaypointFollower::followWaypointsLogic( | |
if (goal_index >= poses.size()) { | ||
RCLCPP_INFO( | ||
get_logger(), "Completed all %i waypoints requested.", | ||
poses.size()); | ||
static_cast<int>(poses.size())); | ||
result->missed_waypoints = failed_ids_; | ||
action_server->succeeded_current(result); | ||
failed_ids_.clear(); | ||
|
@@ -428,33 +428,45 @@ WaypointFollower::convertGPSPoses2MapPoses( | |
} | ||
continue; | ||
} else { | ||
// this poses are assumed to be on global frame (map) | ||
geometry_msgs::msg::PoseStamped curr_pose_map_frame; | ||
curr_pose_map_frame.header.frame_id = "map"; | ||
curr_pose_map_frame.header.stamp = stamp; | ||
curr_pose_map_frame.pose.position.x = response->map_point.x; | ||
curr_pose_map_frame.pose.position.y = response->map_point.y; | ||
curr_pose_map_frame.pose.position.z = response->map_point.z; | ||
|
||
geometry_msgs::msg::PoseStamped curr_pose_utm_frame; | ||
curr_pose_utm_frame.pose.orientation = curr_oriented_navsat_fix.orientation; | ||
curr_pose_utm_frame.header.frame_id = "utm"; | ||
// fromll_client converted the point from LL to Map frames | ||
// but it actually did not consider the possible yaw offset between utm and map frames ; | ||
// "https://github.com/cra-ros-pkg/robot_localization/blob/ | ||
// 79162b2ac53a112c51d23859c499e8438cf9938e/src/navsat_transform.cpp#L394" | ||
// see above link on how they set rotation between UTM and | ||
// Map to Identity , where actually it might not be | ||
geometry_msgs::msg::TransformStamped utm_to_map_transform; | ||
try { | ||
tf_buffer_->transform( | ||
curr_pose_utm_frame, curr_pose_map_frame, "map", | ||
tf2::durationFromSec(transform_tolerance_)); | ||
utm_to_map_transform = tf_buffer_->lookupTransform("utm", "map", tf2::TimePointZero); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use parameterized frames There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see how these differ. In the previous version you give it the info and let it transform, now you're handling the same operations manually - both between the same 2 frames. |
||
} catch (tf2::TransformException & ex) { | ||
RCLCPP_ERROR( | ||
parent_node->get_logger(), | ||
"Exception in itm -> map transform: %s", | ||
"Exception in getting utm -> map transform: %s", | ||
ex.what()); | ||
} | ||
tf2::Quaternion utm_to_map_quat; | ||
tf2::fromMsg(utm_to_map_transform.transform.rotation, utm_to_map_quat); | ||
double roll, pitch, yaw; | ||
tf2::Matrix3x3 m(utm_to_map_quat); m.getRPY(roll, pitch, yaw); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't do multi-line |
||
// we need to consider the possible yaw_offset between utm and map here, | ||
// rotate x , y with amount of yaw | ||
double x = response->map_point.x; | ||
double y = response->map_point.y; | ||
double x_dot = x * std::cos(yaw) - y * std::sin(yaw); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please use proper vector operations - this is fragile and won't work for non-SE2 navigation types |
||
double y_dot = x * std::sin(yaw) + y * std::cos(yaw); | ||
geometry_msgs::msg::PoseStamped curr_pose_map_frame; | ||
curr_pose_map_frame.header.frame_id = "map"; | ||
curr_pose_map_frame.header.stamp = stamp; | ||
curr_pose_map_frame.pose.position.x = x_dot; | ||
curr_pose_map_frame.pose.position.y = y_dot; | ||
curr_pose_map_frame.pose.position.z = response->map_point.z; | ||
curr_pose_map_frame.pose.orientation = curr_oriented_navsat_fix.orientation; | ||
poses_in_map_frame_vector.push_back(curr_pose_map_frame); | ||
} | ||
} | ||
RCLCPP_INFO( | ||
parent_node->get_logger(), | ||
"Converted all %i GPS waypoint to Map frame", poses_in_map_frame_vector.size()); | ||
"Converted all %i GPS waypoint to Map frame", | ||
static_cast<int>(poses_in_map_frame_vector.size())); | ||
return poses_in_map_frame_vector; | ||
} | ||
|
||
|
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.
Should a ticket be filed about this / fixed there?