🛻D.12 Model Predictive Path Integral Controller

Gif

The MPPI Controller ( Model Predictive Path Integral ) ဆိုတာ Nav2 မှာပါတဲ့ predictive controller အမျိုးအစားအသစ်တစ်ခု။ ၄င်းအမျိုးအစားဟာ TEB & Pure path tracking MPC controllers အမျိုးအစားတွေကနေဆင်းသက်လာတာ ။

သူက sampling based approach နည်းလမ်းကို အသုံးပြုပြီးတော့ အသင့်တော်ဆုံး trajectories ကိုရွေးချယ်တယ်။ ပြီးတော့ ပိုကောင်း ပိုတိုတဲ့ လမ်းကြောင်းတစ်ခုဖြစ် အောင် successive iterations တွေကနေ velocity တွေကို optimizingလုပ်ပေးတာဖြစ်ပါတယ်။

Plugin-based objective function တွေသုံပြီးတော့လည်း behaviors နှင့် behavioral attributes တွေကို customization and extension လုပ် ပေးပါတယ်။

လက်ရှိ Differential, Omidirectional and Ackermann robotsတွေမှာ MPPI controller ကို အသုံးပြုလို့ရပါတယ်။ hardware requirement အနေနှင့် MPPI controller ကို intel 4th gen i5 မာ 50+Hz နဲ့ စမ်းသပ်လို့အဆင် ပြေတယ်လို့ဆိုပါတယ်။

MPPI algorithm ဆိုတာ MPC ရဲ့ variant တစ်ခုပါ၊ robot ရဲ့ control velocity ကို iterative approach သုံးပြီးရှာပါတယ်။ previous time step's best control solution , the robot's current state , a set of randomly sampled perturbations from a Gaussian distribution စတာတွေအသုံးပြုထားတာပါ။

process တစ်ခု ဟာထပ်ခါထပ်ခါ လည် ပတ်နေပီး ရလာတဲ့ output scores ဟာ နောက်လာမဲ့ process တစ်ုခုရဲ့ initial value တစ်ခု အနေနဲ့ ပြန်သုံးမယ်လို့ ဆိုပါတယ်။

MPPI Parameters

Name

Description

Type

Default

motion_model

The desired motion model to use for trajectory planning. Options are DiffDrive, Omni, or Ackermann. Differential drive robots may use forward/reverse and angular velocities; Omni add in lateral motion; and Ackermann adds minimum curvature constraints.

string

“DiffDrive”

critics

A vector of critic plugin functions to use, without mppi::critic:: namespace which will be automatically added on loading.

string vector

N/A

iteration_count

Iteration count in the MPPI algorithm. Recommended to remain as 1 and instead prefer larger batch sizes.

int

1.0

batch_size

Count of randomly sampled candidate trajectories from current optimal control sequence in a given iteration. 1000 @ 50 Hz or 2000 @ 30 Hz seems to produce good results.

int

1000.0

Time steps

Number of time steps (points) in candidate trajectories

int

56.0

model_dt

Length of each time step’s dt timestep, in seconds. time_steps * model_dt is the prediction horizon.

double

0.1

vx_std

Sampling standard deviation for Vx

double

0.2

vy_std

Sampling standard deviation for Vy

double

0.2

wz_std

Sampling standard deviation for Wz (angular velocity)

double

0.2

vx_max

Target maximum forward velocity (m/s).

double

0.5

vy_max

Target maximum lateral velocity, if using Omni motion model (m/s).

double

0.5

vx_min

Maximum reverse velocity (m/s).

double

-0.35

wz_max

Maximum rotational velocity (rad/s).

double

1.9

temperature

Selectiveness of trajectories by their costs (The closer this value to 0, the “more” we take in consideration controls with less cost), 0 mean use control with best cost, huge value will lead to just taking mean of all trajectories without cost consideration.

double

0.3

gamma

A trade-off between smoothness (high) and low energy (low). This is a complex parameter that likely won’t need to be changed from the default. See Section 3D-2 in “Information Theoretic Model Predictive Control: Theory and Applications to Autonomous Driving” for detailed information.

double

0.0

visualize

Whether to publish debuggin trajectories for visualization. This can slow down the controller substantially (e.g. 1000 batches of 56 size every 30hz is alot of data).

bool

FALSE

retry_attempt_limit

Number of attempts to find feasible trajectory on failure for soft-resets before reporting total failure.

int

1.0

reset_period

Required time of inactivity to reset optimizer (only in Humble due to backport ABI policies).

double

1.0

Trajectory Visualization

Name

Description

Type

Default

trajectory_step

The step between trajectories to visualize to downsample candidate trajectory pool.

int

5.0

time_step

The step between points on trajectories to visualize to downsample trajectory density.

int

3.0

Path Handler

Name

Description

Type

Default

transform_tolerance

Time tolerance for data transformations with TF (s).

double

0.1

prune_distance

Distance ahead of nearest point on path to robot to prune path to (m).

double

1.5

max_robot_pose_search_dist

Max integrated distance ahead of robot pose to search for nearest path point in case of path looping

double

Costmap size / 2

enforce_path_inversion

If true, it will prune paths containing cusping points for segments changing directions (e.g. path inversions) such that the controller will be forced to change directions at or very near the planner’s requested inversion point. This is targeting Smac Planner users with feasible paths who need their robots to switch directions where specifically requested.

bool

FALSE

inversion_xy_tolerance

Cartesian proximity (m) to path inversion point to be considered “achieved” to pass on the rest of the path after path inversion.

double

0.2

inversion_yaw_tolerance

Angular proximity (radians) to path inversion point to be considered “achieved” to pass on the rest of the path after path inversion. 0.4 rad = 23 deg.

double

0.4

Ackermann Motion Model

Name

Description

Type

Default

min_turning_r

The minimum turning radius possible for the vehicle platform (m).

double

0.2

Constraint Critic

Name

Description

Type

Default

cost_weight

Weight to apply to critic term.

double

4.0

cost_power

Power order to apply to term.

int

1.0

Goal Angle Critic

Name

Description

Type

Default

cost_weight

Weight to apply to critic term.

double

3.0

cost_power

Power order to apply to term.

int

1

threshold_to_consider

Minimal distance (m) between robot and goal above which angle goal cost considered.

double

0.5

Goal Critic

Name

Description

Type

Default

cost_weight

Weight to apply to critic term.

double

5.0

cost_power

Power order to apply to term.

int

1

threshold_to_consider

Minimal distance (m) between robot and goal above which goal distance cost considered. It is wise to start with this as being the same as your prediction horizon to have a clean hand-off with the path follower critic.

double

1.4

Obstacles Critic

Name

Description

Type

Default

critical_weight

Weight to apply to critic for near collisions closer than collision_margin_distance to prevent near collisions only as a method of virtually inflating the footprint. This should not be used to generally influence obstacle avoidance away from critical collisions.

double

20.0

repulsion_weight

Weight to apply to critic for generally preferring routes in lower cost space. This is separated from the critical term to allow for fine tuning of obstacle behaviors with path alignment for dynamic scenes without impacting actions which may directly lead to near-collisions. This is applied within the inflation_radius distance from obstacles.

double

1.5

cost_power

Power order to apply to term.

int

1

consider_footprint

Whether to use point cost (if robot is circular or low compute power) or compute SE2 footprint cost.

bool

FALSE

collision_margin_distance

Margin distance (m) from collision to apply severe penalty, similar to footprint inflation. Between 0.05-0.2 is reasonable. Note that it will highly influence the controller not to enter spaces more confined than this, so ensure this parameter is set lower than the narrowest you expect the robot to need to traverse through.

double

0.10

near_goal_distance

Distance (m) near goal to stop applying preferential obstacle term to allow robot to smoothly converge to goal pose in close proximity to obstacles.

double

0.50

cost_scaling_factor

Exponential decay factor across inflation radius. This should be the same as for your inflation layer (Humble only)

double

10.0

inflation_radius

Radius to inflate costmap around lethal obstacles. This should be the same as for your inflation layer (Humble only)

double

0.55

Path Align Critic

Name

Description

Type

Default

cost_weight

Weight to apply to critic term.

double

10.0

cost_power

Power order to apply to term.

int

1

threshold_to_consider

Distance (m) between robot and goal to stop considering path alignment and allow goal critics to take over.

double

0.5

offset_from_furthest

Checks that the candidate trajectories are sufficiently far along their way tracking the path to apply the alignment critic. This ensures that path alignment is only considered when actually tracking the path, preventing awkward initialization motions preventing the robot from leaving the path to achieve the appropriate heading.

int

20.0

max_path_occupancy_ratio

Maximum proportion of the path that can be occupied before this critic is not considered to allow the obstacle and path follow critics to avoid obstacles while following the path’s intent in presence of dynamic objects in the scene. Between 0-1 for 0-100%.

double

0.07

use_path_orientations

Whether to consider path’s orientations in path alignment, which can be useful when paired with feasible smac planners to incentivize directional changes only where/when the smac planner requests them. If you want the robot to deviate and invert directions where the controller sees fit, keep as false. If your plans do not contain orientation information (e.g. navfn), keep as false.

bool

FALSE

Path Angle Critic

Name

Description

Type

Default

cost_weight

Weight to apply to critic term.

double

2.0

cost_power

int

1

threshold_to_consider

Distance (m) between robot and goal to stop considering path angles and allow goal critics to take over.

double

0.5

offset_from_furthest

int

20

max_angle_to_furthest

Angular distance (rad) between robot and goal above which path angle cost starts being considered

double

1.2

mode

Enum type for mode of operations for the path angle critic depending on path input types and behavioral desires. 0: Forward Preference, penalizes high path angles relative to the robot’s orientation to incentivize turning towards the path. 1: No directional preference, penalizes high path angles relative to the robot’s orientation or mirrored orientation (e.g. reverse), which ever is less, when a particular direction of travel is not preferable. 2: Consider feasible path orientation, when using a feasible path whereas the path points have orientation information (e.g. Smac Planners), consider the path’s requested direction of travel to penalize path angles such that the robot will follow the path in the requested direction.

int

0

Path Follow Critic

Name

Description

Type

Default

cost_weight

Weight to apply to critic term.

double

5.0

cost_power

Power order to apply to term.

threshold_to_consider

Distance (m) between robot and goal to stop considering path following and allow goal critics to take over. It is wise to start with this as being the same as your prediction horizon to have a clean hand-off with the goal critic.

offset_from_furthest

Number of path points after furthest one any trajectory achieves to drive path tracking relative to.

Prefer Forward Critic

Name

Description

Type

Default

cost_weight

Weight to apply to critic term.

double

5

cost_power

Power order to apply to term.

int

1

threshold_to_consider

Distance (m) between robot and goal to stop considering path following and allow goal critics to take over. It is wise to start with this as being the same as your prediction horizon to have a clean hand-off with the goal critic.

double

0.5

Twirling Critic

Name

Description

Type

Default

cost_weight

Weight to apply to critic term.

double

10

cost_power

Power order to apply to term.

int

1

နမူနာ

controller_server:
  ros__parameters:
    controller_frequency: 30.0
    FollowPath:
      plugin: "nav2_mppi_controller::MPPIController"
      time_steps: 56
      model_dt: 0.05
      batch_size: 2000
      vx_std: 0.2
      vy_std: 0.2
      wz_std: 0.4
      vx_max: 0.5
      vx_min: -0.35
      vy_max: 0.5
      wz_max: 1.9
      iteration_count: 1
      prune_distance: 1.7
      transform_tolerance: 0.1
      temperature: 0.3
      gamma: 0.015
      motion_model: "DiffDrive"
      visualize: false
      reset_period: 1.0 # (only in Humble)
      TrajectoryVisualizer:
        trajectory_step: 5
        time_step: 3
      AckermannConstrains:
        min_turning_r: 0.2
      critics: ["ConstraintCritic", "ObstaclesCritic", "GoalCritic", "GoalAngleCritic", "PathAlignCritic", "PathFollowCritic", "PathAngleCritic", "PreferForwardCritic"]
      ConstraintCritic:
        enabled: true
        cost_power: 1
        cost_weight: 4.0
      GoalCritic:
        enabled: true
        cost_power: 1
        cost_weight: 5.0
        threshold_to_consider: 1.4
      GoalAngleCritic:
        enabled: true
        cost_power: 1
        cost_weight: 3.0
        threshold_to_consider: 0.5
      PreferForwardCritic:
        enabled: true
        cost_power: 1
        cost_weight: 5.0
        threshold_to_consider: 0.5
      ObstaclesCritic:
        enabled: true
        cost_power: 1
        repulsion_weight: 1.5
        critical_weight: 20.0
        consider_footprint: false
        collision_cost: 10000.0
        collision_margin_distance: 0.1
        near_goal_distance: 0.5
        inflation_radius: 0.55 # (only in Humble)
        cost_scaling_factor: 10.0 # (only in Humble)
      PathAlignCritic:
        enabled: true
        cost_power: 1
        cost_weight: 14.0
        max_path_occupancy_ratio: 0.05
        trajectory_point_step: 3
        threshold_to_consider: 0.5
        offset_from_furthest: 20
        use_path_orientations: false
      PathFollowCritic:
        enabled: true
        cost_power: 1
        cost_weight: 5.0
        offset_from_furthest: 5
        threshold_to_consider: 1.4
      PathAngleCritic:
        enabled: true
        cost_power: 1
        cost_weight: 2.0
        offset_from_furthest: 4
        threshold_to_consider: 0.5
        max_angle_to_furthest: 1.0
        mode: 0
      # TwirlingCritic:
      #   enabled: true
      #   twirling_cost_power: 1
      #   twirling_cost_weight: 10.0

General Words of Wisdom

sdfsf

Last updated