Advertisement
Guest User

config planner_controller

a guest
Dec 15th, 2024
36
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.10 KB | None | 0 0
  1. planner_server:
  2. ros__parameters:
  3. expected_planner_frequency: 5.0 # Expected frequency for the planner to run in Hz.
  4. planner_patience: 50.0 # Maximum time in seconds the planner waits for a valid plan
  5.  
  6.  
  7. #use_sim_time: True # If simulation time should be used.
  8. planner_plugins: ["GridBased"]
  9. GridBased:
  10. plugin: "nav2_smac_planner/SmacPlannerHybrid" # The plugin used for planning, here Hybrid-A*.
  11. downsample_costmap: false #switched to true to see if reach greater paths # Whether the costmap should be downsampled.
  12. 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
  13. downsampling_factor: 1
  14. allow_unknown: true # If planning through unknown space is allowed.
  15. tolerance: 2.0 # Tolerance for planning in meters: Given the size of truck 1 meter is not so huge...
  16. max_iterations: 1000 #1000000 # Max iterations the planner can take before stopping.
  17. max_on_approach_iterations: 1000 # Iterations to try to find an exact solution once within goal tolerance.
  18. max_planning_time: 5.0 #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)
  19. motion_model_for_search: "DUBIN" # The motion model used for planning. "DUBIN" for non-holonomic robots without reverse gear, "REEDS_SHEPP" for those with.
  20. angle_quantization_bins: 10 #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.
  21. minimum_turning_radius: 11.6 #VALOR ALTO GERA ESPIRAIS # Minimum turning radius for the vehicle in meters. 11.6 official value given by manual
  22. reverse_penalty: 200.0 # Penalty for reversing. Higher values discourage reversing.
  23. change_penalty: 30.0 # Penalty for changing direction.
  24. non_straight_penalty: 1.5 #1.5 #1.2 # Penalty for non-straight motions. Encourages straighter paths.
  25. cost_penalty: 1000.0 #3.0 # Penalty for traversing high-cost cells. Higher values make the robot more cost-sensitive.
  26. retrospective_penalty: 1.0 #0.03
  27. lookup_table_size: 1.0 #PArece que auxilia na abertura pra recalculo usando valroes grandes#25.0 # Increased for complex environment handling
  28. cache_obstacle_heuristic: True # Caches the heuristic calculations for obstacle-laden areas to speed up planning.
  29. debug_visualizations: True # Enables debug visualizations in RViz.
  30. analytic_expansion_ratio: 1.0 #20.0 # Multiplier for how often analytic expansions are attempted.
  31. analytic_expansion_max_length: 120.0 #150.0 #3.0 # Maximum allowed length for an analytic expansion.
  32. analytic_expansion_max_cost: 10000 #200.0 #VALORES ALTOS AJUDA ELE OSCILAR MENOS # The maximum single cost for any part of an analytic expansion to contain and be valid, except when necessary on approach to goal
  33. analytic_expansion_3max_cost_override: True #false # Whether or not to override the maximum cost setting if within critical distance to goal (ie probably required)
  34. smooth_path: False #True
  35. allow_primitive_interpolation: False #True #This adds additional motion primitives that can help create more direct paths between points.
  36. # 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.
  37. # 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.
  38. costmap:
  39. resolution: 10.0 # #1.0 # 0.05 # Smaller captures more detail, useful for larger areas
  40. width: 30 #150
  41. height: 30 #150
  42. #radius: 0.22
  43. footprint: "[[-4.8025, -1.739], [4.8025, -1.739], [4.8025, 1.739], [-4.8025, 1.739]]"
  44.  
  45.  
  46. #LOCAL PLANNER
  47. controller_server:
  48. ros__parameters:
  49. controller_frequency: 20.0 #50.0 #20.0
  50. min_x_velocity_threshold: 0.01
  51. min_y_velocity_threshold: 0.5
  52. min_theta_velocity_threshold: 0.01
  53. failure_tolerance: 1.0 #0.3
  54. progress_checker_plugins: ["progress_checker"]
  55. #goal_checker_plugins: ["general_goal_checker"] # "precise_goal_checker"
  56. goal_checker_plugins: ["front_cabin_goal_checker"] # I have developed this one
  57. front_cabin_goal_checker:
  58. plugin: "nav2_bringup/FrontCabinGoalChecker"
  59. # Adjust as necessary # It is not working here. CHANGE IN CPP CODE THE TOLERANCES: front_cabin_goal_checker.cpp and recompile
  60. # front_offset: 5.0
  61. # xy_goal_tolerance: 1.0 # Meters
  62. # yaw_goal_tolerance: 1.25 # Radians
  63.  
  64. controller_plugins: ["FollowPath"]
  65.  
  66. # Progress checker parameters
  67. progress_checker:
  68. plugin: "nav2_controller::SimpleProgressChecker"
  69. required_movement_radius: 5.0 #10.0 # Tamanho minimo em metros que considera que o caminhão não esta progredindo senão andou isso.
  70. movement_time_allowance: 30.0 #15.0
  71.  
  72. # Goal checker parameters
  73. #precise_goal_checker:
  74. # plugin: "nav2_controller::SimpleGoalChecker"
  75. # xy_goal_tolerance: 0.25
  76. # yaw_goal_tolerance: 0.25
  77. # stateful: True
  78.  
  79. general_goal_checker:
  80. stateful: True
  81. plugin: "nav2_controller::SimpleGoalChecker"
  82. xy_goal_tolerance: 5.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
  83. yaw_goal_tolerance: 0.1 #0.2 # 0.25 rad = 14 degrees
  84.  
  85. FollowPath:
  86. plugin: "nav2_mppi_controller::MPPIController"
  87. # MPPI specific parameters
  88. #current_horizon = 0.02 * 150 = 3.0 segundos# current_horizon = model_dt * time_steps
  89. time_steps: 60 #112 # new_time_steps = current_horizon / model_dt # Increasing this value consumer more computer resources, however is needed to increase time horizon and get more smooth possible paths, increaseing time-horizon
  90. model_dt: 0.05 #0.02 # Adjust to match your control loop timing (1/ controller_frequency) , frequency = 50, model_dt = 0.02
  91. #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)
  92. batch_size: 1000 #1000 # Lowered to reduce computational load
  93. vx_std: 0.1 #0.2 # Adjust based on expected velocity deviations
  94. #vy_std: 0.2 # Set to 0 as lateral movement is not applicable
  95. wz_std: 1.0 #0.0175 #0.05 # Adjust based on expected angular velocity deviations
  96. vx_max: 5.0 #5.0 #8.5 # 5.0 # Set to your robot's max forward velocity= 8.5 m/s = 30 km/h (Transbord Operation)
  97. vx_min: -2.25 # Set to your robot's max reverse velocity if applicable, else set to 0
  98. vy_max: 0.0 # Set to 0 as lateral movement is not applicable
  99. wz_max: 0.5 #10.0 # Set to your robot's max angular velocity clockwise
  100. wz_min: -0.5 #-10.0 # allow couterclockwise steering
  101. iteration_count: 10 #5 # Adjust based on the desired quality of the solution vs. computational time
  102. temperature: 0.05 # 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.
  103. gamma: 0.02 #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.
  104. motion_model: "Ackermann" # Changed to Ackermann to match your robot's model
  105. retry_attempt_limit: 10 # Sets the number of attempts to find a feasible trajectory before failure. Higher values increase resilience to transient navigation difficulties.
  106. reset_period: 2.0 # Time of inactivity required to reset the optimizer, helping recover from bad states. Relevant for maintaining consistent controller performance.
  107. regenerate_noises: false
  108. #TRAJECTORY VISUALIZATION
  109. visualize: true # Enable to visualize sampled trajectories in RViz. Useful for debugging and tuning, but may impact performance due to data volume.
  110. trajectory_step: 5 # Determines the step between visualized trajectories. A value of 5 means every 5th trajectory is visualized, reducing data volume for clarity.
  111. 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.
  112. #PATH HANDLER PARAMS
  113. 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.
  114. prune_distance: 100.0 # Balanced foresight for smoother, efficient navigation # I am setting to be greater than twice of the truck size
  115. ## Distance ahead of the nearest path point to the truck to prune the path.
  116. # Determines the length of the path segment considered for current navigation decisions.
  117. # Increasing this distance allows for more foresighted planning, enabling smoother maneuvers and better anticipation of upcoming path changes.
  118. # Too high a value might overload the system with distant path details, while too low could lead to short-sighted navigation,
  119. # potentially missing out on efficient route adjustments or preparation for future obstacles and turns.
  120. 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
  121. ## Max integrated distance ahead of robot pose to search for the nearest path point.
  122. # A higher value allows for a broader search area to reacquire the path after deviations,
  123. # especially useful in complex or looping paths. It ensures the truck can find its way back to the path efficiently,
  124. # enhancing navigation robustness in dynamic environments or after unexpected detours.
  125. # However, setting it too high may increase computational load without proportional benefits.
  126. 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.
  127. 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.
  128. 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.
  129.  
  130. AckermannConstraints:
  131. min_turning_r: 11.6 # Adjust to match your vehicle's minimum turning radius, 11.6 official value given by manual
  132.  
  133. critics: ["PathFollowCritic", "PathAlignCritic", "PathAngleCritic", "PreferForwardCritic", "GoalCritic", "ObstaclesCritic"] #, "GoalCritic", GoalAngleCritic]
  134. #critics: ["ObstaclesCritic", "GoalCritic", "PathAlignCritic", "PathFollowCritic", "GoalAngleCritic", "PathAngleCritic", "PreferForwardCritic", "TwirlingCritic"] #"CostCritic"
  135. # # Critics configuration (adjust weights and parameters based on your environment and requirements)
  136. PathFollowCritic:
  137. enabled: true
  138. cost_weight: 60.0 # Prioritizes progression along the path, key for efficient navigation in variable off-road conditions.
  139. cost_power: 5 #2 # Quadratic cost scaling to deter deviations from the path, ensuring diligent path tracking.
  140. threshold_to_consider: 0.5 # Adjusted for the truck's dimensions, allowing path follow behavior up until closer proximity to the goal.
  141. offset_from_furthest: 1 # Optimized to keep the vehicle aligned with the path's most relevant segments, enhancing navigational accuracy.
  142.  
  143. ObstaclesCritic:
  144. enabled: true
  145. critical_weight: 50.0 #35.0 # Increases penalty for near-collision scenarios, crucial for a large off-road truck to maintain safe distances from obstacles.
  146. repulsion_weight: 1.5 # Enhances general obstacle avoidance, providing a balance between safety and efficiency in dynamic environments.
  147. cost_power: 2 #1 # Quadratic scaling of obstacle costs, promoting safer routes by penalizing closer obstacles more heavily.
  148. consider_footprint: true # Essential for accurate obstacle avoidance, considering the truck's entire physical footprint.
  149. collision_cost: 100000.0 # Sets a high penalty for collisions, reflecting the greater impact of collisions for larger vehicles.
  150. collision_margin_distance: 12.0 # A wider margin to severely penalize near-collision paths, suitable for the truck's size.
  151. near_goal_distance: 2.0 # Allows smoother goal convergence by relaxing obstacle avoidance near the goal, accommodating the truck's navigation needs.
  152. cost_scaling_factor: 3.0 # Consistent with the inflation layer, ensuring coherent obstacle cost scaling.
  153. inflation_radius: 5.0 # A larger radius around obstacles, providing a safer navigation buffer for the truck.
  154. inflation_layer_name: "" # Specify if using multiple inflation layers and a particular one is needed for obstacle inflation.
  155.  
  156. # GoalAngleCritic:
  157. # enabled: true
  158. # cost_weight: 2.0
  159. # cost_power: 2
  160. # threshold_to_consider: 1.0 # # Tighter orientation alignment required
  161. GoalCritic:
  162. enabled: true
  163. 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.
  164. 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.
  165. cost_weight: 30.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.
  166. # # CostCritic: # For some reason using this set of parameters below avoid tuck start the gps following feature...
  167. # # enabled: true
  168. # # cost_weight: 4.0 # Higher weight prioritizes avoidance of high-cost areas, crucial for off-road navigation where obstacles can be unpredictable.
  169. # # cost_power: 2 # Quadratic scaling increases the penalty for nearing obstacles, encouraging safer routes.
  170. # # consider_footprint: true # Utilizes the full vehicle footprint for calculating costs, essential for accurately assessing the truck's interaction with obstacles.
  171. # # collision_cost: 1000000.0 # A very high cost for collisions emphasizes the importance of avoiding obstacles entirely.
  172. # # critical_cost: 500.0 # Increases the cost for being in the inflated space around obstacles, encouraging a safer distance from potential hazards.
  173. # # near_goal_distance: 1.0 # Expands the distance near the goal where obstacle costs are less emphasized, allowing for smoother goal convergence.
  174. # # inflation_layer_name: "" # Specify if using multiple inflation layers and a particular one is needed for cost calculations.
  175. PathAlignCritic:
  176. enabled: true
  177. cost_weight: 35.0 #12.0 # Higher weight on path alignment to ensure efficient navigation along the planned global path in off-road terrain.
  178. cost_power: 5 #2 # Quadratic cost scaling to more heavily penalize deviations from the path, promoting tighter adherence to the route.
  179. threshold_to_consider: 1.0 # Increased distance for path alignment focus, accommodating the truck's size and the navigational challenges of off-road terrain.
  180. offset_from_furthest: 1 #2 # Adjusted to ensure path alignment is considered earlier, aiding in consistent path tracking in variable off-road conditions.
  181. max_path_occupancy_ratio: 1.0 #0.1 # A slightly higher tolerance for path occupancy, allowing for dynamic obstacle negotiation without losing path alignment.
  182. use_path_orientations: true # Enables consideration of path orientations, enhancing directional fidelity to the planned path, essential for complex off-road routes.
  183. PathAngleCritic:
  184. enabled: true
  185. cost_weight: 35.0 #3.6 # Enhances path angle alignment in complex off-road terrains, aiding in precise maneuvering and turns.
  186. cost_power: 5 # Applies quadratic scaling to penalize significant deviations from the path's angle, promoting closer adherence.
  187. threshold_to_consider: 1.0 # Allows for path angle adjustments from a greater distance, facilitating smoother approach and alignment.
  188. offset_from_furthest: 1 #2 # Ensures path angle considerations are applied sooner, enhancing the vehicle's ability to align with upcoming turns.
  189. 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.
  190. mode: 2 # Prioritizes following the path in the requested direction, essential for effective navigation in off-road settings with specific directional requirements.
  191. PreferForwardCritic:
  192. enabled: true
  193. 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.
  194. cost_power: 3 #2 # Implements quadratic cost scaling to more significantly penalize reversing, promoting a forward direction of travel.
  195. 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.
  196. #TwirlingCritic: #DISABLE IT AFTER REMOVING SPINNING FROM 'RECOVERY BEHAVIORS' since nonholomic robots do not SPIN!
  197. # enabled: true # Enabled to apply a penalty for twirling movements, with the aim of discouraging spinning.
  198. # cost_weight: 20.0 # High weight to significantly penalize spinning movements during path planning.
  199. # cost_power: 1 # Linear penalty to ensure consistent discouragement of unnecessary rotations.
  200.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement