Skip to content

Explain the Stanley controller with its equations and a link to section 4.3 #409

Todo

Description

@ShisatoYano

Problem

StanleyController (src/components/control/stanley/stanley_controller.py) doesn't explain its algorithm in the code:

  • The class docstring (lines 22-24) is one line, "Controller class by Stanley steering control algorithm", with no equation and no link to 4.3 Stanley
  • The constructor docstring (lines 27-30) doesn't list spec, and doesn't say what CONTROL_GAIN ($k$) is

doc/WRITING_GUIDE.md (line 160) asks docstrings to keep the key equations next to the code, with a link to the book section. PurePursuitController (pure_pursuit_controller.py, lines 12-25) shows the style.

Expected change

  • In the class docstring, write the equations of 4.3 with their numbers, in plain text: the front axle (1) x_f = x + L cos(theta), the steering law (3) delta = -(theta_e + atan(k e / v)), and the yaw rate (4) omega = v tan(delta) / L, with the sign convention of e and theta_e (positive when the vehicle is to the left of the course)
  • Add the link to 4.3 and the reference (Hoffmann et al., 2007, as in 4.3)
  • In the constructor docstring, add spec (vehicle specification object, for the wheelbase $L$ in m)
  • Don't change the code

The book includes this code. 4.3 shows StanleyController.update, _calculate_front_axle_state and _calculate_control_input with literalinclude (doc/path_tracking/stanley.md, lines 88-111), so their docstrings appear in the book as written. Keep the equations in the class docstring, and change those three methods only if their text gets clearer. Build the book and check section 4.3.

How to contribute

  • Comment /claim here to get assigned
  • Run . run_test_suites.sh, and build the book (sphinx-build -W --keep-going -b html doc doc/_build/html, see "Add documentation about existing program" in HOWTOCONTRIBUTE.md) to check 4.3
  • Write Closes #<this issue> in the description. No images are needed (the maintainer adds no images needed)

Good first issue: one docstring, and section 4.3 already has every equation to copy.

Activity

  1. added
    documentation
    good first issue
    on Dec 4, 2026
  2. abhijeet12905-ctrl commented on Dec 5, 2026

    @abhijeet12905-ctrl

    /claim

  3. github-actions commented on Dec 5, 2026

    @github-actions
    Contributor

    @abhijeet12905-ctrl This issue is now assigned to you. Thank you!

    • Open a pull request with Closes #409 in the description.
    • If you have already opened a pull request, edit its description (for example, add a line) to run the check again.
    • If neither a pull request nor a comment from you on this issue appears within 14 days, you are unassigned so that someone else can take it. You can claim it again later.

    See Claim an issue before you start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

documentationgood first issue

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions