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

Add nav2_gps_waypoint_follower #2111

Closed
wants to merge 33 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
5f33ac5
Add nav2_gps_waypoint_follower
jediofgever Dec 1, 2020
277c1e1
use correct client node while calling it to spin
jediofgever Dec 2, 2020
c6ee437
changed after 1'st review
jediofgever Dec 4, 2020
7b6f8cf
apply requested changes
jediofgever Dec 7, 2020
ac94d2d
nav2_util::ServiceClient instead of CallbackGroup
jediofgever Dec 7, 2020
cd9a287
another iteration to adress issues
jediofgever Dec 8, 2020
9c0e408
update poses with function in the follower logic
jediofgever Dec 8, 2020
f94e3b3
add deps of robot_localization: diagnostics
jediofgever Dec 8, 2020
e4fe184
fix typo in underlay.repo
jediofgever Dec 8, 2020
c2f4d95
add deps of robot_localization: geographic_info
jediofgever Dec 8, 2020
98804f1
minor clean-ups
jediofgever Dec 8, 2020
e95f55a
merge ros-planning::navigation2::main into jediofgever::navigation2::…
jediofgever Dec 9, 2020
960bb13
bond_core version has been updated
jediofgever Dec 9, 2020
623c6a6
rotation should also be considered in GPS WPFing
jediofgever Dec 14, 2020
ef57df0
use better namings related to gps wpf orientation
jediofgever Dec 14, 2020
063b8e7
handle cpplint errors
jediofgever Dec 14, 2020
e544fde
tf_listener needs to be initialized
jediofgever Dec 15, 2020
84c7ef0
apply requested changes
jediofgever Dec 17, 2020
d2c4127
apply requested changes 2.5/3.0
jediofgever Dec 17, 2020
aee13ca
apply requested changes 3.0/3.0
jediofgever Dec 17, 2020
4f83167
fix misplaced ";"
jediofgever Dec 17, 2020
6e322ea
use run time param for gps transform timeout
jediofgever Dec 18, 2020
81c7c64
change timeout var name
jediofgever Dec 18, 2020
7c69520
make use of stop_on_failure for GPS too
jediofgever Dec 21, 2020
7889ae3
passing emptywaypont vectors are seen as failure
jediofgever Dec 23, 2020
c28b93e
pull changes from ros-planing::navigation2::main
jediofgever Jan 5, 2021
c6613a8
update warning for empty requests
jediofgever Jan 8, 2021
0d0d59c
get upstream changes
jediofgever Jan 23, 2021
d7e2ad4
consider utm -> map yaw offset
jediofgever Jan 23, 2021
d6527d2
fix missed RCLCPP info
jediofgever Jan 23, 2021
f99ebff
reorrect action;s name
jediofgever Jan 23, 2021
e0a3aa6
get mainstream changes
jediofgever Mar 18, 2021
5fcfb83
waypoint stamps need to be updated
jediofgever Mar 19, 2021
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
46 changes: 29 additions & 17 deletions nav2_waypoint_follower/src/waypoint_follower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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/
Copy link
Member

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?

// 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);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use parameterized frames

Copy link
Member

Choose a reason for hiding this comment

The 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);
Copy link
Member

Choose a reason for hiding this comment

The 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);
Copy link
Member

Choose a reason for hiding this comment

The 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;
}

Expand Down