Advertisement
Guest User

truck_nav2_params.yaml

a guest
Jul 30th, 2024
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 37.30 KB | None | 0 0
  1. # GPS WPF CHANGES:
  2. # - amcl params where removed. They are not needed because global localization is provided
  3. # by an ekf node on robot_localization fusing gps data with local odometry sources
  4. # - static layer is removed from both costmaps, in this tutorial we assume there is no map
  5. # of the environment
  6. # - global costmap is set to be rolling to allow the robot to traverse big environment by
  7. # following successive relatively close waypoints that fit in a smaller rolling costmap
  8.  
  9. bt_navigator:
  10. ros__parameters:
  11. global_frame: map
  12. robot_base_frame: base_link
  13. odom_topic: /odom
  14. bt_loop_duration: 10
  15. default_server_timeout: 20
  16. navigators: ["navigate_to_pose", "navigate_through_poses"] #["navigate_through_poses"]
  17. navigate_to_pose:
  18. plugin: "nav2_bt_navigator/NavigateToPoseNavigator"
  19. navigate_through_poses:
  20. plugin: "nav2_bt_navigator/NavigateThroughPosesNavigator"
  21. # 'default_nav_through_poses_bt_xml' and 'default_nav_to_pose_bt_xml' are use defaults:
  22. # nav2_bt_navigator/navigate_to_pose_w_replanning_and_recovery.xml
  23. # nav2_bt_navigator/navigate_through_poses_w_replanning_and_recovery.xml
  24. # They can be set here or via a RewrittenYaml remap from a parent launch file to Nav2.
  25. plugin_lib_names:
  26. - nav2_compute_path_to_pose_action_bt_node
  27. - nav2_compute_path_through_poses_action_bt_node
  28. - nav2_smooth_path_action_bt_node
  29. - nav2_follow_path_action_bt_node
  30. # - nav2_spin_action_bt_node
  31. - nav2_wait_action_bt_node
  32. - nav2_assisted_teleop_action_bt_node
  33. - nav2_back_up_action_bt_node
  34. - nav2_drive_on_heading_bt_node
  35. - nav2_clear_costmap_service_bt_node
  36. - nav2_is_stuck_condition_bt_node
  37. - nav2_goal_reached_condition_bt_node
  38. - nav2_goal_updated_condition_bt_node
  39. - nav2_globally_updated_goal_condition_bt_node
  40. - nav2_is_path_valid_condition_bt_node
  41. - nav2_are_error_codes_active_condition_bt_node
  42. - nav2_would_a_controller_recovery_help_condition_bt_node
  43. - nav2_would_a_planner_recovery_help_condition_bt_node
  44. - nav2_would_a_smoother_recovery_help_condition_bt_node
  45. - nav2_initial_pose_received_condition_bt_node
  46. - nav2_reinitialize_global_localization_service_bt_node
  47. - nav2_rate_controller_bt_node
  48. - nav2_distance_controller_bt_node
  49. - nav2_speed_controller_bt_node
  50. - nav2_truncate_path_action_bt_node
  51. - nav2_truncate_path_local_action_bt_node
  52. - nav2_goal_updater_node_bt_node
  53. - nav2_recovery_node_bt_node
  54. - nav2_pipeline_sequence_bt_node
  55. - nav2_round_robin_node_bt_node
  56. - nav2_transform_available_condition_bt_node
  57. - nav2_time_expired_condition_bt_node
  58. - nav2_path_expiring_timer_condition
  59. - nav2_distance_traveled_condition_bt_node
  60. - nav2_single_trigger_bt_node
  61. - nav2_goal_updated_controller_bt_node
  62. - nav2_is_battery_low_condition_bt_node
  63. - nav2_navigate_through_poses_action_bt_node
  64. - nav2_navigate_to_pose_action_bt_node
  65. - nav2_remove_passed_goals_action_bt_node
  66. - nav2_planner_selector_bt_node
  67. - nav2_controller_selector_bt_node
  68. - nav2_goal_checker_selector_bt_node
  69. - nav2_controller_cancel_bt_node
  70. - nav2_path_longer_on_approach_bt_node
  71. - nav2_wait_cancel_bt_node
  72. # - nav2_spin_cancel_bt_node
  73. - nav2_back_up_cancel_bt_node
  74. - nav2_assisted_teleop_cancel_bt_node
  75. - nav2_drive_on_heading_cancel_bt_node
  76. - nav2_is_battery_charging_condition_bt_node
  77. error_code_names:
  78. - compute_path_error_code
  79. - follow_path_error_code
  80.  
  81. # GPS WPF CHANGE: Remove static layer
  82. local_costmap:
  83. local_costmap:
  84. ros__parameters:
  85. lethal_cost_threshold: 100
  86. update_frequency: 5.0 #20.0 #5.0
  87. transform_tolerance: 0.5
  88. publish_frequency: 2.0
  89. global_frame: odom
  90. robot_base_frame: base_footprint
  91. rolling_window: true
  92. width: 100
  93. height: 50
  94. origin_x: 50.0 # Shifts the costmap back by 75 meters
  95. origin_y: 0.0 # No lateral shift
  96. track_unknown_space: true
  97. resolution: 1.0 #1.0 #0.05 Increased tge resoluiton to 1 meter for 1 grid, since the truck is much bigger than turtlebot size, and 0.1 was default for turtlebot.
  98. #robot_radius: 5.0 #0.22
  99. footprint: "[[-4.8025, -1.739], [4.8025, -1.739], [4.8025, 1.739], [-4.8025, 1.739]]"
  100. plugins: ["voxel_layer", "inflation_layer"] # "range_sensor_layer"]
  101. inflation_layer:
  102. plugin: "nav2_costmap_2d::InflationLayer"
  103. cost_scaling_factor: 1.0 #3.0 #Cost scale number 1 does not push robot against obstacle. Value of 2 create more stronger potential field for the planner deviate with higher offset...
  104. inflation_radius: 0.01 #10.0 # The inflation radius must be higher than robot's radius to create potential regions #0.5 #0.55 #the blue region is max with number 1 assigned, then with number 2 assigned starts red regions, and later other dark blue about number 5 assigned.
  105. # obstacle_layer:
  106. # plugin: "nav2_costmap_2d::ObstacleLayer"
  107. # enabled: True
  108. # observation_sources: sick_scan_2D right_scan fused_scan #left_scan
  109. # sick_scan_2D:
  110. # topic: /sick_scan_2d
  111. # max_obstacle_height: 3.0
  112. # clearing: True
  113. # marking: True
  114. # data_type: "LaserScan"
  115. # raytrace_max_range: 50.0
  116. # raytrace_min_range: 0.0
  117. # obstacle_max_range: 25.0
  118. # obstacle_min_range: 0.0
  119. # # outdoors there will probably be more inf points
  120. # inf_is_valid: true
  121. # #OTHER SCAN SOURCE
  122. voxel_layer:
  123. plugin: "nav2_costmap_2d::VoxelLayer"
  124. enabled: True
  125. publish_voxel_map: True
  126. origin_z: 0.0 #2.0 #0.0
  127. z_resolution: 1.0 # 1.0 #0.05
  128. z_voxels: 16 #Only works with 16 not 32
  129. max_obstacle_height: 2.0
  130. mark_threshold: 0
  131. observation_sources: sick_scan_2D #fused_scan left_scan right_scan #fused_scan
  132. sick_scan_2D:
  133. topic: /sick_scan_2D
  134. max_obstacle_height: 2.0
  135. clearing: True
  136. marking: True
  137. data_type: "LaserScan"
  138. raytrace_max_range: 50.0
  139. raytrace_min_range: 0.0
  140. obstacle_max_range: 50.0
  141. obstacle_min_range: 1.0
  142. marking_threshold: 100 # THIS SET ZONES AS LETHAL OBSTACLES
  143.  
  144. # left_scan:
  145. # topic: /left_scan
  146. # max_obstacle_height: 2.0
  147. # clearing: True
  148. # marking: True
  149. # data_type: "LaserScan"
  150. # raytrace_max_range: 50.0
  151. # raytrace_min_range: 0.0
  152. # obstacle_max_range: 50.0
  153. # obstacle_min_range: 1.0
  154. # right_scan:
  155. # topic: /right_scan
  156. # max_obstacle_height: 2.0
  157. # clearing: True
  158. # marking: True
  159. # data_type: "LaserScan"
  160. # raytrace_max_range: 50.0
  161. # raytrace_min_range: 0.0
  162. # obstacle_max_range: 50.0
  163. # obstacle_min_range: 1.0
  164. fused_scan:
  165. topic: /fused_scan
  166. max_obstacle_height: 2.0
  167. clearing: True
  168. marking: True
  169. data_type: "LaserScan"
  170. raytrace_max_range: 25.0
  171. raytrace_min_range: 0.0
  172. obstacle_max_range: 25.0
  173. obstacle_min_range: 1.0
  174. # range_sensor_layer: #IT delays too much to send data, issues with planner and control when integrated
  175. # plugin: "nav2_costmap_2d::RangeSensorLayer"
  176. # enabled: True
  177. # transform_tolerance: 0.3
  178. # clear_on_max_reading: true
  179. # topics: ["/ultrassonic/front_left"]
  180. # clear_threshold: 0.2
  181. # mark_threshold: 0.8
  182. # no_readings_timeout: 5.0
  183. # clear_after_reading: true
  184. # max_distance: 5.0
  185. # min_distance: 0.2
  186. # clear_on_max_reading: true
  187. # buffer_size: 10
  188. # observation_persistence: 2.0
  189. # inf_is_valid: false
  190. always_send_full_costmap: True
  191.  
  192.  
  193.  
  194. # GPS WPF CHANGE: Remove static layer
  195. # GPS WPF CHANGE: Set rolling global costmap with 50x50 size. See note below
  196. global_costmap:
  197. global_costmap:
  198. ros__parameters:
  199. #unknown_cost_value: 120 #255 #0# slightly less than 255 to be more explorative
  200. lethal_cost_threshold: 100
  201. update_frequency: 1.0
  202. publish_frequency: 1.0
  203. transform_tolerance: 0.5
  204. global_frame: map
  205. robot_base_frame: base_footprint
  206. use_sim_time: True
  207. #robot_radius: 5.0 #0.22
  208. footprint: "[[-4.8025, -1.739], [4.8025, -1.739], [4.8025, 1.739], [-4.8025, 1.739]]"
  209. resolution: 1.0 #0.05 # 1.0 #0.05 # Increased tge resoluiton to 1 meter for 1 grid, since the truck is much bigger than turtlebot size, and 0.1 was default for turtlebot.
  210. # When using GPS navigation you will potentially traverse huge environments which are not practical to
  211. # fit on a big static costmap. Thus it is recommended to use a rolling global costmap large enough to
  212. # contain each pair of successive waypoints. See: https://github.com/ros-planning/navigation2/issues/2174
  213. rolling_window: True
  214. width: 1000
  215. height: 100
  216. origin_x: 100.0 # Shifts the costmap back by 75 meters
  217. origin_y: 0.0 # No lateral shift
  218. track_unknown_space: true
  219. # no static map
  220. plugins: ["obstacle_layer", "inflation_layer"]
  221. #plugins: ["static_layer", "inflation_layer", "obstacle_layer"] # We won't use static map
  222. obstacle_layer:
  223. plugin: "nav2_costmap_2d::ObstacleLayer"
  224. enabled: True
  225. observation_sources: sick_scan_2D #right_scan #fused_scan left_scan right_scan sick_scan_2D
  226. # left_scan:
  227. # topic: /left_scan
  228. # max_obstacle_height: 2.0
  229. # clearing: True
  230. # marking: True
  231. # data_type: "LaserScan"
  232. # raytrace_max_range: 50.0
  233. # raytrace_min_range: 0.0
  234. # obstacle_max_range: 25.0
  235. # obstacle_min_range: 0.0
  236. # # outdoors there will probably be more inf points
  237. # inf_is_valid: true
  238. # #OTHER SCAN SOURCE
  239. # right_scan:
  240. # topic: /right_scan
  241. # max_obstacle_height: 2.0
  242. # clearing: True
  243. # marking: True
  244. # data_type: "LaserScan"
  245. # raytrace_max_range: 50.0
  246. # raytrace_min_range: 0.0
  247. # obstacle_max_range: 25.0
  248. # obstacle_min_range: 1.0
  249. # # outdoors there will probably be more inf points
  250. # inf_is_valid: true
  251. fused_scan:
  252. topic: /fused_scan
  253. max_obstacle_height: 2.0
  254. clearing: True
  255. marking: True
  256. data_type: "LaserScan"
  257. raytrace_max_range: 90.0
  258. raytrace_min_range: 0.0
  259. obstacle_max_range: 90.0
  260. obstacle_min_range: 1.0
  261. sick_scan_2D:
  262. topic: /sick_scan_2D
  263. max_obstacle_height: 2.0
  264. clearing: True
  265. marking: True
  266. data_type: "LaserScan"
  267. raytrace_max_range: 50.0
  268. raytrace_min_range: 0.0
  269. obstacle_max_range: 50.0
  270. obstacle_min_range: 1.0
  271. marking_threshold: 100 # THIS SET ZONES AS LETHAL OBSTACLES
  272. inflation_layer:
  273. plugin: "nav2_costmap_2d::InflationLayer"
  274. cost_scaling_factor: 1.0 #3.0
  275. inflation_radius: 0.01 #10.0 # # The inflation radius must be higher than robot's radius to create potential regions#0.5 #0.55
  276. always_send_full_costmap: True
  277.  
  278.  
  279.  
  280.  
  281.  
  282. # The yaml_filename does not need to be specified since it going to be set by defaults in launch.
  283. # If you'd rather set it in the yaml, remove the default "map" value in the tb3_simulation_launch.py
  284. # file & provide full path to map below. If CLI map configuration or launch default is provided, that will be used.
  285.  
  286. map_saver:
  287. ros__parameters:
  288. save_map_timeout: 5.0
  289. free_thresh_default: 0.25
  290. occupied_thresh_default: 0.65
  291. map_subscribe_transient_local: True
  292.  
  293. # map_server:
  294. # ros__parameters:
  295. # use_sim_time: True
  296. # yaml_filename: "turtlebot3.yaml"
  297.  
  298. # map_saver:
  299. # ros__parameters:
  300. # #use_sim_time: True
  301. # save_map_timeout: 5.0
  302. # free_thresh_default: 0.25
  303. # occupied_thresh_default: 0.65
  304. # map_subscribe_transient_local: True
  305.  
  306. #GLOBAL PLANNER
  307. planner_server:
  308. ros__parameters:
  309. expected_planner_frequency: 5.0 # Expected frequency for the planner to run in Hz.
  310. planner_patience: 50.0 # Maximum time in seconds the planner waits for a valid plan
  311.  
  312.  
  313. #use_sim_time: True # If simulation time should be used.
  314. planner_plugins: ["GridBased"]
  315. GridBased:
  316. plugin: "nav2_smac_planner/SmacPlannerHybrid" # The plugin used for planning, here Hybrid-A*.
  317. downsample_costmap: false #switched to true to see if reach greater paths # Whether the costmap should be downsampled.
  318. transform_tolerance: 2.0 #0.3 # Increased over 3 times the time tolerance to calculate a path, otherwise just close waypoints will produce a path, since it take time to generate a path for large areas
  319. downsampling_factor: 1
  320. allow_unknown: true # If planning through unknown space is allowed.
  321. tolerance: 2.0 # Tolerance for planning in meters: Given the size of truck 1 meter is not so huge...
  322. max_iterations: 1000000 #1000000 # Max iterations the planner can take before stopping.
  323. max_on_approach_iterations: 1000 # Iterations to try to find an exact solution once within goal tolerance.
  324. max_planning_time: 50.0 #30.0 #15.0 # Max planning time in seconds.# I have doubled the time to allow computate far waypoitns, wich require more time to produce a bigger path (greater lenght)
  325. motion_model_for_search: "DUBIN" # The motion model used for planning. "DUBIN" for non-holonomic robots without reverse gear, "REEDS_SHEPP" for those with.
  326. angle_quantization_bins: 72 #36 # Number of bins for quantizing angles. More bins, the finer the search . Reduced to provide more straight paths instead the curvy ones being produced which is not compatible for aligned waypoints of GPS.
  327. minimum_turning_radius: 11.6 # Minimum turning radius for the vehicle in meters. 11.6 official value given by manual
  328. reverse_penalty: 2.0 # Penalty for reversing. Higher values discourage reversing.
  329. change_penalty: 1.0 # Penalty for changing direction.
  330. non_straight_penalty: 1.0 #1.5 #1.2 # Penalty for non-straight motions. Encourages straighter paths.
  331. cost_penalty: 1.0 #3.0 # Penalty for traversing high-cost cells. Higher values make the robot more cost-sensitive.
  332. retrospective_penalty: 0.03
  333. lookup_table_size: 25.0 # Increased for complex environment handling
  334. cache_obstacle_heuristic: True # Caches the heuristic calculations for obstacle-laden areas to speed up planning.
  335. debug_visualizations: True # Enables debug visualizations in RViz.
  336. analytic_expansion_ratio: 20.0 # Multiplier for how often analytic expansions are attempted.
  337. analytic_expansion_max_length: 100.0 #3.0 # Maximum allowed length for an analytic expansion.
  338. analytic_expansion_max_cost: 800 #200.0 # The maximum single cost for any part of an analytic expansion to contain and be valid, except when necessary on approach to goal
  339. analytic_expansion_max_cost_override: True #false # Whether or not to override the maximum cost setting if within critical distance to goal (ie probably required)
  340. smooth_path: True
  341. allow_primitive_interpolation: True #This adds additional motion primitives that can help create more direct paths between points.
  342. # Each of these parameters allows for fine-tuning the planner's behavior to suit the specific needs of your application and the characteristics of the environment.
  343. # The analytic_expansion_ratio and analytic_expansion_max_length, for example, are particularly useful in complex or highly constrained environments where the standard grid-based search might struggle to find an optimal path.
  344. costmap:
  345. resolution: 1.0 # #1.0 # 0.05 # Smaller captures more detail, useful for larger areas
  346. width: 30 #150
  347. height: 30 #150
  348. #radius: 0.22
  349. footprint: "[[-4.8025, -1.739], [4.8025, -1.739], [4.8025, 1.739], [-4.8025, 1.739]]"
  350.  
  351.  
  352. #LOCAL PLANNER
  353. controller_server:
  354. ros__parameters:
  355. controller_frequency: 50.0 #20.0
  356. min_x_velocity_threshold: 0.01
  357. min_y_velocity_threshold: 0.5
  358. min_theta_velocity_threshold: 0.01
  359. failure_tolerance: 1.0 #0.3
  360. progress_checker_plugins: ["progress_checker"]
  361. #goal_checker_plugins: ["general_goal_checker"] # "precise_goal_checker"
  362. goal_checker_plugins: ["front_cabin_goal_checker"] # I have developed this one
  363. front_cabin_goal_checker:
  364. plugin: "nav2_bringup/FrontCabinGoalChecker"
  365. # Adjust as necessary # It is not working here. CHANGE IN CPP CODE THE TOLERANCES: front_cabin_goal_checker.cpp and recompile
  366. # front_offset: 5.0
  367. # xy_goal_tolerance: 1.0 # Meters
  368. # yaw_goal_tolerance: 1.25 # Radians
  369.  
  370. controller_plugins: ["FollowPath"]
  371.  
  372. # Progress checker parameters
  373. progress_checker:
  374. plugin: "nav2_controller::SimpleProgressChecker"
  375. required_movement_radius: 10.0 # Tamanho minimo em metros que considera que o caminhão não esta progredindo senão andou isso.
  376. movement_time_allowance: 15.0
  377.  
  378. # Goal checker parameters
  379. #precise_goal_checker:
  380. # plugin: "nav2_controller::SimpleGoalChecker"
  381. # xy_goal_tolerance: 0.25
  382. # yaw_goal_tolerance: 0.25
  383. # stateful: True
  384.  
  385. # general_goal_checker:
  386. # stateful: True
  387. # plugin: "nav2_controller::SimpleGoalChecker"
  388. # xy_goal_tolerance: 1.0 #1.5 # meters wE CANNOT LET IT DEVIATE TO MUCH FROM CENTER OF PLANNED TRAJECTORY, IT MUST TRACK AND FOLLOW IT KEEPING ON CENTER
  389. # yaw_goal_tolerance: 0.2 # 0.25 rad = 14 degrees
  390.  
  391. FollowPath:
  392. plugin: "nav2_mppi_controller::MPPIController"
  393. # MPPI specific parameters
  394. time_steps: 112 #30 # Increasing this value consumer more computer resources, however is needed to increase time horizon and get more smooth possible paths, increaseing time-horizon
  395. model_dt: 0.02 # Adjust to match your control loop timing , frequency = 50, dt = 150 = 0.02
  396. #TIME HORIZON = model_dt * time_steps --> predicted horizon is about 2.24 seconds x 10 m/s (Transboard vel) = 22.4 meters < 50 meters of local costmap size (Ok is under the costmap size)
  397. batch_size: 1000 #1000 # Lowered to reduce computational load
  398. vx_std: 0.1 #0.2 # Adjust based on expected velocity deviations
  399. #vy_std: 0.2 # Set to 0 as lateral movement is not applicable
  400. wz_std: 1.0 #0.0175 #0.05 # Adjust based on expected angular velocity deviations
  401. vx_max: 5.0 #8.5 # 5.0 # Set to your robot's max forward velocity= 8.5 m/s = 30 km/h (Transbord Operation)
  402. vx_min: -2.25 # Set to your robot's max reverse velocity if applicable, else set to 0
  403. vy_max: 0.0 # Set to 0 as lateral movement is not applicable
  404. wz_max: 10.0 # Set to your robot's max angular velocity clockwise
  405. wz_min: -10.0 # allow couterclockwise steering
  406. iteration_count: 10 #5 # Adjust based on the desired quality of the solution vs. computational time
  407. temperature: 0.15 #0.2 # Lowered to encourage less exploration in the control space, following the optimal path, avoiding unncessary exploitation and selection of suboptimal paths (offset, paralle routes), focusing on optimum path and smooth trajectories.
  408. gamma: 0.03 #0.015 # Adjust based on your system's response to control inputs. I have reduced from 0.015 to 0.01 to favor smoother trajectory following.
  409. motion_model: "Ackermann" # Changed to Ackermann to match your robot's model
  410. retry_attempt_limit: 10 # Sets the number of attempts to find a feasible trajectory before failure. Higher values increase resilience to transient navigation difficulties.
  411. reset_period: 2.0 # Time of inactivity required to reset the optimizer, helping recover from bad states. Relevant for maintaining consistent controller performance.
  412. regenerate_noises: false
  413. #TRAJECTORY VISUALIZATION
  414. visualize: true # Enable to visualize sampled trajectories in RViz. Useful for debugging and tuning, but may impact performance due to data volume.
  415. trajectory_step: 5 # Determines the step between visualized trajectories. A value of 5 means every 5th trajectory is visualized, reducing data volume for clarity.
  416. time_step: 3 # Sets the step between points on visualized trajectories. A value of 3 means every 3rd point is shown, balancing detail with visualization manageability.
  417. #PATH HANDLER PARAMS
  418. transform_tolerance: 1.0 #0.3 # Sets the tolerance for data transformations in seconds. A value of 0.3 allows for a broader window to accommodate potential delays in receiving GPS data and other sensor inputs, ensuring effective synchronization of data from different sources. This is particularly important in off-road conditions where GPS signal delays or inconsistencies might occur, helping to maintain accurate and reliable navigation despite these challenges.
  419. prune_distance: 120.0 # Balanced foresight for smoother, efficient navigation # I am setting to be greater than twice of the truck size
  420. ## Distance ahead of the nearest path point to the truck to prune the path.
  421. # Determines the length of the path segment considered for current navigation decisions.
  422. # Increasing this distance allows for more foresighted planning, enabling smoother maneuvers and better anticipation of upcoming path changes.
  423. # Too high a value might overload the system with distant path details, while too low could lead to short-sighted navigation,
  424. # potentially missing out on efficient route adjustments or preparation for future obstacles and turns.
  425. max_robot_pose_search_dist: 25.0 # Don't increase too much otherwise the truck will move just straight thinking it can readapt to a curve later
  426. ## Max integrated distance ahead of robot pose to search for the nearest path point.
  427. # A higher value allows for a broader search area to reacquire the path after deviations,
  428. # especially useful in complex or looping paths. It ensures the truck can find its way back to the path efficiently,
  429. # enhancing navigation robustness in dynamic environments or after unexpected detours.
  430. # However, setting it too high may increase computational load without proportional benefits.
  431. enforce_path_inversion: false # Disables strict adherence to path inversions to promote smoother driving. Useful for avoiding unnecessary and potentially sharp direction changes that can disrupt passenger comfort. Set to true only if precise path following, including exact direction changes, is critical for operation.
  432. inversion_xy_tolerance: 0.2 # Adjusts how closely the truck needs to get to a path inversion point before considering it reached, in meters. A larger value smooths out navigation by reducing the need for precise alignment with path inversion points, minimizing abrupt steering adjustments. Ideal for ensuring passenger comfort by prioritizing smoother transitions over strict path fidelity.
  433. inversion_yaw_tolerance: 0.4 # Sets the angular tolerance for considering a path inversion point achieved, in radians. Increasing this tolerance allows for smoother turns by reducing the precision required in aligning with the path's intended direction changes. This helps in maintaining a comfortable ride by avoiding sharp or oscillatory steering behaviors.
  434.  
  435. AckermannConstraints:
  436. min_turning_r: 11.6 # Adjust to match your vehicle's minimum turning radius, 11.6 official value given by manual
  437.  
  438. critics: ["PathFollowCritic", "PathAlignCritic", "PathAngleCritic", "PreferForwardCritic"] #, "ObstaclesCritic", , ] #, "GoalCritic", GoalAngleCritic]
  439. #critics: ["ObstaclesCritic", "GoalCritic", "PathAlignCritic", "PathFollowCritic", "GoalAngleCritic", "PathAngleCritic", "PreferForwardCritic", "TwirlingCritic"] #"CostCritic"
  440. # # Critics configuration (adjust weights and parameters based on your environment and requirements)
  441. PathFollowCritic:
  442. enabled: true
  443. cost_weight: 60.0 # Prioritizes progression along the path, key for efficient navigation in variable off-road conditions.
  444. cost_power: 5 #2 # Quadratic cost scaling to deter deviations from the path, ensuring diligent path tracking.
  445. threshold_to_consider: 0.5 # Adjusted for the truck's dimensions, allowing path follow behavior up until closer proximity to the goal.
  446. offset_from_furthest: 1 # Optimized to keep the vehicle aligned with the path's most relevant segments, enhancing navigational accuracy.
  447.  
  448. # ObstaclesCritic:
  449. # enabled: true
  450. # critical_weight: 35.0 # Increases penalty for near-collision scenarios, crucial for a large off-road truck to maintain safe distances from obstacles.
  451. # repulsion_weight: 1.5 # Enhances general obstacle avoidance, providing a balance between safety and efficiency in dynamic environments.
  452. # cost_power: 1 # Quadratic scaling of obstacle costs, promoting safer routes by penalizing closer obstacles more heavily.
  453. # consider_footprint: true # Essential for accurate obstacle avoidance, considering the truck's entire physical footprint.
  454. # collision_cost: 250000.0 # Sets a high penalty for collisions, reflecting the greater impact of collisions for larger vehicles.
  455. # collision_margin_distance: 12.0 # A wider margin to severely penalize near-collision paths, suitable for the truck's size.
  456. # near_goal_distance: 2.0 # Allows smoother goal convergence by relaxing obstacle avoidance near the goal, accommodating the truck's navigation needs.
  457. # cost_scaling_factor: 3.0 # Consistent with the inflation layer, ensuring coherent obstacle cost scaling.
  458. # inflation_radius: 5.0 # A larger radius around obstacles, providing a safer navigation buffer for the truck.
  459. # inflation_layer_name: "" # Specify if using multiple inflation layers and a particular one is needed for obstacle inflation.
  460.  
  461. # GoalAngleCritic:
  462. # enabled: true
  463. # cost_weight: 2.0
  464. # cost_power: 2
  465. # threshold_to_consider: 1.0 # # Tighter orientation alignment required
  466. # GoalCritic:
  467. # enabled: true
  468. # threshold_to_consider: 1.0 #2.0 # Increased to 2 meters to start considering goal distance cost from a greater distance, accommodating the truck's larger size and ensuring smoother transitions to goal-directed movement.
  469. # cost_power: 2 #2 # Set to 2 to apply a quadratic scaling of goal distance cost, encouraging more direct approaches as the truck gets closer to the goal.
  470. # cost_weight: 15.0 #7.0 # Increase to place a higher emphasis on moving directly towards the goal when in proximity, suitable for ensuring efficient navigation in off-road conditions.
  471. # # CostCritic: # For some reason using this set of parameters below avoid tuck start the gps following feature...
  472. # # enabled: true
  473. # # cost_weight: 4.0 # Higher weight prioritizes avoidance of high-cost areas, crucial for off-road navigation where obstacles can be unpredictable.
  474. # # cost_power: 2 # Quadratic scaling increases the penalty for nearing obstacles, encouraging safer routes.
  475. # # consider_footprint: true # Utilizes the full vehicle footprint for calculating costs, essential for accurately assessing the truck's interaction with obstacles.
  476. # # collision_cost: 1000000.0 # A very high cost for collisions emphasizes the importance of avoiding obstacles entirely.
  477. # # critical_cost: 500.0 # Increases the cost for being in the inflated space around obstacles, encouraging a safer distance from potential hazards.
  478. # # near_goal_distance: 1.0 # Expands the distance near the goal where obstacle costs are less emphasized, allowing for smoother goal convergence.
  479. # # inflation_layer_name: "" # Specify if using multiple inflation layers and a particular one is needed for cost calculations.
  480. PathAlignCritic:
  481. enabled: true
  482. cost_weight: 35.0 #12.0 # Higher weight on path alignment to ensure efficient navigation along the planned global path in off-road terrain.
  483. cost_power: 5 #2 # Quadratic cost scaling to more heavily penalize deviations from the path, promoting tighter adherence to the route.
  484. threshold_to_consider: 1.0 # Increased distance for path alignment focus, accommodating the truck's size and the navigational challenges of off-road terrain.
  485. offset_from_furthest: 2 # Adjusted to ensure path alignment is considered earlier, aiding in consistent path tracking in variable off-road conditions.
  486. max_path_occupancy_ratio: 1.0 #0.1 # A slightly higher tolerance for path occupancy, allowing for dynamic obstacle negotiation without losing path alignment.
  487. use_path_orientations: true # Enables consideration of path orientations, enhancing directional fidelity to the planned path, essential for complex off-road routes.
  488. PathAngleCritic:
  489. enabled: true
  490. cost_weight: 35.0 #3.6 # Enhances path angle alignment in complex off-road terrains, aiding in precise maneuvering and turns.
  491. cost_power: 5 # Applies quadratic scaling to penalize significant deviations from the path's angle, promoting closer adherence.
  492. threshold_to_consider: 1.0 # Allows for path angle adjustments from a greater distance, facilitating smoother approach and alignment.
  493. offset_from_furthest: 2 # Ensures path angle considerations are applied sooner, enhancing the vehicle's ability to align with upcoming turns.
  494. max_angle_to_furthest: 0.5 # Adopts a more lenient angle threshold for considering path alignment, accommodating the need for wider turns in off-road environments.
  495. mode: 2 # Prioritizes following the path in the requested direction, essential for effective navigation in off-road settings with specific directional requirements.
  496. PreferForwardCritic:
  497. enabled: true
  498. cost_weight: 50.0 #6.0 # Enhances the preference for forward movement, crucial for a truck's navigation efficiency and safety in off-road environments.
  499. cost_power: 2 # Implements quadratic cost scaling to more significantly penalize reversing, promoting a forward direction of travel.
  500. threshold_to_consider: 10.0 # Ensures forward movement is prioritized until the truck is within a practical distance to the goal, suitable for the vehicle's larger turning requirements.
  501. #TwirlingCritic: #DISABLE IT AFTER REMOVING SPINNING FROM 'RECOVERY BEHAVIORS' since nonholomic robots do not SPIN!
  502. # enabled: true # Enabled to apply a penalty for twirling movements, with the aim of discouraging spinning.
  503. # cost_weight: 20.0 # High weight to significantly penalize spinning movements during path planning.
  504. # cost_power: 1 # Linear penalty to ensure consistent discouragement of unnecessary rotations.
  505.  
  506.  
  507. smoother_server:
  508. ros__parameters:
  509. smoother_plugins: ["simple_smoother"]
  510. simple_smoother:
  511. plugin: "nav2_smoother::SimpleSmoother"
  512. tolerance: 1.0e-10
  513. max_its: 1000
  514. do_refinement: True
  515.  
  516. behavior_server:
  517. ros__parameters:
  518. local_costmap_topic: local_costmap/costmap_raw
  519. global_costmap_topic: global_costmap/costmap_raw
  520. local_footprint_topic: local_costmap/published_footprint
  521. global_footprint_topic: global_costmap/published_footprint
  522. cycle_frequency: 10.0
  523. behavior_plugins: ["backup", "drive_on_heading", "assisted_teleop", "wait"]
  524. #behavior_plugins: ["spin", "backup", "drive_on_heading", "assisted_teleop", "wait"]
  525. # spin:
  526. # plugin: "nav2_behaviors/Spin"
  527. backup:
  528. plugin: "nav2_behaviors/BackUp"
  529. drive_on_heading:
  530. plugin: "nav2_behaviors/DriveOnHeading"
  531. wait:
  532. plugin: "nav2_behaviors/Wait"
  533. assisted_teleop:
  534. plugin: "nav2_behaviors/AssistedTeleop"
  535. local_frame: odom
  536. global_frame: map
  537. robot_base_frame: base_footprint
  538. transform_tolerance: 0.1
  539. simulate_ahead_time: 2.0
  540. max_rotational_vel: 10.0 #1.0
  541. min_rotational_vel: 0.4
  542. rotational_acc_lim: 10.0 #3.2
  543.  
  544. waypoint_follower:
  545. ros__parameters:
  546. loop_rate: 20
  547. stop_on_failure: false
  548. waypoint_task_executor_plugin: "wait_at_waypoint"
  549. wait_at_waypoint:
  550. plugin: "nav2_waypoint_follower::WaitAtWaypoint"
  551. enabled: True
  552. waypoint_pause_duration: 200
  553.  
  554. velocity_smoother:
  555. ros__parameters:
  556. smoothing_frequency: 20.0 # This is the frequency at which the smoother operates. 20 Hz is a reasonable starting point.
  557. scale_velocities: False # Keeps scaling behavior off, which can be useful for debugging.
  558. feedback: "OPEN_LOOP" # Uses the open-loop smoothing method. This is suitable if closed-loop feedback isn't necessary.
  559. max_velocity: [8.33, 0.0, 0.72] # Max linear velocity set to ~8.33 m/s (~30 km/h), and angular velocity to ~0.72 rad/s.
  560. min_velocity: [-8.33, 0.0, -0.72] # Min linear velocity for reverse movement at the same max speed, and angular velocity for reverse turning.
  561. max_accel: [3.0, 0.0, 1.0] # Increases max linear and angular accelerations to 5.0 m/s² and 5.0 rad/s², respectively.
  562. max_decel: [-3.0, 0.0, -1.0] # Increases max linear and angular decelerations to -5.0 m/s² and -5.0 rad/s².
  563. odom_topic: "odom" # Confirms the odometry topic for velocity feedback, if used.
  564. odom_duration: 0.1 # Sets the duration to consider for odometry feedback.
  565. deadband_velocity: [0.0, 0.0, 0.0] # Sets the deadband for velocity to zero, ensuring no minimum threshold.
  566. velocity_timeout: 1.0 # Sets the timeout for velocity commands to 1 second.
  567.  
  568.  
  569. # collision_monitor:
  570. # ros__parameters:
  571. # base_frame_id: "base_footprint"
  572. # odom_frame_id: "odom"
  573. # cmd_vel_in_topic: "cmd_vel_smoothed"
  574. # cmd_vel_out_topic: "cmd_vel"
  575. # state_topic: "collision_monitor_state"
  576. # transform_tolerance: 0.2
  577. # source_timeout: 1.0
  578. # base_shift_correction: True
  579. # stop_pub_timeout: 2.0
  580. # # Polygons represent zone around the robot for "stop", "slowdown" and "limit" action types,
  581. # # and robot footprint for "approach" action type.
  582. # polygons: ["FootprintApproach"]
  583. # FootprintApproach:
  584. # type: "polygon"
  585. # action_type: "approach"
  586. # footprint_topic: "/local_costmap/published_footprint"
  587. # time_before_collision: 2.0
  588. # simulation_time_step: 0.1
  589. # min_points: 10
  590. # visualize: True
  591. # enabled: True
  592. # observation_sources: ["/sick_scan_2D"]
  593. # scan:
  594. # type: "scan"
  595. # topic: "/sick_scan_2D"
  596. # min_height: 0.15
  597. # max_height: 2.0
  598. # enabled: False #True
  599.  
  600.  
  601. # collision_monitor:
  602. # ros__parameters:
  603. # use_sim_time: True
  604. # base_frame_id: "base_footprint"
  605. # odom_frame_id: "odom"
  606. # cmd_vel_in_topic: "cmd_vel_raw"
  607. # cmd_vel_out_topic: "cmd_vel"
  608. # transform_tolerance: 0.5
  609. # source_timeout: 5.0
  610. # stop_pub_timeout: 2.0
  611. # polygons: ["PolygonStop", "PolygonSlow"]
  612. # PolygonStop:
  613. # type: "polygon"
  614. # points: [0.4, 0.3, 0.4, -0.3, 0.0, -0.3, 0.0, 0.3]
  615. # action_type: "stop"
  616. # min_points: 4 # max_points: 3 for Humble
  617. # visualize: True
  618. # polygon_pub_topic: "polygon_stop"
  619. # PolygonSlow:
  620. # type: "polygon"
  621. # points: [0.6, 0.4, 0.6, -0.4, 0.0, -0.4, 0.0, 0.4]
  622. # action_type: "slowdown"
  623. # min_points: 4 # max_points: 3 for Humble
  624. # slowdown_ratio: 0.3
  625. # visualize: True
  626. # polygon_pub_topic: "polygon_slowdown"
  627. # observation_sources: ["sick_scan_2D"]
  628. # scan:
  629. # type: "scan"
  630. # topic: "sick_scan_2D"
  631.  
  632.  
  633.  
  634.  
  635. # collision_monitor:
  636. # ros__parameters:
  637. # base_frame_id: "base_footprint"
  638. # odom_frame_id: "odometry/local" # Adjusted to your specific odometry topic
  639. # cmd_vel_in_topic: "cmd_vel_smoothed"
  640. # cmd_vel_out_topic: "cmd_vel"
  641. # state_topic: "collision_monitor_state"
  642. # transform_tolerance: 0.5
  643. # source_timeout: 5.0
  644. # base_shift_correction: True
  645. # stop_pub_timeout: 2.0
  646. # polygons: ["PolygonStop", "PolygonSlow", "FootprintApproach"]
  647. # PolygonStop:
  648. # type: "circle"
  649. # radius: 2.0 # Increased radius suitable for truck size
  650. # action_type: "stop"
  651. # visualize: True
  652. # polygon_pub_topic: "polygon_stop"
  653. # enabled: True
  654. # PolygonSlow:
  655. # type: "polygon"
  656. # points: "[[2.0, 2.0], [2.0, -2.0], [-1.0, -2.0], [-1.0, 2.0]]" # Adjusted dimensions for truck
  657. # action_type: "slowdown"
  658. # slowdown_ratio: 0.3
  659. # visualize: True
  660. # polygon_pub_topic: "polygon_slowdown"
  661. # enabled: True
  662. # FootprintApproach:
  663. # type: "polygon"
  664. # action_type: "approach"
  665. # footprint_topic: "/local_costmap/published_footprint"
  666. # time_before_collision: 3.0 # Increased time for truck's longer stopping distance
  667. # simulation_time_step: 0.02
  668. # visualize: False
  669. # enabled: True
  670. # observation_sources: ["scan"]
  671. # scan:
  672. # type: "sick_scan_2D"
  673. # topic: "/sick_scan_2D"
  674. # min_height: 0.1
  675. # max_height: 2.0 # Adjusted for truck's height
  676. # enabled: True
  677.  
  678.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement