ucla-mobility / OpenCDA

A generalized framework for prototyping full-stack cooperative driving automation applications under CARLA+SUMO.
Other
988 stars 197 forks source link

Controller selection in OpenCDA #202

Closed hlwei closed 11 months ago

hlwei commented 1 year ago

How to specify the controller in OpenCDA? I know there is a PID controller in the source code. But I cannot find where you define the controller type. Could you please provide some comments and help on this? Thx.

wangxso commented 12 months ago

in the default.yaml you can specify the controller like this

 controller:
    type: pid_controller # this has to be exactly the same name as the controller py file
    args:
      lat:
        k_p: 0.75
        k_d: 0.02
        k_i: 0.4
      lon:
        k_p: 0.37
        k_d: 0.024
        k_i: 0.032
      dynamic: false # whether use dynamic pid setting
      dt: ${world.fixed_delta_seconds} # this should be equal to your simulation time-step
      max_brake: 1.0
      max_throttle: 1.0
      max_steering: 0.3

and you need write some controller algorithm in opencda/core/actuation/xxx_controller.py I don't know if it's right or not, I hope it can help you.

wangxso commented 12 months ago

in the default.yaml you can specify the controller like this

 controller:
    type: pid_controller # this has to be exactly the same name as the controller py file
    args:
      lat:
        k_p: 0.75
        k_d: 0.02
        k_i: 0.4
      lon:
        k_p: 0.37
        k_d: 0.024
        k_i: 0.032
      dynamic: false # whether use dynamic pid setting
      dt: ${world.fixed_delta_seconds} # this should be equal to your simulation time-step
      max_brake: 1.0
      max_throttle: 1.0
      max_steering: 0.3

and you need write some controller algorithm in opencda/core/actuation/xxx_controller.py I don't know if it's right or not, I hope it can help you.

and you also can read the doc with customization