access to bt_navigator params

asked 2023-01-12 03:33:28 -0500

lfb gravatar image

updated 2023-01-12 17:02:34 -0500

Hi everyone, I'm trying to get the filepath from the behavior tree used by the bt_navigator node. I'm using the next code from my cpp node to achieve this purpose:

       auto node_bt_navigator = rclcpp::Node::make_shared("bt_navigator");
       std::string default_nav_to_pose_bt_xml;
       node_bt_navigator->get_parameter("default_nav_to_pose_bt_xml", default_nav_to_pose_bt_xml);

What am I missing?

The content of the yaml file used for bt_navigator is

bt_navigator:   ros__parameters:
    use_sim_time: True
    global_frame: map
    robot_base_frame: base_link
    odom_topic: /odom
    bt_loop_duration: 10
    default_server_timeout: 20
    default_nav_to_pose_bt_xml: "/home/user/ros2_ws/src/path_planner_server/config/behavior.xml"
    plugin_lib_names:
    - nav2_compute_path_to_pose_action_bt_node
    - nav2_compute_path_through_poses_action_bt_node
    - nav2_follow_path_action_bt_node
    - nav2_back_up_action_bt_node
    - nav2_spin_action_bt_node
    - nav2_wait_action_bt_node
    - nav2_clear_costmap_service_bt_node
    - nav2_is_stuck_condition_bt_node
    - nav2_goal_reached_condition_bt_node
    - nav2_goal_updated_condition_bt_node
    - nav2_initial_pose_received_condition_bt_node
    - nav2_reinitialize_global_localization_service_bt_node
    - nav2_rate_controller_bt_node
    - nav2_distance_controller_bt_node
    - nav2_speed_controller_bt_node
    - nav2_truncate_path_action_bt_node
    - nav2_goal_updater_node_bt_node
    - nav2_recovery_node_bt_node
    - nav2_pipeline_sequence_bt_node
    - nav2_round_robin_node_bt_node
    - nav2_transform_available_condition_bt_node
    - nav2_time_expired_condition_bt_node
    - nav2_distance_traveled_condition_bt_node
    - nav2_single_trigger_bt_node
    - nav2_is_battery_low_condition_bt_node
    - nav2_navigate_through_poses_action_bt_node
    - nav2_navigate_to_pose_action_bt_node
    - nav2_remove_passed_goals_action_bt_node
edit retag flag offensive close merge delete

Comments

This isn't really a question about Nav2 as much as it is about how to get parameters. Have you looked at parameter retrieval tutorials?

stevemacenski gravatar image stevemacenski  ( 2023-01-12 14:19:20 -0500 )edit

I did. I've updated tags also.

lfb gravatar image lfb  ( 2023-01-12 16:21:23 -0500 )edit