Skip to content

Use parameterized frames#1729

Closed
ymd-stella wants to merge 1 commit intoros-navigation:masterfrom
ymd-stella:feat/use-parameterized-frame
Closed

Use parameterized frames#1729
ymd-stella wants to merge 1 commit intoros-navigation:masterfrom
ymd-stella:feat/use-parameterized-frame

Conversation

@ymd-stella
Copy link
Contributor

Signed-off-by: ymd-stella world.applepie@gmail.com


Basic Info

Info Please fill out this column
Ticket(s) this addresses (add tickets here #1726)
Primary OS tested on (Ubuntu 18.04)
Robotic platform tested on Stage and stage_ros2

Description of contribution in a few bullet points

  • Added new parameters (global_frame, odom_frame, robot_base_frame)
  • The default values does not change the behavior.

Description of documentation updates required from your changes

  • Added new parameters, so need to add that to default configs and documentation page

Signed-off-by: ymd-stella <world.applepie@gmail.com>
@codecov
Copy link

codecov bot commented May 14, 2020

Codecov Report

Merging #1729 into master will increase coverage by 0.69%.
The diff coverage is 70.58%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1729      +/-   ##
==========================================
+ Coverage   63.41%   64.11%   +0.69%     
==========================================
  Files         192      192              
  Lines       10321    10330       +9     
==========================================
+ Hits         6545     6623      +78     
+ Misses       3776     3707      -69     
Flag Coverage Δ
#project 64.11% <70.58%> (+0.69%) ⬆️
Impacted Files Coverage Δ
..._tree/plugins/condition/goal_reached_condition.cpp 14.28% <0.00%> (-0.87%) ⬇️
nav2_recoveries/plugins/back_up.cpp 16.07% <0.00%> (ø)
nav2_costmap_2d/src/collision_checker.cpp 85.13% <100.00%> (ø)
...v2_recoveries/include/nav2_recoveries/recovery.hpp 87.14% <100.00%> (+9.20%) ⬆️
nav2_recoveries/plugins/spin.cpp 89.04% <100.00%> (+89.04%) ⬆️
nav2_recoveries/src/recovery_server.cpp 91.89% <100.00%> (+0.58%) ⬆️
nav2_amcl/src/amcl_node.cpp 83.23% <0.00%> (-0.77%) ⬇️
nav2_controller/src/nav2_controller.cpp 78.64% <0.00%> (+0.52%) ⬆️
nav2_map_server/src/map_server/main.cpp 100.00% <0.00%> (+36.36%) ⬆️
... and 1 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 13633cd...71f9a62. Read the comment docs.

@shivaang12
Copy link
Collaborator

Hi @ymd-stella, thank you for submitting the PR.

LGTM

@SteveMacenski ?

{
node_ = config().blackboard->get<rclcpp::Node::SharedPtr>("node");
node_->get_parameter_or<double>("goal_reached_tol", goal_reached_tol_, 0.25);
node_->get_parameter_or<std::string>("global_frame", global_frame_, "map");
Copy link
Member

Choose a reason for hiding this comment

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

How are you planning on getting these parameters?

It seems like these would better be input ports for the BT node (see this for example https://github.com/ros-planning/navigation2/blob/71f9a62d0f8dcb0267935d6c6068138b5afad3d5/nav2_behavior_tree/plugins/action/spin_action.cpp#L49) with a default value to map and base_link. Then if you wanted to change, you change the frames in the BT XML file.

I think this could work as well, but you'd need to figure out what namespace this parameter appears in to add to your config file, which actually sounds like the best situation. Figure out where this parameterization is going to be and then add it to our nav2_params.yaml file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not familiar with nav2_behavior_tree so it's going to take a bit of time.

Copy link
Member

Choose a reason for hiding this comment

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

So I'd recommend just looking at this spin_dist as a literal example. All you need to do is add a string templated BT::InputPort to the provide input ports function. The order of args is variable name, default value, description string. Then in the constructor of the node use getInput to get the input of the 2 variables to store. Then you're done!

Copy link
Member

Choose a reason for hiding this comment

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

@ymd-stella you can also use this as a direct guide: #1741 as @naiveHobo did this for the other controller based on your request.

"plugin_types",
rclcpp::ParameterValue(plugin_types));

declare_parameter(
Copy link
Member

Choose a reason for hiding this comment

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

Please add these to our nav2_params.yaml file (and the 2 multi-robot param example files) and verify changing them works properly.

@SteveMacenski
Copy link
Member

Looks good, just need to make sure we expose these params in the default configs

@SteveMacenski
Copy link
Member

@naiveHobo do you mind making these updates here too to speed this along? It block #1735 which I'd like @Marwan99 to get in today. @ymd-stella had a really good start but now there's merge conflicts to resolve and I recall them mentioning they weren't very confident in their C++/navigation.

@SteveMacenski
Copy link
Member

#1742 extends and resolves issues

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.

3 participants