In the implementation of Jmavsim and Qgroundcontrol joint simulation on the basis of code DIY is the ultimate goal of PX4 development, which is just stepping into the door of PX4.
First Application Tutorial (Hello Sky) has been introduced in detail, this article only as my own learning or operation record! *
Rename the path Firmware/src/examples/px4_simple_app (such as PX4_SIMPLE_APP2) and back up.
Create a new path: Firmware/src/examples/px4_simple_app
Create a new C file and name it px4_simple_app.c
#include <px4_log.h>
__EXPORT int px4_simple_app_main(int argc, char *argv[]);
int px4_simple_app_main(int argc, char *argv[]){
PX4_INFO("Hello Sky!----liaosin");
return OK;
}
px4_add_module(
MODULE examples__px4_simple_app
MAIN px4_simple_app
STACK_MAIN 2000
SRCS
px4_simple_app.c
DEPENDS
platforms__common
)
Registering a new C file
1) Locate the CMake file corresponding to the flight Control Development Board:
Jmavsim Simulator:firmware/cmake/configs/posix_sitl_default.cmake
Pixhawk V1/2: Firmware/cmake/configs/nuttx_px4fmu-v2_default.cmake
2) Open the Change CMake file and add * Examples/px4_simple_app *
3) Compile C file:
Jmavsim Simulator:make Posix_sitl_default Jmavsim
Pixhawk V1/2: Make Px4fmu-v2_default
With Jmavsim emulation, open terminal
>>cd ~
>>cd Firmware
>>make posix_sitl_default jmavsim
>>commander takeoff #四旋翼起飞
>>px4_simple_app
The terminal will appear as follows:
- If the Qgroundcontrol is turned on during emulation, the accepted UAV sensor output data is downloaded in the Qgroundcontrol-analyze.
First Application Tutorial (Hello Sky)