[WIP] Following an object a certain distance#1748
[WIP] Following an object a certain distance#1748fmrico wants to merge 1 commit intoros-navigation:masterfrom
Conversation
Signed-off-by: Francisco Martin Rico <fmrico@gmail.com>
| | ComputePathToPose | Action | Invokes the ComputePathToPose ROS2 action server, which is implemented by the nav2_planner module. The server address can be remapped using the `server_name` input port. | | ||
| | FollowPath | Action |Invokes the FollowPath ROS2 action server, which is implemented by the controller plugin modules loaded. The server address can be remapped using the `server_name` input port. | | ||
| | ComputePathToPose | Action | Invokes the ComputePathToPose ROS2 action server, which is implemented by the nav2_planner module. The server address can be remapped using the `server_name` input port. | | ||
| | UpdateGoalPose | Action |Overwrite goal pose by one received in a topic. | |
There was a problem hiding this comment.
Missing a space here between the pipe and Overwrite
| </Action> | ||
|
|
||
| <Action ID="UpdateGoalPose"> | ||
| <input_port name="goal">Destination to plan to</input_port> |
There was a problem hiding this comment.
| <input_port name="goal">Destination to plan to</input_port> | |
| <input_port name="goal">Dynamically updating destination to plan to</input_port> |
| add_library(nav2_compute_path_to_pose_action_bt_node SHARED plugins/action/compute_path_to_pose_action.cpp) | ||
| list(APPEND plugin_libs nav2_compute_path_to_pose_action_bt_node) | ||
|
|
||
| add_library(nav2_update_goal_pose_action_bt_node SHARED plugins/action/update_goal_pose_action.cpp) |
There was a problem hiding this comment.
Can we add the word "dynamically" to the naming here to make it clear its for dynamic goal updating in a single task
| { | ||
| BT::InputPort<nav_msgs::msg::Path>("path", "Path to follow"), | ||
| BT::InputPort<std::string>("controller_id", ""), | ||
| BT::InputPort<double>("distance_to_goal", "Distance to goal to stop translation"), |
There was a problem hiding this comment.
Shouldn't this distance to goal be computed by the dynamic new goal to follow (e.g. it is set at the distance away from the obstacle)
| @@ -0,0 +1,99 @@ | |||
| // Copyright (c) 2018 Intel Corporation | |||
There was a problem hiding this comment.
You should have your copyright here
| node_ = config().blackboard->get<rclcpp::Node::SharedPtr>("node"); | ||
|
|
||
| updated_goal_sub_ = node_->create_subscription<geometry_msgs::msg::PoseStamped>("goal_update", | ||
| 10, std::bind(&UpdateGoalPoseAction::updatedGoalCallback, this, std::placeholders::_1)); |
There was a problem hiding this comment.
I think you really want a queue depth of 1 so that you always get the newest one
| @@ -0,0 +1,17 @@ | |||
| <!-- | |||
| This Behavior Tree replans the global path periodically at 1 Hz. | |||
There was a problem hiding this comment.
You should update this description of the BT
| <RateController hz="1.0"> | ||
| <PipelineSequence name="GeneratePath"> | ||
| <UpdateGoalPose goal="{goal}"/> | ||
| <ComputePathToPose goal="{goal}" path="{path}" planner_id="GridBased"/> |
There was a problem hiding this comment.
Do you not also want a replanning rate in case your haven't gotten an updated dynamic goal pose recently?
| const geometry_msgs::msg::PoseStamped & pose_a, | ||
| const geometry_msgs::msg::PoseStamped & pose_b) | ||
| { | ||
| double x_diff = fabs(pose_a.pose.position.x - pose_b.pose.position.x); |
There was a problem hiding this comment.
You don't need the fabs since you're throwing them into hypot
There was a problem hiding this comment.
We also have a new utility in geometry_util in the nav2_util for this sort of thing, you should use it.
| return std::hypot(x_diff, y_diff); | ||
| } | ||
|
|
||
| geometry_msgs::msg::TwistStamped getTwistToPose( |
There was a problem hiding this comment.
All of these changes in the controller server - I'm not sure they belong here. Can you explain this? This all feels application specific and might need to be in a plugin. I'm not 100% sure what the goal of this is, if you have a path to follow towards something, why does the controller need any updates?
|
|
||
| progress_checker_->check(pose); | ||
|
|
||
| if (!keep_running) { |
There was a problem hiding this comment.
I'm not also sure about this keep running thing - if you've made it to N meters away from your goal, you would want it to stop. Once it starts moving again, then the controller can follow the new path to be N meters from that again.
There was a problem hiding this comment.
I think the robot should slow down as it approaches the target so that you can keep smooth motion, else I think it would be pretty jerky
|
@fmrico what's the story with this PR? |
|
Hi @SteveMacenski, I have been very busy this week preparing the ROSDevDay2020, but I want to retake this work next week. I put this PR in stand by while I finished #1780, to provide a complete demo. |
|
Look forward to your talk! |
|
Closed and continued in #1859 |
Signed-off-by: Francisco Martin Rico fmrico@gmail.com
Basic Info
This is a work in progress. I don't pretend to be accepted as is. I want only to discuss this approach.
The goal of this work is following a dynamic pose to a certain distance:
navigate_to_poseaction.One use case could be following a person to ~1 meter in a house. We want to use it in RoboCup@Home.
I don't want to implement this as a new plugin for controller or planner. This work is independent of the algorithms used to create the plan and following it. To implement it I have:
navigate_to_poseaction for the one received in thegoal_updatetopic.FollowPathfor indicating that never returns from the action, and the distance to the object. The other option was to create another action node in BT, action, action client, action server...This is the result (click for video):
I don't know if this is the right place to discuss this, but the complete real use case I want to address is:
The behavior trees used in the two steps in this application are (could be) different, but the BT to use is defined statically in the yaml param files. One option to solve this could be to select the BT to use in
NavigateToPoseaction. MaybeNavigateToPoseaction could also include some options decided from behaviors, instead to be fixed in params.Francisco