ApolloAuto / apollo

An open autonomous driving platform
Apache License 2.0
25.06k stars 9.68k forks source link

Best approach to selectively enable or disable modules #13439

Open jpcloud1577 opened 3 years ago

jpcloud1577 commented 3 years ago

I would like to know what is the best way to selectively enable or disable modules so only required modules are built in a given configuration. For ex: I need to disable LIDAR module on a test vehicle for Level-2 functionality. How can I achieve this safely configure the build without breaking any other modules /build

ntutangyun commented 3 years ago

I think the best approach is probably just don't ever change the code of the modules you wish to disable.

and by right it will only be built once.

storypku commented 3 years ago

Hi @jpcloud1577 , you can build individual modules by running ./apollo.sh build <module-name1> <module2>. For example, to build the planning and CyberRT modules only, run ./apollo.sh build_opt_gpu cyber planning.

However, in your case, there is no independent LiDAR module (it was under the perception and drivers modules), so you can't build it that way.

If you know Bazel well, you can use bazel build command to refine and build the targets you need. For example, ./apollo.sh build_opt_gpu cyber planning on a GPU-capable machine is equivalent to the following command:

bazel build --config=opt --config=gpu //cyber/...  //modules/planning/...
jpcloud1577 commented 3 years ago

Thank you. I probably need to rephrase my question. I know how to selectively build the modules like you explained, but I am more interested in building everything in Apollo, but leave out those not required for the vehicle build I am using. In my case, as an example, I am not using Lidar as one of the sensors, but it is only using Camera, Radar and Ultrasnic sensors. Hence sensor fusion should only take sensors onboard and do not care about Lidar. So, I would like to know how to configure Apollo for a suite of sensors I am using and build only those shared libraries I need. Also, I have my own planning module and do not want built in Apollo planning module in my executable/bin. This is to reduce the overall footprint of the software that will be running on a smaller target with minimal resources compared to a typical level-4/5 platform. Please suggest

storypku commented 3 years ago

Thank you. I probably need to rephrase my question. I know how to selectively build the modules like you explained, but I am more interested in building everything in Apollo, but leave out those not required for the vehicle build I am using. In my case, as an example, I am not using Lidar as one of the sensors, but it is only using Camera, Radar and Ultrasnic sensors. Hence sensor fusion should only take sensors onboard and do not care about Lidar. So, I would like to know how to configure Apollo for a suite of sensors I am using and build only those shared libraries I need.

Sorry, Apollo builds hasn't support this level of flexibility yet. As I mentioned, you can use native Bazel rules if you want to customize which target(s) you want to build to save some compilation/build time.

@jeroldchen Please help with sensor fusion related part.

Also, I have my own planning module and do not want built in Apollo planning module in my executable/bin. This is to reduce the overall footprint of the software that will be running on a smaller target with minimal resources compared to a typical level-4/5 platform. Please suggest

I think release build for Apollo (See ./apollo.sh release, under development) may be what you want. Some Familiarity with Bazel and Apollo is required to be able to use you own planning module.