Advertisement
marcusvini178

nav2_params.yaml

May 18th, 2023
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 14.00 KB | Source Code | 0 0
  1. amcl:
  2.   ros__parameters:
  3.     use_sim_time: True
  4.  
  5.     kld_err: 0.05 # Increasing this value allows the number of particles to fluctuate more freely, based on the Kullback-Leibler Distance (KLD). Higher values may be helpful for a large and complex environment.
  6.     kld_z: 0.99 # This is the KLD update factor. It sets the speed at which AMCL updates the number of particles. A lower value means it updates more frequently. This might need to be lowered if your robot moves fast or if the environment changes often.
  7.     alpha1: 0.9 #0.2 # or a bit higher depending on your odometry's noise
  8.     alpha2: 0.9 #0.2
  9.     alpha3: 0.9 #0.2
  10.     alpha4: 0.9 #0.2
  11.     alpha5: 0.9 #0.2
  12.     base_frame_id: "base_footprint"
  13.     beam_skip_distance: 0.5
  14.     beam_skip_error_threshold: 0.9
  15.     beam_skip_threshold: 0.3
  16.     do_beamskip: false
  17.     global_frame_id: "map"
  18.     lambda_short: 0.1
  19.     laser_likelihood_max_dist: 2.0
  20.     laser_max_range: 100.0
  21.     laser_min_range: -1.0
  22.     laser_model_type: "likelihood_field"
  23.     max_beams: 60
  24.     max_particles: 10000 #5000 # more particles might result in more accurate localization but consume more computational resources
  25.     min_particles: 2000 #1000  # adjust based on your testing, might need to be raised if localization fails frequently
  26.     odom_frame_id: "odom"
  27.     pf_err: 0.2 #0.05  # increase the standard deviation for the error model
  28.     pf_z: 0.99 # leave this as is, it's the weight for the most recent update
  29.     recovery_alpha_fast: 0.001 #0.0 # This value determines how fast the slow recovery factor increases. If localization is lost often, you may need to increase this value to allow the filter to recover more quickly.
  30.     recovery_alpha_slow: 0.1 #0.0 # This value is the fast recovery factor. Increase this value if localization is often lost, to allow the filter to recover more quickly.
  31.     resample_interval: 1
  32.     robot_model_type: "omnidirectional" #"differential" #Need to customize later an Ackermman plugin for  this according to the documentation: https://navigation.ros.org/configuration/packages/configuring-amcl.html
  33.     save_pose_rate: 0.5
  34.     sigma_hit: 0.2
  35.     tf_broadcast: true
  36.     transform_tolerance: 1.0
  37.     update_min_a: 0.2
  38.     update_min_d: 0.25
  39.     z_hit: 0.75 #0.5 # increase this to make the filter trust the measurements more
  40.     z_max: 0.5 #0.05  # increase this to add more randomness to the filter
  41.     z_rand: 0.5
  42.     z_short: 0.05
  43.     scan_topic: scan
  44.  
  45. amcl_map_client:
  46.   ros__parameters:
  47.     use_sim_time: True
  48.  
  49. amcl_rclcpp_node:
  50.   ros__parameters:
  51.     use_sim_time: True
  52.  
  53. bt_navigator:
  54.   ros__parameters:
  55.     use_sim_time: True
  56.     global_frame: map
  57.     robot_base_frame: base_link
  58.     odom_topic: /odom
  59.     bt_loop_duration: 10
  60.     default_server_timeout: 20
  61.     enable_groot_monitoring: True
  62.     groot_zmq_publisher_port: 1666
  63.     groot_zmq_server_port: 1667
  64.     # 'default_nav_through_poses_bt_xml' and 'default_nav_to_pose_bt_xml' are use defaults:
  65.     # nav2_bt_navigator/navigate_to_pose_w_replanning_and_recovery.xml
  66.     # nav2_bt_navigator/navigate_through_poses_w_replanning_and_recovery.xml
  67.     # They can be set here or via a RewrittenYaml remap from a parent launch file to Nav2.
  68.     plugin_lib_names:
  69.     - nav2_compute_path_to_pose_action_bt_node
  70.     - nav2_compute_path_through_poses_action_bt_node
  71.     - nav2_follow_path_action_bt_node
  72.     - nav2_back_up_action_bt_node
  73.     - nav2_spin_action_bt_node
  74.     - nav2_wait_action_bt_node
  75.     - nav2_clear_costmap_service_bt_node
  76.     - nav2_is_stuck_condition_bt_node
  77.     - nav2_goal_reached_condition_bt_node
  78.     - nav2_goal_updated_condition_bt_node
  79.     - nav2_initial_pose_received_condition_bt_node
  80.     - nav2_reinitialize_global_localization_service_bt_node
  81.     - nav2_rate_controller_bt_node
  82.     - nav2_distance_controller_bt_node
  83.     - nav2_speed_controller_bt_node
  84.     - nav2_truncate_path_action_bt_node
  85.     - nav2_goal_updater_node_bt_node
  86.     - nav2_recovery_node_bt_node
  87.     - nav2_pipeline_sequence_bt_node
  88.     - nav2_round_robin_node_bt_node
  89.     - nav2_transform_available_condition_bt_node
  90.     - nav2_time_expired_condition_bt_node
  91.     - nav2_distance_traveled_condition_bt_node
  92.     - nav2_single_trigger_bt_node
  93.     - nav2_is_battery_low_condition_bt_node
  94.     - nav2_navigate_through_poses_action_bt_node
  95.     - nav2_navigate_to_pose_action_bt_node
  96.     - nav2_remove_passed_goals_action_bt_node
  97.     - nav2_planner_selector_bt_node
  98.     - nav2_controller_selector_bt_node
  99.     - nav2_goal_checker_selector_bt_node
  100.  
  101. bt_navigator_rclcpp_node:
  102.   ros__parameters:
  103.     use_sim_time: True
  104.  
  105. controller_server:
  106.   ros__parameters:
  107.     use_sim_time: True
  108.     controller_frequency: 5.0 #20.0 # Lowering frequency if you experience lag or latency issues
  109.     min_x_velocity_threshold: 0.001
  110.     min_y_velocity_threshold: 0.5
  111.     min_theta_velocity_threshold: 0.001
  112.     failure_tolerance: 0.3
  113.     progress_checker_plugin: "progress_checker"
  114.     goal_checker_plugins: ["general_goal_checker"] # "precise_goal_checker"
  115.     controller_plugins: ["FollowPath"]
  116.  
  117.     # Progress checker parameters
  118.     progress_checker:
  119.       plugin: "nav2_controller::SimpleProgressChecker"
  120.       required_movement_radius: 1.0 #0.5 # Adjust based on robot size and environment
  121.       movement_time_allowance: 15.0 #10.0 # Adjust based on average time robot needs to move
  122.     # Goal checker parameters
  123.     #precise_goal_checker:
  124.     #  plugin: "nav2_controller::SimpleGoalChecker"
  125.     #  xy_goal_tolerance: 0.25
  126.     #  yaw_goal_tolerance: 0.25
  127.     #  stateful: True
  128.     general_goal_checker:
  129.       stateful: True
  130.       plugin: "nav2_controller::SimpleGoalChecker"
  131.       xy_goal_tolerance: 0.9 #0.25 # This is the tolerance for reaching the goal, in meters. Increase this value if your robot is larger and needs a larger area to consider that it has reached its goal.
  132.       yaw_goal_tolerance: 0.75 #0.25  # This is the tolerance for the orientation at the goal, in radians. Increase this if your robot has a larger acceptable margin of error for its final orientation.
  133.     # DWB parameters
  134.     FollowPath:
  135.       plugin: "dwb_core::DWBLocalPlanner"
  136.       debug_trajectory_details: True
  137.       min_vel_x: 0.0 # This is the minimum translational velocity. Increase this if your robot has a higher minimum speed.
  138.       min_vel_y: 0.0 # This is the minimum rotational velocity. Increase this if your robot has a higher minimum rotational speed.
  139.       max_vel_x: 0.26
  140.       max_vel_y: 0.0
  141.       max_vel_theta: 1.0
  142.       min_speed_xy: 0.0
  143.       max_speed_xy: 0.26
  144.       min_speed_theta: 0.0
  145.       # Add high threshold velocity for turtlebot 3 issue.
  146.       # https://github.com/ROBOTIS-GIT/turtlebot3_simulations/issues/75
  147.       acc_lim_x: 2.5  # Adjust based on your robot's actual acceleration limit
  148.       acc_lim_y: 0.0
  149.       acc_lim_theta: 3.2 # Adjust based on your robot's actual angular acceleration limit
  150.       decel_lim_x: -2.5
  151.       decel_lim_y: 0.0
  152.       decel_lim_theta: -3.2
  153.       vx_samples: 20
  154.       vy_samples: 5
  155.       vtheta_samples: 20
  156.       sim_time: 1.7
  157.       linear_granularity: 0.05
  158.       angular_granularity: 0.025
  159.       transform_tolerance: 0.2
  160.       xy_goal_tolerance: 0.9 #0.25 #This is the tolerance for reaching the goal, in meters. Increase this value if your robot is larger and needs a larger area to consider that it has reached its goal.
  161.       trans_stopped_velocity: 0.25
  162.       short_circuit_trajectory_evaluation: True
  163.       stateful: True
  164.       critics: ["RotateToGoal", "Oscillation", "BaseObstacle", "GoalAlign", "PathAlign", "PathDist", "GoalDist"]
  165.       BaseObstacle.scale: 0.02
  166.       PathAlign.scale: 32.0
  167.       PathAlign.forward_point_distance: 0.1
  168.       GoalAlign.scale: 24.0
  169.       GoalAlign.forward_point_distance: 0.1
  170.       PathDist.scale: 32.0
  171.       GoalDist.scale: 24.0
  172.       RotateToGoal.scale: 32.0
  173.       RotateToGoal.slowing_factor: 5.0
  174.       RotateToGoal.lookahead_time: -1.0
  175.      
  176. controller_server_rclcpp_node:
  177.   ros__parameters:
  178.     use_sim_time: True
  179.  
  180. local_costmap:
  181.   local_costmap:
  182.     ros__parameters:
  183.       update_frequency: 5.0
  184.       publish_frequency: 2.0
  185.       global_frame: odom
  186.       robot_base_frame: base_link
  187.       static_map: false
  188.       use_sim_time: True
  189.       rolling_window: true
  190.       width: 30
  191.       height: 30
  192.       #origin_x: -5.0
  193.       #origin_y: -5.0
  194.       resolution: 0.05
  195.       footprint: "[ [-4.15, -1.3025], [4.15, -1.3025], [4.15, 1.3025], [-4.15, 1.3025] ]" # Put an offste of 0.1meters each side (corner points)
  196.       #of chassis: Length: 8.2m (total robot length) + 0.1m (margin offset) = 8.3m | Width: 2.505m (total robot width) + 0.1m (margin offset) = 2.605m
  197.       #robot_radius: 4.5 # 4.3411 real value but put a margin
  198.       plugins: ["voxel_layer", "inflation_layer"]
  199.       inflation_layer:
  200.         plugin: "nav2_costmap_2d::InflationLayer"
  201.         cost_scaling_factor: 3.0
  202.         inflation_radius: 0.55
  203.       voxel_layer:
  204.         plugin: "nav2_costmap_2d::VoxelLayer"
  205.         enabled: True
  206.         publish_voxel_map: True
  207.         origin_z: 0.0
  208.         z_resolution: 0.05
  209.         z_voxels: 16
  210.         max_obstacle_height: 5.0
  211.         mark_threshold: 0
  212.         observation_sources: scan
  213.         scan:
  214.           topic: /scan
  215.           max_obstacle_height: 5.0
  216.           clearing: True
  217.           marking: True
  218.           data_type: "LaserScan"
  219.           raytrace_max_range: 12.0
  220.           raytrace_min_range: 0.0
  221.           obstacle_max_range: 12.0
  222.           obstacle_min_range: 0.0
  223.       static_layer:
  224.         map_subscribe_transient_local: True
  225.       always_send_full_costmap: True
  226.   local_costmap_client:
  227.     ros__parameters:
  228.       use_sim_time: True
  229.   local_costmap_rclcpp_node:
  230.     ros__parameters:
  231.       use_sim_time: True
  232.  
  233. global_costmap:
  234.   global_costmap:
  235.     ros__parameters:
  236.       update_frequency: 1.0
  237.       publish_frequency: 1.0
  238.       width: 50
  239.       height: 50
  240.       origin_x: -25.0
  241.       origin_y: -25.0
  242.       global_frame: map
  243.       robot_base_frame: base_link
  244.       use_sim_time: True
  245.       footprint: "[ [-4.15, -1.3025], [4.15, -1.3025], [4.15, 1.3025], [-4.15, 1.3025] ]"
  246.       #robot_radius: 4.5
  247.       resolution: 0.05
  248.       track_unknown_space: true
  249.       plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
  250.       obstacle_layer:
  251.         plugin: "nav2_costmap_2d::ObstacleLayer"
  252.         enabled: True
  253.         observation_sources: scan
  254.         scan:
  255.           topic: /scan
  256.           max_obstacle_height: 5.0
  257.           clearing: True
  258.           marking: True
  259.           data_type: "LaserScan"
  260.           raytrace_max_range: 20.0
  261.           raytrace_min_range: 0.0
  262.           obstacle_max_range: 20.0
  263.           obstacle_min_range: 0.0
  264.       static_layer:
  265.         plugin: "nav2_costmap_2d::StaticLayer"
  266.         map_subscribe_transient_local: True
  267.       inflation_layer:
  268.         plugin: "nav2_costmap_2d::InflationLayer"
  269.         cost_scaling_factor: 3.0
  270.         inflation_radius: 0.55
  271.       always_send_full_costmap: True
  272.   global_costmap_client:
  273.     ros__parameters:
  274.       use_sim_time: True
  275.   global_costmap_rclcpp_node:
  276.     ros__parameters:
  277.       use_sim_time: True
  278.  
  279. map_server:
  280.   ros__parameters:
  281.     use_sim_time: True
  282.     yaml_filename: "fixed_map.yaml"
  283.  
  284. map_saver:
  285.   ros__parameters:
  286.     use_sim_time: True
  287.     save_map_timeout: 5.0
  288.     free_thresh_default: 0.25
  289.     occupied_thresh_default: 0.65
  290.     map_subscribe_transient_local: True
  291.  
  292. planner_server:
  293.   ros__parameters:
  294.     expected_planner_frequency: 20.0
  295.     use_sim_time: True
  296.     planner_plugins: ["GridBased"]
  297.  
  298.     GridBased:
  299.       plugin: "nav2_smac_planner/SmacPlannerHybrid"
  300.       downsample_costmap: false
  301.       downsampling_factor: 1
  302.       tolerance: 0.5 #0.25 # Adjust based on how much error you can tolerate in the planned path
  303.       allow_unknown: true
  304.       max_iterations: 1000000
  305.       max_on_approach_iterations: 1000
  306.       max_planning_time: 5.0  # If you find planning takes too long, you might want to lower this
  307.       motion_model_for_search: "DUBIN"
  308.       angle_quantization_bins: 72
  309.       analytic_expansion_ratio: 3.5
  310.       analytic_expansion_max_length: 3.0
  311.       minimum_turning_radius: 1.0 # Adjust based on your robot's actual turning radius
  312.       reverse_penalty: 2.0
  313.       change_penalty: 0.0
  314.       non_straight_penalty: 1.2
  315.       cost_penalty: 2.0
  316.       retrospective_penalty: 0.015
  317.       lookup_table_size: 20.0
  318.       cache_obstacle_heuristic: false
  319.       smooth_path: True # If your robot can handle sharp turns, you might not need path smoothing
  320.       costmap:
  321.         resolution: 0.5
  322.         width: 25 #150
  323.         height: 25 #150
  324.         footprint: "[ [-4.15, -1.3025], [4.15, -1.3025], [4.15, 1.3025], [-4.15, 1.3025] ]"
  325.  
  326.       smoother:
  327.         max_iterations: 1000
  328.         w_smooth: 0.5 # 0.3 # Adjust based on how much smoothing you want (higher value means more smoothing)
  329.         w_data: 0.5 #0.2 # Adjust based on how closely you want the smoothed path to adhere to the original path
  330.         tolerance: 1.0e-10
  331.         do_refinement: true
  332.         refinement_num: 2
  333.  
  334.  
  335. planner_server_rclcpp_node:
  336.   ros__parameters:
  337.     use_sim_time: True
  338.  
  339. recoveries_server:
  340.   ros__parameters:
  341.     costmap_topic: local_costmap/costmap_raw
  342.     footprint_topic: local_costmap/published_footprint
  343.     cycle_frequency: 5.0 #10.0 # If your robot can safely attempt recoveries less frequently, you can lower this
  344.     recovery_plugins: ["spin", "backup", "wait"]
  345.     spin:
  346.       plugin: "nav2_recoveries/Spin"
  347.     backup:
  348.       plugin: "nav2_recoveries/BackUp"
  349.     wait:
  350.       plugin: "nav2_recoveries/Wait"
  351.     global_frame: odom
  352.     robot_base_frame: base_link
  353.     transform_timeout: 0.1
  354.     use_sim_time: true
  355.     simulate_ahead_time: 2.0
  356.     max_rotational_vel: 1.0
  357.     min_rotational_vel: 0.4
  358.     rotational_acc_lim: 3.2
  359.  
  360. robot_state_publisher:
  361.   ros__parameters:
  362.     use_sim_time: True
  363.  
  364. waypoint_follower:
  365.   ros__parameters:
  366.     loop_rate: 20
  367.     stop_on_failure: false
  368.     waypoint_task_executor_plugin: "wait_at_waypoint"  
  369.     wait_at_waypoint:
  370.       plugin: "nav2_waypoint_follower::WaitAtWaypoint"
  371.       enabled: True
  372.       waypoint_pause_duration: 200
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement