Advertisement
marcusvini178

nav2_params.yaml

May 23rd, 2023
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 15.21 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: 20.0 #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. # local_costmap:
  234. #   local_costmap:
  235. #     ros__parameters:
  236. #       update_frequency: 5.0
  237. #       publish_frequency: 2.0
  238. #       global_frame: odom
  239. #       robot_base_frame: base_link
  240. #       use_sim_time: False
  241. #       rolling_window: true
  242. #       width: 30
  243. #       height: 30
  244. #       resolution: 0.05
  245. #       footprint: "[ [-4.15, -1.3025], [4.15, -1.3025], [4.15, 1.3025], [-4.15, 1.3025] ]"
  246. #       #robot_radius: 5.0
  247. #       plugins: ["obstacle_layer", "inflation_layer"]
  248. #       inflation_layer:
  249. #         plugin: "nav2_costmap_2d::InflationLayer"
  250. #         cost_scaling_factor: 3.0
  251. #         inflation_radius: 0.55
  252. #       obstacle_layer:
  253. #         plugin: "nav2_costmap_2d::ObstacleLayer"
  254. #         enabled: True
  255. #         observation_sources: scan
  256. #         scan:
  257. #           topic: /scan
  258. #           max_obstacle_height: 2.0
  259. #           clearing: True
  260. #           marking: True
  261. #           data_type: "LaserScan"
  262. #       static_layer:
  263. #         map_subscribe_transient_local: True
  264. #       always_send_full_costmap: True
  265. #   local_costmap_client:
  266. #     ros__parameters:
  267. #       use_sim_time: False
  268. #   local_costmap_rclcpp_node:
  269. #     ros__parameters:
  270. #       use_sim_time: False
  271.  
  272.  
  273. global_costmap:
  274.   global_costmap:
  275.     ros__parameters:
  276.       update_frequency: 1.0
  277.       publish_frequency: 1.0
  278.       #width: 50
  279.       #height: 50
  280.       origin_x: -25.0
  281.       origin_y: -25.0
  282.       global_frame: map
  283.       robot_base_frame: base_link
  284.       use_sim_time: True
  285.       footprint: "[ [-4.15, -1.3025], [4.15, -1.3025], [4.15, 1.3025], [-4.15, 1.3025] ]"
  286.       #robot_radius: 4.5
  287.       resolution: 0.05
  288.       track_unknown_space: true
  289.       plugins: ["static_layer", "obstacle_layer", "inflation_layer"]
  290.       obstacle_layer:
  291.         plugin: "nav2_costmap_2d::ObstacleLayer"
  292.         enabled: True
  293.         observation_sources: scan
  294.         scan:
  295.           topic: /scan
  296.           max_obstacle_height: 5.0
  297.           clearing: True
  298.           marking: True
  299.           data_type: "LaserScan"
  300.           raytrace_max_range: 20.0
  301.           raytrace_min_range: 0.0
  302.           obstacle_max_range: 20.0
  303.           obstacle_min_range: 0.0
  304.       static_layer:
  305.         plugin: "nav2_costmap_2d::StaticLayer"
  306.         map_subscribe_transient_local: True
  307.       inflation_layer:
  308.         plugin: "nav2_costmap_2d::InflationLayer"
  309.         cost_scaling_factor: 3.0
  310.         inflation_radius: 0.55
  311.       always_send_full_costmap: True
  312.   global_costmap_client:
  313.     ros__parameters:
  314.       use_sim_time: True
  315.   global_costmap_rclcpp_node:
  316.     ros__parameters:
  317.       use_sim_time: True
  318.  
  319. map_server:
  320.   ros__parameters:
  321.     use_sim_time: True
  322.     yaml_filename: "fixed_map.yaml"
  323.  
  324. map_saver:
  325.   ros__parameters:
  326.     use_sim_time: True
  327.     save_map_timeout: 5.0
  328.     free_thresh_default: 0.25
  329.     occupied_thresh_default: 0.65
  330.     map_subscribe_transient_local: True
  331.  
  332. planner_server:
  333.   ros__parameters:
  334.     expected_planner_frequency: 20.0
  335.     use_sim_time: True
  336.     planner_plugins: ["GridBased"]
  337.  
  338.     GridBased:
  339.       plugin: "nav2_smac_planner/SmacPlannerHybrid"
  340.       downsample_costmap: false
  341.       downsampling_factor: 1
  342.       tolerance: 0.5 #0.25 # Adjust based on how much error you can tolerate in the planned path
  343.       allow_unknown: true
  344.       max_iterations: 1000000
  345.       max_on_approach_iterations: 1000
  346.       max_planning_time: 5.0  # If you find planning takes too long, you might want to lower this
  347.       motion_model_for_search: "DUBIN"
  348.       angle_quantization_bins: 72
  349.       analytic_expansion_ratio: 3.5
  350.       analytic_expansion_max_length: 3.0
  351.       minimum_turning_radius: 1.0 # Adjust based on your robot's actual turning radius
  352.       reverse_penalty: 2.0
  353.       change_penalty: 0.0
  354.       non_straight_penalty: 1.2
  355.       cost_penalty: 2.0
  356.       retrospective_penalty: 0.015
  357.       lookup_table_size: 20.0
  358.       cache_obstacle_heuristic: false
  359.       smooth_path: True # If your robot can handle sharp turns, you might not need path smoothing
  360.       costmap:
  361.         resolution: 0.5
  362.         width: 25 #150
  363.         height: 25 #150
  364.         footprint: "[ [-4.15, -1.3025], [4.15, -1.3025], [4.15, 1.3025], [-4.15, 1.3025] ]"
  365.  
  366.       smoother:
  367.         max_iterations: 1000
  368.         w_smooth: 0.5 # 0.3 # Adjust based on how much smoothing you want (higher value means more smoothing)
  369.         w_data: 0.5 #0.2 # Adjust based on how closely you want the smoothed path to adhere to the original path
  370.         tolerance: 1.0e-10
  371.         do_refinement: true
  372.         refinement_num: 2
  373.  
  374.  
  375. planner_server_rclcpp_node:
  376.   ros__parameters:
  377.     use_sim_time: True
  378.  
  379. recoveries_server:
  380.   ros__parameters:
  381.     costmap_topic: local_costmap/costmap_raw
  382.     footprint_topic: local_costmap/published_footprint
  383.     cycle_frequency: 5.0 #10.0 # If your robot can safely attempt recoveries less frequently, you can lower this
  384.     recovery_plugins: ["spin", "backup", "wait"]
  385.     spin:
  386.       plugin: "nav2_recoveries/Spin"
  387.     backup:
  388.       plugin: "nav2_recoveries/BackUp"
  389.     wait:
  390.       plugin: "nav2_recoveries/Wait"
  391.     global_frame: odom
  392.     robot_base_frame: base_link
  393.     transform_timeout: 0.1
  394.     use_sim_time: true
  395.     simulate_ahead_time: 2.0
  396.     max_rotational_vel: 1.0
  397.     min_rotational_vel: 0.4
  398.     rotational_acc_lim: 3.2
  399.  
  400. robot_state_publisher:
  401.   ros__parameters:
  402.     use_sim_time: True
  403.  
  404. waypoint_follower:
  405.   ros__parameters:
  406.     loop_rate: 20
  407.     stop_on_failure: false
  408.     waypoint_task_executor_plugin: "wait_at_waypoint"  
  409.     wait_at_waypoint:
  410.       plugin: "nav2_waypoint_follower::WaitAtWaypoint"
  411.       enabled: True
  412.       waypoint_pause_duration: 200
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement