Skip to content

Control

Prabodh Gyawali edited this page Oct 19, 2025 · 2 revisions

Control

Current Implementation (Last Year's Code)

The current control module implements a basic path-following system using the Pure Pursuit algorithm, which is a geometric path tracking controller. It consists of two main components:

  • Pure Pursuit Controller (pure_pursuit.py):

    • Subscribes to /path (nav_msgs/Path) from the path planning module and /odom (nav_msgs/Odometry) for current pose.
    • Uses a configurable lookahead distance (default 3.0m) to select a target point on the path ahead of the vehicle.
    • Calculates the required steering angle using the Pure Pursuit formula: curvature = (2 * lateral_offset) / (lookahead_distance²), then steering_angle = atan(wheelbase * curvature).
    • Sets a target speed (default 4.0 m/s), reducing it as the vehicle approaches the goal (within 1m, and stops within 0.2m).
    • Publishes AckermannDrive messages to /ackermann_cmd with speed and steering angle.
    • Vehicle parameters: wheelbase = 1.534m, max_steering_angle = 0.366 rad.
  • Ackermann to CmdVel Converter (ackermann_to_cmdvel_node.py):

    • Subscribes to /ackermann_cmd (ackermann_msgs/AckermannDrive).
    • Converts to geometry_msgs/Twist for /cmd_vel using Ackermann steering geometry: angular_velocity = speed * tan(steering_angle) / wheelbase.
    • Clamps steering angle to max (default 0.4 rad).
    • Directly transfers linear speed to linear.x in Twist.
    • Vehicle parameter: wheelbase = 1.534m.

This implementation provides a simple, reactive path-following capability suitable for basic autonomous driving on planned paths. It runs at 10 Hz and includes debug logging.

Last year's team did some research and decided to use MPC (Model Predictive Control) controllers, specifically the MPPI (Model Predictive Path Integral) variant, with MATLAB for the control module.

May need MATLAB pre-requisites.

Papers and Resources

Approach 1: MATLAB for Control wrapped with ROS2

Approach 2: Implementing Control using nav2 instead

Clone this wiki locally