px4 seminar 02
TRANSCRIPT
![Page 2: PX4 Seminar 02](https://reader036.vdocuments.site/reader036/viewer/2022081804/55a6c00a1a28ab4d688b47c5/html5/thumbnails/2.jpg)
PX4 Autopilot• Independent, open-source, open-hardware autopilot
system oriented toward autonomous aircraft
• BSD License
• Started in 2009
• Be being developed and used at Computer Vision and Geometry Lab of ETH Zurich and supported by the Autonomous Systems Lab and the Automatic Control Laboratory
![Page 3: PX4 Seminar 02](https://reader036.vdocuments.site/reader036/viewer/2022081804/55a6c00a1a28ab4d688b47c5/html5/thumbnails/3.jpg)
Main Software Modules• PX4 Flight Stack
• Flight control modules (Controller, Attitude estimator, MAVLink and etc)
• PX4 Middleware
• Drivers, uORB
• PX4 ESC Firmware
• PX4 Bootloader
• Operating System
• NuttX OS
![Page 4: PX4 Seminar 02](https://reader036.vdocuments.site/reader036/viewer/2022081804/55a6c00a1a28ab4d688b47c5/html5/thumbnails/4.jpg)
![Page 5: PX4 Seminar 02](https://reader036.vdocuments.site/reader036/viewer/2022081804/55a6c00a1a28ab4d688b47c5/html5/thumbnails/5.jpg)
On-board Applications• System Applications
• mavlink – Sends and receives MAVLink messages via serial port
• sdlog2 – Logs system/flight data to the SD card
• tests – Test applications to test the system (during bringup and troubleshooting)
• top – Lists current processes and their CPU load
• uORB – Micro Object Request Broker - distributing information between other applications
• Drivers
• mkblctrl – Mikrokopter BLCTRL Driver
• esc_calib – ESC calibration tool
• fmu – Configures FMU GPIO pins
• gpio_led – GPIO LED driver
• gps – GPS receiver driver
• pwm – Command to set PWM update rates
• sensors – Sensor utility
• px4io – PX4IO driver
• uavcan – UAVCAN driver
![Page 6: PX4 Seminar 02](https://reader036.vdocuments.site/reader036/viewer/2022081804/55a6c00a1a28ab4d688b47c5/html5/thumbnails/6.jpg)
On-board Applications (cont’d)
• Flight Control Applications
• Flight Safety and Navigation
• commander – main flight safety state machine
• navigator – Mission, failsafe and RTL navigator
• Attitude and Position Estimators
• attitude_estimator_ekf – EKF-based attitude estimator
• ekf_att_pos_estimator – EKF-based attitude and position estimator (Paul Riseborough)
• position_estimator_inav – Inertial navigation position estimator
• Multirotor Attitude and Position Controllers
• mc_att_control – Multirotor attitude controller
• mc_pos_control – Multirotor position controller
• Fixedwing Attitude and Position Controllers
• fw_att_control – Fixed wing attitude controller
• fw_pos_control_l1 – Fixed wing position controller
• VTOL Attitude Controller
• vtol_att_control – VTOL attitude controller
![Page 7: PX4 Seminar 02](https://reader036.vdocuments.site/reader036/viewer/2022081804/55a6c00a1a28ab4d688b47c5/html5/thumbnails/7.jpg)
System Startup• The boot process of PX4
• /etc/init.d/rcS (https://github.com/PX4/Firmware/blob/master/ROMFS/px4fmu_common/init.d/rcS)
• /etc/rc.txt on the SD card (for advanced users)
• If /etc/rc.txt does not exist, set to autostart mode
• /etc/config.txt is executed if it exists
• Configuration to set the environment variables (https://pixhawk.org/dev/system_startup#configuration_variables)
• /etc/extras.txt is executed if it exists
• Start custom apps after the autostart process
• All scripts belonging to the autostart process (https://github.com/PX4/Firmware/tree/master/ROMFS/px4fmu_common/init.d)
![Page 8: PX4 Seminar 02](https://reader036.vdocuments.site/reader036/viewer/2022081804/55a6c00a1a28ab4d688b47c5/html5/thumbnails/8.jpg)
/etc/config.txt Example for Custom Model
# Generic Quadcopter + set VEHICLE_TYPE mc set MIXER FMU_quad_+ # PX4IO PWM output will be used by default set PWM_OUT 1234 # Change parameters for the first 4 outputs set PWM_RATE 400 # Set PWM rate to 400 Hz for better performance set PWM_DISARMED 900 # Motors should stop at this PWM value set PWM_MIN 1100 # Motors should spin at low, idle speed at this PWM value set PWM_MAX 1900 # Motors should spin at max speed at this PWM value
![Page 9: PX4 Seminar 02](https://reader036.vdocuments.site/reader036/viewer/2022081804/55a6c00a1a28ab4d688b47c5/html5/thumbnails/9.jpg)
NuttShell• An embedded equivalent to bash and similar Unix
shells
• It is used to start all on-board applications and manage a executed process
• It interacts with the user over a serial port (FMU system’s UARTS or USB)
• http://nuttx.org/doku.php?id=documentation:nuttshell
![Page 10: PX4 Seminar 02](https://reader036.vdocuments.site/reader036/viewer/2022081804/55a6c00a1a28ab4d688b47c5/html5/thumbnails/10.jpg)
Makefile• Default available targets
• archives - Build the NuttX RTOS archives that are used by the firmware build.
• all - Build all firmware configs: aerocore_default px4fmu-v1_default px4fmu-v2_default px4fmu-v2_multiplatform px4fmu-v2_test px4io-v1_default px4io-v2_default. A limited set of configs can be built with CONFIGS=<list-of-configs>
• aerocore_default - Build just the aerocore_default firmware configuration.
• px4fmu-v1_default - Build just the px4fmu-v1_default firmware configuration.
• px4fmu-v2_default - Build just the px4fmu-v2_default firmware configuration.
• px4fmu-v2_multiplatform - Build just the px4fmu-v2_multiplatform firmware configuration.
• px4fmu-v2_test - Build just the px4fmu-v2_test firmware configuration.
• px4io-v1_default - Build just the px4io-v1_default firmware configuration.
• px4io-v2_default - Build just the px4io-v2_default firmware configuration.
• clean - Remove all firmware build pieces.
• distclean - Remove all compilation products, including NuttX RTOS archives.
• upload - When exactly one config is being built, add this target to upload the firmware to the board when the build is complete. Not supported for all configurations.
• testbuild - Perform a complete clean build of the entire tree.
![Page 11: PX4 Seminar 02](https://reader036.vdocuments.site/reader036/viewer/2022081804/55a6c00a1a28ab4d688b47c5/html5/thumbnails/11.jpg)
Additional Rule for Makefile
• /makefiles/*.mk
• Details on /makefiles/README.txt (https://github.com/PX4/Firmware/blob/master/makefiles/README.txt)
![Page 12: PX4 Seminar 02](https://reader036.vdocuments.site/reader036/viewer/2022081804/55a6c00a1a28ab4d688b47c5/html5/thumbnails/12.jpg)
Reference• http://en.wikipedia.org/wiki/PX4_autopilot
• https://pixhawk.org/start
• https://pixhawk.org/firmware/source_code
• https://github.com/PX4
• https://pixhawk.org/dev/system_startup
• https://pixhawk.org/firmware/apps/start
• https://pixhawk.org/firmware/apps/nsh