apollo icon indicating copy to clipboard operation
apollo copied to clipboard

Lat controller and Lon controller sequence

Open wckorealsh opened this issue 8 years ago • 5 comments

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!

wckorealsh avatar Apr 09 '18 20:04 wckorealsh

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

Capri2014 avatar Apr 09 '18 22:04 Capri2014

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

wckorealsh avatar Apr 10 '18 12:04 wckorealsh

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 avatar Apr 10 '18 14:04 jilinzhou

@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 avatar Apr 10 '18 18:04 wckorealsh

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

Capri2014 avatar Apr 11 '18 00:04 Capri2014