Skip to content

[WIP] Following an object a certain distance#1748

Closed
fmrico wants to merge 1 commit intoros-navigation:masterfrom
fmrico:dynamic_goal_distance
Closed

[WIP] Following an object a certain distance#1748
fmrico wants to merge 1 commit intoros-navigation:masterfrom
fmrico:dynamic_goal_distance

Conversation

@fmrico
Copy link
Copy Markdown
Contributor

@fmrico fmrico commented May 17, 2020

Signed-off-by: Francisco Martin Rico fmrico@gmail.com

Basic Info

Info Please fill out this column
Ticket(s) this addresses #1660
Primary OS tested on Ubuntu
Robotic platform tested on gazebo simulation of Tally

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:

  • The goal pose can change during the execution of navigate_to_pose action.
  • The robot stops when the goal is nearer than a configured distance, and then it faces the goal.

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:

  • developed a new control node in nav2_behavior_tree that overwrites the goal received in the navigate_to_pose action for the one received in the goal_update topic.
  • added two input ports to FollowPath for 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...

BT_carrot

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:

  1. Make the robot navigate to the desired pose on the map.
  2. Once there, make the robot follow a person (the dynamic goal pose, provided from outside Nav2)

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 NavigateToPose action. Maybe NavigateToPose action could also include some options decided from behaviors, instead to be fixed in params.

Francisco

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. |
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing a space here between the pipe and Overwrite

</Action>

<Action ID="UpdateGoalPose">
<input_port name="goal">Destination to plan to</input_port>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
<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)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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"),
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

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.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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"/>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

Choose a reason for hiding this comment

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

You don't need the fabs since you're throwing them into hypot

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why is this here?

Copy link
Copy Markdown
Member

@SteveMacenski SteveMacenski May 18, 2020

Choose a reason for hiding this comment

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

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) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

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

@SteveMacenski
Copy link
Copy Markdown
Member

@fmrico what's the story with this PR?

@fmrico
Copy link
Copy Markdown
Contributor Author

fmrico commented Jun 26, 2020

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.

@SteveMacenski
Copy link
Copy Markdown
Member

Look forward to your talk!

@fmrico fmrico mentioned this pull request Jul 8, 2020
@fmrico
Copy link
Copy Markdown
Contributor Author

fmrico commented Jul 8, 2020

Closed and continued in #1859

@fmrico fmrico closed this Jul 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants