This project provides Python bindings for the Apollo modules' protobufs, enabling seamless integration and usage of Apollo’s protobuf definitions in Python.
pip install apollo_modules==[version] # Supported versions: see release https://pypi.org/project/apollo-modules/
From apollo 8.0, the structure has been changed!
git clone -b [version] https://github.com/MingfeiCheng/ApolloPyProto.git
cd ApolloPyProto
pip install -e .
To verify the installation, open a Python shell and run the following:
python
>>> import apollo_modules
>>> from apollo_modules.modules.common_msgs.planning_msgs.planning_pb2 import ADCTrajectory
If there are no errors, the installation was successful, and the package is ready to use.
Here’s an example of importing the planning_pb2
protobuf used in Apollo’s planning module:
from apollo_modules.modules.common_msgs.planning_msgs.planning_pb2 import ADCTrajectory
We provide a shell script to automatically generate the Python versions of the protobufs from Apollo’s modules. Use the following command:
bash proto_generate.sh /path/to/apollo_root /path/to/output