mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
UAVCAN - CAN bus for UAV
Reference implementation of the UAVCAN protocol stack.
Usage
Please refer to http://uavcan.org/Implementations.
Installation
Posix
Prerequisites:
- CMake v2.8+
- Python 3.2+ or Python 2.7
- Any C++03 or C++11 (preferred) compiler
Installation:
mkdir build
cd build
cmake .. # Optionally, set the build type: -DCMAKE_BUILD_TYPE=Release (default is RelWithDebInfo)
make
make install
The make command will generate the C++ headers for all standard DSDL types and build the static library for libuavcan.
The make install command will install the following components:
- Libuavcan library.
- All standard DSDL type definitions.
- All generated headers for the standard DSDL types.
- Pyuavcan package (it will be installed for the default Python version).
- Libuavcan DSDL compiler -
libuavcan_dsdlc(use--helpto get usage info). - Linux only: Linux drivers for libuavcan (see
libuavcan_drivers/linux/).
Microcontrollers
No installation required.
Using non-make build system
- Invoke the libuavcan DSDL compiler
libuavcan_dsdlcto generate C++ headers, or include the headers directly from the system directories if they are installed on your host system (described above). - Add the source files and include directories into your project:
- Libuavcan source files.
- Libuavcan include directory.
- Directory containing the hierarchy of generated headers.
- Source files of the libuavcan driver for your platform (refer to the directory
libuavcan_drivers/). - Include directories of the libuavcan driver for your platform.
- Build.
Using make
It's much easier.
- Include
libuavcan/include.mk. - Use the variables
LIBUAVCAN_*to retrieve the list of source files and include directories. - Use the variable
LIBUAVCAN_DSDLCto invoke the DSDL compiler to generate headers (i.e. add a make target for that). Alternatively, invoke the compiler by hand, or include the headers directly from the system directories if they are installed on your host system (described above). - Use the make script for your platform driver. Normally it's
libuavcan_drivers/<PLATFORM>/driver/include.mk. Refer to the relevant examples to your platform to see how exactly.
Library development
Despite the fact that the library itself can be used on virtually any platform that has a standard-compliant C++03 or C++11 compiler, the library development process assumes that the host OS is Linux.
Prerequisites:
- Google test library for C++ - gtest
- Static analysis tool for C++ - cppcheck
- C++03 and C++11 capable compiler with GCC-like interface (e.g. GCC, Clang)
Building the debug version, running the unit tests and the static analyzer:
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Debug
make # This may take a lot of time to build multiple versions and run all tests
Description
Languages
C++
51.2%
C
38.5%
CMake
4.7%
Python
3.9%
Shell
1.3%
Other
0.1%