ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.19k stars 9.71k forks source link

How to use EM planner with Apollo 3.0 #9613

Closed lukasthede closed 5 years ago

lukasthede commented 5 years ago

Hello,

I am currently using apollo 3.0 with the RTK planner but I would like to switch to the em planner. In the planning_config.pb.txt file the standard planner is defined like so:

standard_planning_config {
  planner_type : RTK
  planner_onroad_config {
    scenario_type : LANE_FOLLOW
  }
}

How can I change the planner used by the planning module to the em planner?

Thanks in advance!

System information

jmtao commented 5 years ago

@udeto please refer to conf: https://github.com/ApolloAuto/apollo/blob/master/modules/planning/conf/planning_config.pb.txt code: https://github.com/ApolloAuto/apollo/blob/master/modules/planning/on_lane_planning.cc#L583

lukasthede commented 5 years ago

Thank you. I fond the planning_config.pb.txt file in my apollo 3.0 version and it looks like this:

standard_planning_config {
  planner_type : RTK
  planner_onroad_config {
    scenario_type : LANE_FOLLOW
  }
}

So should I just replace it with the config file you refered me to?

I just need a planner that can handle simple driving scenarios like lane follow and small intersections (not multiple lanes) while avoiding other vehicles.

As I understand the RTK planner is not able to avoid other vehicles, right? Therefore I want to change the configuration either to the em or lattice planner. I can see that both of these planners are already implemented in my apollo 3.0 version Screenshot from 2019-09-12 17-13-39

I just dont know how the change the configuration so that the planning module uses these planners.

jmtao commented 5 years ago

@udeto yes. you are using the conf for RTK planner. And you need to switch to the conf for PUBLIC_ROAD (the file link as I posted).
We have these planner types: https://github.com/ApolloAuto/apollo/blob/master/modules/planning/proto/planning_config.proto#L285

lukasthede commented 5 years ago

I tried switching the plannin_config.pb.txt file to the file you posted. After building apollo and running the planning module I get the following error:

Log file created at: 2019/09/13 23:06:02
Running on machine: in_dev_docker
Log line format: [IWEF]mmdd hh:mm:ss.uuuuuu threadid file:line] msg
E0913 23:06:02.689066  9299 file.h:105] Failed to parse file modules/planning/conf/planning_config.pb.txt as text proto.
E0913 23:06:02.689764  9299 file.h:144] Failed to parse file modules/planning/conf/planning_config.pb.txt as binary proto.
F0913 23:06:02.689798  9299 std_planning.cc:78] Check failed: apollo::common::util::GetProtoFromFile(FLAGS_planning_config_file, &config_) failed to load planning config file modules/planning/conf/planning_config.pb.txt

I looked into the planning_config.proto file and it looks like this:

syntax = "proto2";

package apollo.planning;

import "modules/planning/proto/dp_poly_path_config.proto";
import "modules/planning/proto/dp_st_speed_config.proto";
import "modules/planning/proto/qp_spline_path_config.proto";
import "modules/planning/proto/qp_st_speed_config.proto";
import "modules/planning/proto/poly_st_speed_config.proto";
import "modules/planning/proto/navi_path_decider_config.proto";
import "modules/planning/proto/navi_speed_decider_config.proto";
import "modules/planning/proto/navi_obstacle_decider_config.proto";
import "modules/planning/proto/planner_open_space_config.proto";

enum TaskType {
  DP_POLY_PATH_OPTIMIZER = 0;
  DP_ST_SPEED_OPTIMIZER = 1;
  QP_SPLINE_PATH_OPTIMIZER = 2;
  QP_SPLINE_ST_SPEED_OPTIMIZER = 3;
  PATH_DECIDER = 4;
  SPEED_DECIDER = 5;
  POLY_ST_SPEED_OPTIMIZER = 6;
  NAVI_PATH_DECIDER = 7;
  NAVI_SPEED_DECIDER = 8;
  NAVI_OBSTACLE_DECIDER = 9;
};

message PathDeciderConfig {
  // place holder
}

message ScenarioConfig {
  enum ScenarioType {
    LANE_FOLLOW = 0;  // default scenario
    CHANGE_LANE = 1;
    SIDE_PASS = 2;  // go around an object when it blocks the road
    APPROACH = 3;  // approach to an intersection
    INTERSECTION_STOP_SIGN_FOUR_WAY = 4;
    INTERSECTION_STOP_SIGN_ONE_OR_TWO_WAY = 5;
    INTERSECTION_TRAFFIC_LIGHT_LEFT_TURN = 6;
    INTERSECTION_TRAFFIC_LIGHT_RIGHT_TURN = 7;
    INTERSECTION_TRAFFIC_LIGHT_GO_THROUGH = 8;
  }
  optional ScenarioType scenario_type = 1;

  message ScenarioTaskConfig {
    optional TaskType task = 1;
    oneof task_config {
      DpPolyPathConfig dp_poly_path_config = 2;
      DpStSpeedConfig dp_st_speed_config = 3;
      QpSplinePathConfig qp_spline_path_config = 4;
      QpStSpeedConfig qp_st_speed_config = 5;
      PolyStSpeedConfig poly_st_speed_config = 6;
      PathDeciderConfig path_decider_config = 7;
    }
  }
  repeated ScenarioTaskConfig scenario_task_config = 2;
}

message PlannerOnRoadConfig {
  // supported scenario types
  repeated ScenarioConfig.ScenarioType scenario_type = 1;
}

message PlannerNaviConfig {
  repeated TaskType task = 1;
  optional NaviPathDeciderConfig  navi_path_decider_config = 2;
  optional NaviSpeedDeciderConfig  navi_speed_decider_config = 3;
  optional NaviObstacleDeciderConfig  navi_obstacle_decider_config = 4;
}

enum PlannerType {
  RTK = 0;
  ONROAD = 1;  // expectation maximization
  OPENSPACE = 2; // open space planner
  NAVI = 3; // navigation planner
}

message RtkPlanningConfig {
  optional PlannerType planner_type = 1;
}

message StandardPlanningConfig {
  repeated PlannerType planner_type = 1; // supported planners
  optional PlannerOnRoadConfig planner_onroad_config = 2;
}

message NavigationPlanningConfig {
  repeated PlannerType planner_type = 1; // supported planners
  optional PlannerNaviConfig planner_navi_config = 4;
}

message PlanningConfig {
  optional PlannerType planner_type = 1 [deprecated=true];
  optional PlannerNaviConfig planner_navi_config = 2;
  oneof planning_config {
    RtkPlanningConfig rtk_planning_config = 3;
    StandardPlanningConfig standard_planning_config = 4;
    NavigationPlanningConfig navigation_planning_config = 5;
  } 

To me it seems like the config file can not be parsed as proto file because the PUBLIC_ROAD planner is not specified. Do I need to change the planning_config.proto file as well?

jmtao commented 5 years ago

@udeto this is the conf file for Apollo 5.0. You are still using Apollo 3.0? try the corresponding conf from 3.0 branch. https://github.com/ApolloAuto/apollo3/blob/master/modules/planning/conf/planning_config.pb.txt

lukasthede commented 5 years ago

I am using apollo 3.0 because I need the ROS interface to connect the CARLA simulator.

The Link does not work unfortunately. Screenshot from 2019-09-17 20-15-58

Where can I find the code for Aopllo 3.0?

jmtao commented 5 years ago

@udeto https://github.com/ApolloAuto/apollo/tree/r3.0.0

jmtao commented 5 years ago

Hi @udeto , hope our answer resolved your question. We will close the issue for now. If you have any additional question, please feel free to open a new issue. Our engineer team are more than happy to help that.

Thank you for supporting Apollo!

marcusvinicius178 commented 3 years ago

Hi @jmtao I am facing similar issue following this solution: https://github.com/ApolloAuto/apollo/issues/13650

My issue is here: https://github.com/ApolloAuto/apollo/issues/13763

I am using Apollo6.0, however and I wish to change the planners (FROM ROAD_PUBLIC to LATTICE) I changed the file planning_config.pb.txt: image

As I got any result after build the workspace I also changed the file planning_config.proto (from 1 to 3 in StandardPlanningConfig - line 340):

image

I am very interested in Switch different planners and Benchmark them to see the different trajectories generated for the same scenario. I really need this to conclude my master thesis. I would like to test the planners:

1 - PUBLIC_ROAD 2 - NAVI 3- OPENSPACE 4- LATTICE

Is it possible to change planners? How?

Thanks in advance