First Application Tutorial (Hello Sky)

Source: Internet
Author: User

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;
}

    • The following three must be consistent: 1) path name xxx;2) c file name xxx;3) c file The main function must be Xxx_main *

    • Create a new CMake definition file and name it CMakeLists.txt

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.