Skip to content

Multiple controller plugins in server for contextual control - #1292

Merged
SteveMacenski merged 16 commits into
ros-navigation:masterfrom
SteveMacenski:mult_control
Nov 15, 2019
Merged

SteveMacenski merged 16 commits into
ros-navigation:masterfrom
SteveMacenski:mult_control

Conversation

@SteveMacenski

@SteveMacenski SteveMacenski commented Oct 24, 2019 •

Copy link
Copy Markdown
Member

See #1269 for planner eq.

I'd highlight that I add a name field to the controller interface. This is necessary in case we now load multiple of the same type of plugin. DWB will ignore it because it doesn't have alot of output logs anyhow, but others may require it. Should go in before Eloquent release 1

Comment thread nav2_msgs/action/ComputeControl.action Resolved
Comment thread nav2_msgs/action/ComputeControl.action Outdated
@@ -1,5 +1,6 @@
#goal definition
nav_msgs/Path path
string controller_name

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

string motion_type?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This is the string in the map of controller plugins to use. If we call the key the controller name and the value is the controller, ei FollowPath: DWBLocalPlanner::RegisteredPluginType then the field in the action message should also be the name.

Motion type doesn't make clear to me this is the same name as the map in the controller server. The eq. message in the planner uses planner_name so there's some automatic parallels someone can draw if you know one, you know both. I'd be open to other names but I'd like them to be consistent between the 2 servers in style

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

My comment was directed towards the fact that we were opening this message to mean any type of control/actuation, but if this is FollowPath.action, then yes, motion_type is not needed.

However, I actually liked naming this action to mean moving the robot's base. This would then allow to specify the type of motion as FollowPath, SuperSafeButSlowFollowPath, RoughlyFollowPath, etc. We don't know/care at this level about the types of controllers (e.g. DWB, MPC, PID), only about the high-level intention. The matching of the motion type string to the plugin name would be done down on the ControllerServer and not hardcoded but on the params file.

I don't see how exposing the names of the controllers at this level provides more contextual control. I could argue that my proposal provides actually more.

@SteveMacenski SteveMacenski Oct 25, 2019 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Controller name is FollowPath, SuperSafeButSlowFollowPath, ... its the name of the controller stored in the controllers_ map and the parameter in the configuration file of controller_names.

Again, that's what's happening here as we've discussed. You are defining a map of plugins not a vector. If you make the name of your controller FollowPath and map to MPC and FollowPathSlowButSafe with a carrot follower, then the BT designer doesn't care about the algorithm, they have their abstractions. Now its only the algorithm designer that knows what's under the hood.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

OK, I find it confusing assigning FollowPath to a controller_name. I think it would help if the field was named following_type, or something like that.

@SteveMacenski SteveMacenski Oct 25, 2019 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I disagree with the word type, in pluginlib type means something

<library path="nav2_navfn_planner">
	<class name="nav2_navfn_planner/NavfnPlanner" type="nav2_navfn_planner::NavfnPlanner" base_class_type="nav2_core::GlobalPlanner">
	  <description></description>
	</class>
</library>

The name is the actual name to load, and is map-able. the type is the actual registered plugin class. Using type here would mix definitions. Therefore the parameters in the config file should use type/name accordingly. If we changed the action file to swap them that'd be pretty confusing

Comment thread nav2_controller/src/nav2_controller.cpp Resolved
declare_parameter("controller_frequency", 20.0);
declare_parameter("local_controller_plugin", "dwb_core::DWBLocalPlanner");
std::vector<std::string> default_name, default_type;
default_type.push_back("dwb_core::DWBLocalPlanner");

@orduno orduno Oct 25, 2019 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I got a bit confused by the names used here, why not instead match a default_motion_type (e.g. FollowPath) to a default_controller_type (e.g. DWBLocalPlanner)?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

I think you read this the opposite way I do. When I use type I'm referring to the type of plugin and the name is the name of the plugin.

With that said, I'm open to naming changes for both of these but if there's confusion, I dont think 'typeorname` should appear at all so there isn't that opportunity.

Maybe default_plugin_name and default_plugin_type to be clear its plugin-centric? Open for thoughts

Comment thread nav2_controller/src/nav2_controller.cpp Resolved
Comment thread nav2_controller/src/nav2_controller.cpp Resolved
Comment thread nav2_controller/src/nav2_controller.cpp Resolved
void DWBLocalPlanner::configure(
const rclcpp_lifecycle::LifecycleNode::SharedPtr & node,
const std::shared_ptr<tf2_ros::Buffer> & tf,
std::string /*name*/, const std::shared_ptr<tf2_ros::Buffer> & tf,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What use do you see for the name?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Multiple instances in the server so you can tell the difference between them

Comment thread nav2_controller/src/nav2_controller.cpp Outdated
controller_names_[i].c_str(), controller_types_[i].c_str());
controller->configure(node, controller_names_[i],
costmap_ros_->getTfBuffer(), costmap_ros_);
controllers_.insert({controller_names_[i], controller});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I find it more clear if this was controllers_.insert({motion_type[i], controller});

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The phrase motion_type I think is ambiguous and isn't immediately clear to me what that is. I can see that this has caused you some confusion, would adding plugin to these variable names help? controller_plugin_name controller_plugin_type.

@codecov

codecov Bot commented Oct 25, 2019 •

Copy link
Copy Markdown

Codecov Report

Merging #1292 into master will decrease coverage by 0.22%.
The diff coverage is 15.38%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1292      +/-   ##
==========================================
- Coverage   38.75%   38.52%   -0.23%     
==========================================
  Files         244      244              
  Lines       11040    11072      +32     
  Branches     4570     4606      +36     
==========================================
- Hits         4278     4265      -13     
- Misses       3884     3907      +23     
- Partials     2878     2900      +22
Flag Coverage Δ
#project 38.52% <15.38%> (-0.23%) ⬇️
Impacted Files Coverage Δ
..._dwb_controller/dwb_core/src/dwb_local_planner.cpp 28.92% <ø> (ø) ⬆️
nav2_core/include/nav2_core/local_planner.hpp 50% <ø> (ø) ⬆️
...er/dwb_core/include/dwb_core/dwb_local_planner.hpp 0% <ø> (ø) ⬆️
.../include/nav2_behavior_tree/follow_path_action.hpp 37.5% <0%> (-5.36%) ⬇️
nav2_controller/src/nav2_controller.cpp 18.9% <16%> (-3.16%) ⬇️
..._dwb_controller/dwb_critics/src/rotate_to_goal.cpp 59.09% <0%> (-18.19%) ⬇️
nav2_map_server/src/main.cpp 36.36% <0%> (-18.19%) ⬇️
...av2_dwb_controller/dwb_critics/src/oscillation.cpp 41.55% <0%> (-6.5%) ⬇️
...rator_cpp/nav2_msgs/action/follow_path__struct.hpp 64% <0%> (-5.57%) ⬇️
nav2_map_server/src/map_server.cpp 20.93% <0%> (-2.33%) ⬇️
... and 4 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 49f0a12...9cd972b. Read the comment docs.

@SteveMacenski

SteveMacenski commented Oct 26, 2019 •

Copy link
Copy Markdown
Member Author

@orduno beyond our name vs type conversation, I think I resolved you other issues. Please look over again when you have a few minutes. Maybe lets sync up over Riot chat on the variable naming so we can get through it with less delay

@SteveMacenski

SteveMacenski commented Oct 26, 2019 •

Copy link
Copy Markdown
Member Author

@orduno @mkhansen-intel @crdelsey take a look things have been renamed.

Only place that the word computeControl appears in is the nav2_controller_server callback method: computeControl() since the controller_server computing a control seems like a reasonable renaming

@SteveMacenski SteveMacenski changed the title Multiple controller plugins in server for contextual control Multiple controller plugins in server for contectual control Oct 26, 2019
@SteveMacenski SteveMacenski changed the title Multiple controller plugins in server for contectual control Multiple controller plugins in server for contextual control Oct 26, 2019
@SteveMacenski
SteveMacenski force-pushed the mult_control branch 2 times, most recently from 86a2031 to 7e10a78 Compare October 28, 2019 00:34
@SteveMacenski

Copy link
Copy Markdown
Member Author

@orduno can you review again?

</RateController>
<RecoveryNode number_of_retries="1" name="FollowPath">
<FollowPath path="{path}"/>
<FollowPath path="{path}" controller_name="FollowPath"/>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we extrapolate here what's decided for the planner?

We'd need to replace controller_name to something else. One option is control_property if we're thinking the input describes some quality about how the path should be followed.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yes, of course. I’ll reflect whatever we decide there, here as well

@SteveMacenski SteveMacenski Nov 6, 2019 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

One consequence of this I really dont like is that now a line reads: controller_properties[action->controller_property]->doThing(). Its very unclear that controller_properties_ means a vector of properties and not a set of properties about 1 planner.

Lets merge this now but we need to discuss this. I'd like to change the variable name back to planner_names_ inside the server so that this is abundantly clear, but still keep property everywhere else.

Is that something you'd agree to?

Also see below, I changed everything. Still need the second review on this one to merge. I left the controller property to FollowPath because its not clear to me how I can clearly tell this as DWB. The more I have to think about how to name NavFn or DWB by "property" the more I think name was the better idea. GridBased or CircleSampling (?) both really make things way way more confusing for a typical user than it needs to be.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

#1330

Ticket to continue dialog

@SteveMacenski

Copy link
Copy Markdown
Member Author

I think* this is done (with exception of a name for the property).

Also then deciding if property is the right name altogether, but #1330 covers that if we want to move the discussion. The goal here is to be really approachable and easy to think about. I think this naming has become difficult, but if that's just me, then we can keep it. I wrote it, I know what it does, but if that's clear to everyone else the intent, then I don't have a problem.

@SteveMacenski

Copy link
Copy Markdown
Member Author

@orduno pinging for another review / discussion

@orduno

orduno commented Nov 15, 2019

Copy link
Copy Markdown
Contributor

I'm ok with merging and continuing any naming discussions in #1330.

@SteveMacenski
SteveMacenski merged commit 8c1a8e6 into ros-navigation:master Nov 15, 2019
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