Overview
Lateral control manages steering to keep your vehicle centered in the lane. sunnypilot offers multiple lateral control methods with extensive tuning capabilities for optimal performance across different vehicles and driving conditions.Most vehicles work well with default settings. Advanced tuning is optional and should only be attempted if you understand the implications.
Lateral Control Methods
Torque Control (Default)
Torque-based lateral control directly commands steering torque for precise path following.Force use of Torque lateral control even if other methods are available
- Direct torque commands to EPS (Electric Power Steering)
- Faster response time than angle-based control
- Better handling of dynamic conditions
- Requires vehicle-specific tuning
Select torque control algorithm version:
- Default - Latest production tune (recommended)
- v1.0 - Current stable release
- v0.0 - Legacy tune for compatibility
Neural Network Lateral Control (NNLC)
Formerly known as NNFF, this advanced method uses neural networks trained on vehicle-specific driving data.Enable NNLC for enhanced steering accuracy using learned vehicle behavior
- Trained on real driving data for each EPS firmware
- Increased control accuracy
- Better adaptation to vehicle-specific characteristics
- Continuously improving with more data
NNLC requires vehicle-specific models. Contact @twilsonco on Discord to contribute data for your vehicle if unsupported.
Angle Control
Used by some platforms (Ford, Nissan, Tesla) that accept steering angle commands rather than torque.Torque Control Tuning
Self-Tune (Automatic)
The recommended approach for most users:Enable automatic self-tuning of torque parameters
Use less restrictive settings for self-tune learning (Beta)
- Enable Self-Tune in Settings → Steering
- Drive normally for several hours
- Parameters automatically adapt to your vehicle
- Monitor
LiveTorqueParametersfor learned values
- Analyzes steering response patterns
- Adjusts friction compensation
- Tunes lateral acceleration factors
- Refines based on road conditions
Manual Tuning (Advanced)
For experienced users who want direct control:Enable custom torque parameter tuning interface
Allow real-time manual parameter adjustments
Friction Parameter
Friction compensation factor
- Range: 0.0 - 1.0
- Step: 0.01
- Effect: Higher values = more aggressive friction compensation
- Steering system mechanical friction
- Low-speed steering resistance
- Center position holding force
- Too low: Sluggish response, poor centering
- Too high: Twitchy steering, oscillation
- Typical range: 0.01 - 0.05
Lateral Acceleration Factor
Lateral acceleration response scaling
- Range: 0.1 - 5.0
- Step: 0.1
- Effect: Scales torque response to lateral acceleration demands
- Steering sensitivity to curves
- Turn entry aggressiveness
- Lane change responsiveness
- Below 1.0: Gentler steering, slower lane changes
- Above 1.0: More aggressive steering, faster response
- Typical range: 0.8 - 1.5
Steering Delay Tuning
Live Learning Steering Delay
Enable automatic learning of vehicle’s steering response delay
- Adapts to your vehicle’s EPS characteristics
- Compensates for actuator delay
- Improves path tracking accuracy
- Reduces lag in steering response
Manual Delay Override
Manual software delay when live learning is disabled
- Range: 0.05 - 0.5 seconds
- Step: 0.01 seconds
- Steering feels delayed or laggy
- Path tracking oscillates
- Lane changes feel imprecise
- Disable
LagdToggle - Start with 0.15s
- Decrease if steering lags behind path
- Increase if steering oscillates
- Test on highway and curves
Advanced Features
Camera Offset
Virtually shift camera perspective horizontally
- Range: -0.35 to 0.35 meters
- Step: 0.01 meters
- Positive: Shift left
- Negative: Shift right
- Adjust for off-center camera mounting
- Compensate for wide vehicles
- Fine-tune lane positioning
Lane Turn Desire
Force model to plan turn intent based on blinker activation
Maximum speed for lane turn desire activation
- Range: 0 - 20 mph
- Step: 1 mph
- When blinker is on below threshold speed
- Model anticipates turn maneuver
- Adjusts path planning accordingly
- Useful for complex intersections
Blinker Lateral Control
Pause lateral control when turn signal is active
Minimum speed to pause lateral control with blinker
Delay before lateral control resumes after blinker endsAllows driver to complete maneuver before re-engagement
Internal Tuning Constants
These values are defined inlatcontrol_torque_ext_base.py and affect NNLC behavior:
PID Constants
Internal constants require modifying source code. Most users should use the parameter-based tuning options.
Monitoring and Diagnostics
Developer UI
Enable Developer UI to monitor lateral control in real-time:- E.T. - EPS Torque (current steering torque)
- L.A. - Lateral Acceleration (m/s²)
- FRI. - Friction compensation value
- Desired/Actual curvature - Path following accuracy
Parameter Values
Check learned torque parameters:Troubleshooting
Steering Oscillates
Steering Oscillates
Causes:
- Friction too high
- Lat accel factor too high
- Steering delay incorrect
- Reduce friction by 0.01-0.02
- Decrease lat accel factor by 0.1
- Check tire pressure
- Enable live learning delay
Poor Lane Centering
Poor Lane Centering
Causes:
- Friction too low
- Camera calibration off
- Model confidence low
- Increase friction by 0.01
- Recalibrate camera
- Enable self-tune for 20+ drives
- Check camera mount stability
Delayed Steering Response
Delayed Steering Response
Causes:
- Steering delay too high
- Lat accel factor too low
- EPS lag
- Reduce LagdToggleDelay by 0.02s
- Increase lat accel factor by 0.1
- Enable live learning delay
- Check vehicle-specific tuning
Controls Unresponsive Error
Controls Unresponsive Error
Causes:
- Torque control enforced on angle platform
- Parameter value out of range
- EPS communication fault
- Disable EnforceTorqueControl
- Reset custom parameters
- Check panda connection
- Review error logs
Best Practices
Related Resources
Parameters System
Understanding parameter management
Longitudinal Control
Speed and acceleration tuning
NNLC Setup
Neural network lateral control guide
Vehicle Tuning
Vehicle-specific tuning tips