Apollo: Lat controller and Lon controller sequence

Created on 9 Apr 2018  ·  5Comments  ·  Source: ApolloAuto/apollo

Hi Apollo team,

How do these two controllers running in time, i.e. sequentially or in parallel?
If I want to run Longitudinal controller before the Lateral controller, how do I specify the sequence?
Thank you!

Control Question

Most helpful comment

The lateral controller controls the steering while the longitudinal controller controls throttle and braking. In fully auto mode, both commands are sent to canbus. In AUTO_STEER_ONLY mode, only steering cmd is sent to canbus. On the other hand, if in AUTO_SPEED_ONLY mode, only throttle and braking cmds are pushed to canbus.

Here is related code snippet:

  if (driving_mode_ == Chassis::COMPLETE_AUTO_DRIVE ||
      driving_mode_ == Chassis::AUTO_SPEED_ONLY) {
    Gear(control_command.gear_location());
    Throttle(control_command.throttle());
    Brake(control_command.brake());
    SetEpbBreak(control_command);
  }

  if (driving_mode_ == Chassis::COMPLETE_AUTO_DRIVE ||
      driving_mode_ == Chassis::AUTO_STEER_ONLY) {
    const double steering_rate_threshold = 1.0;
    if (control_command.steering_rate() > steering_rate_threshold) {
      Steer(control_command.steering_target(), control_command.steering_rate());
    } else {
      Steer(control_command.steering_target());
    }
  }

All 5 comments

@wckorealsh you can change it via modifying the controller order in https://github.com/ApolloAuto/apollo/blob/master/modules/control/conf/lincoln.pb.txt

Thanks @Capri2014, Does this mean that the one comes first in the config file actually runs first?

The lateral controller controls the steering while the longitudinal controller controls throttle and braking. In fully auto mode, both commands are sent to canbus. In AUTO_STEER_ONLY mode, only steering cmd is sent to canbus. On the other hand, if in AUTO_SPEED_ONLY mode, only throttle and braking cmds are pushed to canbus.

Here is related code snippet:

  if (driving_mode_ == Chassis::COMPLETE_AUTO_DRIVE ||
      driving_mode_ == Chassis::AUTO_SPEED_ONLY) {
    Gear(control_command.gear_location());
    Throttle(control_command.throttle());
    Brake(control_command.brake());
    SetEpbBreak(control_command);
  }

  if (driving_mode_ == Chassis::COMPLETE_AUTO_DRIVE ||
      driving_mode_ == Chassis::AUTO_STEER_ONLY) {
    const double steering_rate_threshold = 1.0;
    if (control_command.steering_rate() > steering_rate_threshold) {
      Steer(control_command.steering_target(), control_command.steering_rate());
    } else {
      Steer(control_command.steering_target());
    }
  }

@jilinzhou I understand both commands are sent to canbus. My question is if they are running sequentially or not i.e. two processes (A,B) are running in order: A->B->A->B->A->B.....

@wckorealsh yes the it is running sequentially, but not two "processes", but two "controllers".

Was this page helpful?
0 / 5 - 0 ratings

Related issues

maziqiqi picture maziqiqi  ·  3Comments

JSnobody picture JSnobody  ·  3Comments

BenBaek picture BenBaek  ·  3Comments

lql7595 picture lql7595  ·  3Comments

YaoQii picture YaoQii  ·  3Comments