CodeLabs
  • Introduction
  • Cities
    • Cover
    • Summary
    • Introduction
      • Getting Started
      • Resources
      • Naming Convention
    • Caracol
      • Architecture
        • Intel
        • Operating Systems
        • Hardware Platform
        • Field Requirements
        • Software Development
        • Video Conference Station
          • Applications
          • Entertainment System
            • Services
              • Graphics
              • Video
              • Camera
              • Text To Speech
              • Speech To Text
              • Photography
              • Gaming
                • Super Nintendo Emulators
                • Super Nintendo ROMs
              • Twitter
              • Keyboard
              • Google Drive
              • WiFi
            • Modules
            • Tbd
        • Functionality
        • Bill Of Materials
        • Open Questions
        • Future
    • Chacmultun
      • JHD1313M1
        • Background
          • Inter-Integrated Circuit
          • Linux I2C Subsystem
        • Device Drivers
          • User Space Library UPM
          • User Space Library MRAA
          • User Space I2C Library
          • Kernel Space I2C Driver
    • Chicanna
      • OpenCV
        • Face Recognition
        • Web Streaming
    • Chichen Itza
      • Audio
        • Advanced Linux Sound Architecture
        • PortAudio
        • PyAudio
          • Record
          • Play
      • Text To Speech
        • eSpeak
          • pyttsx
        • VoiceRss
          • VoiceRss Text To Speech Python SDK
      • Speech To Text
        • CMU Sphinx
          • Sphinx Knowledge Base Tool
          • PocketSphinx
          • PyAudio
        • SpeechRecognition
    • Coba
      • Linux Kernel Source Code
        • Git Source Code Management
      • Linux Kernel Development Process
        • A Guide To The Linux Kernel Development Process
        • Challenge
      • Linux Kernel Compilation
      • Linux Kernel Modules
      • Linux Kernel Build System
        • Compilation Kernel Object
        • Compilation Built-In
      • Linux Kernel Patch
        • Patchset
      • Linux Kernel Developer
      • Learn More
    • Dos Pilas
    • Dzibilchaltun
    • Edzna
      • MQ Telemetry Transport
        • MQTT Broker
      • Home Assistant
        • Setup
        • Default Configuration
        • Hello
      • Home Automation
        • Device
          • Light ESP8266
          • Intel Edison
        • Server
          • MQTT
            • Light
            • Sensor
            • Binary Sensor
            • Alarm
          • Dweet
          • Weather
          • Binary Sensor
          • Telegram
          • Camera
          • Automation
      • Shack Automation
        • Configuration Yaml
    • Ek Balam
      • Google Cloud Platform
        • Google API Keys
        • Google Application Default Credentials
      • Google Cloud Translation API
      • Google Cloud Vision API
      • Google Cloud Speech
    • Hochob
      • Introduction
      • Accounts
      • Areas
        • Naming Conventions
      • Digital Media Players
        • Chromecast
      • Keypads
      • Mobile Device
      • Amikoo
        • Architecture
          • Hardware Components
            • Intel® Edison Breakout Board
        • Amikoo
          • Setup
          • Git Repositories
          • Audio
          • Main Intel Edison
          • Main x86
        • Sandbox
          • Tbd
      • Server
        • Setup
          • Root
          • PulseAudio
        • Architecture
        • Media
        • Services
          • Automation
            • Home Assistant
              • Setup
          • Calendar
          • Camera
          • Communications
          • Games
            • Loteria Mexicana
            • Caras Y Gestos
            • Sopa De Letras
          • Image
          • Institution
          • Keypad
          • Messaging
          • Motion
          • Robot
          • Sound
            • Play
            • Speech Synthetizer
          • Stream
          • Usb
          • Survey
        • Applications
          • Captain Maya Lands
          • Southern Maya Highlands
          • Amikoo Maya Lands
          • Central Maya Lowlands
          • Northern Maya Lowlands
          • Console Maya Lands
          • Media Maya Lands
          • Calendar Maya Lands
          • Tradition Maya Lands
          • Techie Maya Lands
          • NohochTata Maya Lands
      • Stations
      • Architecture
      • Release Notes
        • v0.1
        • v0.2
    • Hormiguero
    • Kaminaljuyu
      • WRI Workshop
        • Environmental Protection Agency
      • Arquitecture
        • Bill Of Materials
      • Intel
    • Kanki
      • Device
      • Gateway
    • Kinich KaK Moo
    • Kohunlich
    • La Ruta Puuc
    • Mayapan
    • Mixco Viejo
    • Muyil
    • Palenque
    • Qumarkaj
      • Amazon
      • Amazon Echo
        • Lifx
        • IFTTT
      • Amazon Alexa
        • Alexa Skills Kit
          • Training: Developing Alexa Skills - Hello, Alexa!
          • Training: Alexa - A Free Introduction
          • Projects
            • Intel GDC Visitor Center
              • Cloudy
              • Geek
              • Trivia
              • Kit
            • Voice Control Intel Edison
        • Alexa Voice Service
          • Intel Edison
    • Seibal
    • Tabasqueno
    • Tikal
      • Mexican Red Cross
      • Emergency Medical Services
        • Prehospital Care Strategies
      • Intel
      • Bitalino
      • My Signals
      • Architecture
        • Objectives
    • Tulum
      • Introduction
      • Device
        • Development Board
        • Telegram Bot
        • Bootup
        • Text Editors
        • Setup
        • Main
        • IoT101 Inc
        • Mqtt Clients
        • Sensors
      • Server
        • Setup
        • Dashboard
        • Mqtt Broker
      • Challenge
    • Uxmal
    • Xcambo
    • Xpuhil
    • Xunantunich
    • Sandbox
      • Text To Speech
      • Face Recognition Web Streaming
      • Web Server Flask
      • Speech To Text
      • Image Webpage Flask
      • Audio Capture Playback
      • Image Capture OpenCV
    • Tbd
      • Tbd
      • Linux Kernel Architecture
      • Linux Kernel Device Drivers
      • Tbd
  • Gods
    • Acat
      • Node-RED
        • Installation
          • General
          • Base
          • Npm Packages
          • Node-RED Packages
        • Autostart
      • Projects
        • GPIO
        • MQTT
        • Intel GDC Visitor Center
      • Sandbox
    • Ah Puch
      • Recon Instruments
        • ReconJet
          • Get Started
        • ReconEngage
        • Uplink
        • Intel Developer Zone
          • Recon Dev Kit for Jetâ„¢
      • Bicycles
    • Akna
      • Hardware
        • Intel Edison
        • Sphero
        • Bluetooth Dongle
      • Software
        • Javascript
        • Cylon.js
          • Cylon.js Intel Edison
          • Cylon.js Intel Edison Sphero
            • Examples
        • Sphero Linux API
    • Alom
    • Bacab
      • Getting Started
        • Inventory
        • Accounts
        • Software
      • Proof Of Concepts
        • Doorbell
    • Bitol
      • Drone Software Development Environment
        • PX4
        • JMAVSim
        • Ardupilot
        • SITL Simulator
        • DroneKit
        • QGroundControl
        • MAVLink
        • OpenCV
        • Git Source Code Management
      • Drone Solution Architect
        • Companies
      • Dronecode Project
      • Base Drone Solution
        • Flight Controller Hardware
          • PixHawk
          • Intel® Aero Ready to Fly Drone
          • Emlid
          • Erle Brain
        • Flight Controller Operating System
        • Autopilot
          • Px4
            • Architecture
              • NuttX
              • DriverFramework
            • Shell
          • Ardupilot
          • Software In The Loop
            • jMAVSim
            • DroneKit SITL
        • Communications
          • Mavlink
            • PyMAVLink
        • Ground Control Station
          • QGroundControl
        • Developer APIs
      • Hybrid Drone Solution
      • Autonomous Drone Solution
      • Drone Solutions
        • Erle Robotics
        • Emlid
      • Training
        • Drone Solution Architect
          • Demos
            • Ka’an
            • Múuyal
            • lik’
            • Chak iik’
    • Chaac
    • Bolon Ts'akab
    • Buluc Chabtan
      • Challenge
    • Chaac Uayab Xoc
    • Cacoch
      • Background
        • Open Source
        • Do It Yourself Communities
      • The Project
        • History
        • Career Profile
        • Education Strategy
        • Courses
        • Infrastructure
Powered by GitBook
On this page
  • Shell
  • Command Mavlink
  • Command Sensors
  1. Gods
  2. Bitol
  3. Base Drone Solution
  4. Autopilot
  5. Px4

Shell

Shell

Command Mavlink

pxh> mavlink help

### Description
This module implements the MAVLink protocol, which can be used on a Serial link or UDP network connection.
It communicates with the system via uORB: some messages are directly handled in the module (eg. mission
protocol), others are published via uORB (eg. vehicle_command).

Streams are used to send periodic messages with a specific rate, such as the vehicle attitude.
When starting the mavlink instance, a mode can be specified, which defines the set of enabled streams with their rates.
For a running instance, streams can be configured via `mavlink stream` command.

There can be multiple independent instances of the module, each connected to one serial device or network port.

### Implementation
The implementation uses 2 threads, a sending and a receiving thread. The sender runs at a fixed rate and dynamically
reduces the rates of the streams if the combined bandwidth is higher than the configured rate (`-r`) or the
physical link becomes saturated. This can be checked with `mavlink status`, see if `rate mult` is less than 1.

**Careful**: some of the data is accessed and modified from both threads, so when changing code or extend the
functionality, this needs to be take into account, in order to avoid race conditions and corrupt data.

### Examples
Start mavlink on ttyS1 serial with baudrate 921600 and maximum sending rate of 80kB/s:
$ mavlink start -d /dev/ttyS1 -b 921600 -m onboard -r 80000

Start mavlink on UDP port 14556 and enable the HIGHRES_IMU message with 50Hz:
$ mavlink start -u 14556 -r 1000000
$ mavlink stream -u 14556 -s HIGHRES_IMU -r 50
...

Command Sensors

pxh> sensors help

### Description
The sensors module is central to the whole system. It takes low-level output from drivers, turns
it into a more usable form, and publishes it for the rest of the system.

The provided functionality includes:
- Read the output from the sensor drivers (`sensor_gyro`, etc.).
  If there are multiple of the same type, do voting and failover handling.
  Then apply the board rotation and temperature calibration (if enabled). And finally publish the data; one of the
  topics is `sensor_combined`, used by many parts of the system.
- Do RC channel mapping: read the raw input channels (`input_rc`), then apply the calibration, map the RC channels
  to the configured channels & mode switches, low-pass filter, and then publish as `rc_channels` and
  `manual_control_setpoint`.
- Read the output from the ADC driver (via ioctl interface) and publish `battery_status`.
- Make sure the sensor drivers get the updated calibration parameters (scale & offset) when the parameters change or
  on startup. The sensor drivers use the ioctl interface for parameter updates. For this to work properly, the
  sensor drivers must already be running when `sensors` is started.
- Do preflight sensor consistency checks and publish the `sensor_preflight` topic.

### Implementation
It runs in its own thread and polls on the currently selected gyro topic.

Usage: sensors <command> [arguments...]
 Commands:

   start
     [-h]        Start in HIL mode

   stop

   status        print status info
pxh> sensors status
INFO  [sensors] gyro status:
INFO  [lib__ecl] validator: best: 0, prev best: 0, failsafe: NO (0 events)
INFO  [lib__ecl] sensor #0, prio: 100, state: OK
INFO  [lib__ecl]     val:   0.0039, lp:  -0.0002 mean dev:   0.0000 RMS:   0.0065 conf:   1.0000
INFO  [lib__ecl]     val:   0.0048, lp:  -0.0004 mean dev:   0.0000 RMS:   0.0065 conf:   1.0000
INFO  [lib__ecl]     val:  -0.0002, lp:   0.0005 mean dev:  -0.0000 RMS:   0.0065 conf:   1.0000
INFO  [sensors] accel status:
INFO  [lib__ecl] validator: best: 0, prev best: 0, failsafe: NO (0 events)
INFO  [lib__ecl] sensor #0, prio: 100, state: OK
INFO  [lib__ecl]     val:  -0.0219, lp:  -0.0011 mean dev:   0.0000 RMS:   0.0327 conf:   1.0000
INFO  [lib__ecl]     val:  -0.0463, lp:  -0.0001 mean dev:   0.0001 RMS:   0.0326 conf:   1.0000
INFO  [lib__ecl]     val:  -9.8411, lp:  -9.8098 mean dev:  -0.0001 RMS:   0.0327 conf:   1.0000
INFO  [lib__ecl] sensor #1, prio: 75, state: OK
INFO  [lib__ecl]     val:  -0.1093, lp:   0.0007 mean dev:  -0.0002 RMS:   0.0499 conf:   1.0000
INFO  [lib__ecl]     val:  -0.0478, lp:  -0.0015 mean dev:   0.0001 RMS:   0.0505 conf:   1.0000
INFO  [lib__ecl]     val:  -9.7975, lp:  -9.8113 mean dev:  -0.0001 RMS:   0.0503 conf:   1.0000
INFO  [sensors] mag status:
INFO  [lib__ecl] validator: best: 0, prev best: 0, failsafe: NO (0 events)
INFO  [lib__ecl] sensor #0, prio: 50, state: OK
INFO  [lib__ecl]     val:   0.8874, lp:   0.8977 mean dev:  -0.0000 RMS:   0.0050 conf:   1.0000
INFO  [lib__ecl]     val:   0.0264, lp:   0.0331 mean dev:   0.0000 RMS:   0.0050 conf:   1.0000
INFO  [lib__ecl]     val:   1.7816, lp:   1.7868 mean dev:  -0.0000 RMS:   0.0050 conf:   1.0000
INFO  [sensors] baro status:
INFO  [lib__ecl] validator: best: 0, prev best: 0, failsafe: NO (0 events)
INFO  [lib__ecl] sensor #0, prio: 75, state: OK
INFO  [lib__ecl]     val: 487.8885, lp: 487.9854 mean dev:  -0.0009 RMS:   0.1011 conf:   1.0000
INFO  [lib__ecl]     val:   0.0000, lp:   0.0000 mean dev:   0.0000 RMS:   0.0000 conf:   1.0000
INFO  [lib__ecl]     val:   0.0000, lp:   0.0000 mean dev:   0.0000 RMS:   0.0000 conf:   1.0000
INFO  [sensors] Temperature Compensation:
INFO  [sensors]  gyro: enabled: 0
INFO  [sensors]  accel: enabled: 0
INFO  [sensors]  baro: enabled: 0
INFO  [sensors] Airspeed status:
INFO  [lib__ecl]     no data
pxh>
user@workstation:~/src/Firmware$ cat /home/user/src/Firmware/posix-configs/SITL/init/ekf2/iris
uorb start
param load
dataman start
param set BAT_N_CELLS 3
param set CAL_ACC0_ID 1376264
param set CAL_ACC0_XOFF 0.01
param set CAL_ACC0_XSCALE 1.01
param set CAL_ACC0_YOFF -0.01
param set CAL_ACC0_YSCALE 1.01
param set CAL_ACC0_ZOFF 0.01
param set CAL_ACC0_ZSCALE 1.01
param set CAL_ACC1_ID 1310728
param set CAL_ACC1_XOFF 0.01
param set CAL_GYRO0_ID 2293768
param set CAL_GYRO0_XOFF 0.01
param set CAL_MAG0_ID 196616
param set CAL_MAG0_XOFF 0.01
param set COM_DISARM_LAND 3
param set COM_OBL_ACT 2
param set COM_OBL_RC_ACT 0
param set COM_OF_LOSS_T 5
param set COM_RC_IN_MODE 1
param set EKF2_AID_MASK 1
param set EKF2_ANGERR_INIT 0.01
param set EKF2_GBIAS_INIT 0.01
param set EKF2_HGT_MODE 0
param set EKF2_MAG_TYPE 1
param set MAV_TYPE 2
param set MC_PITCH_P 6
param set MC_PITCHRATE_P 0.2
param set MC_ROLL_P 6
param set MC_ROLLRATE_P 0.2
param set MIS_TAKEOFF_ALT 2.5
param set MPC_HOLD_MAX_Z 2.0
param set MPC_Z_VEL_I 0.15
param set MPC_Z_VEL_P 0.6
param set NAV_ACC_RAD 2.0
param set NAV_DLL_ACT 2
param set RTL_DESCEND_ALT 5.0
param set RTL_LAND_DELAY 5
param set RTL_RETURN_ALT 30.0
param set SENS_BOARD_ROT 0
param set SENS_BOARD_X_OFF 0.000001
param set SYS_AUTOSTART 4010
param set SYS_MC_EST_GROUP 2
param set SYS_RESTART_TYPE 2
replay tryapplyparams
simulator start -s
tone_alarm start
gyrosim start
accelsim start
barosim start
adcsim start
gpssim start
pwm_out_sim mode_pwm
sensors start
commander start
land_detector start multicopter
navigator start
ekf2 start
mc_pos_control start
mc_att_control start
mixer load /dev/pwm_output0 ROMFS/px4fmu_common/mixers/quad_dc.main.mix
mavlink start -x -u 14556 -r 4000000
mavlink start -x -u 14557 -r 4000000 -m onboard -o 14540
mavlink stream -r 50 -s POSITION_TARGET_LOCAL_NED -u 14556
mavlink stream -r 50 -s LOCAL_POSITION_NED -u 14556
mavlink stream -r 50 -s GLOBAL_POSITION_INT -u 14556
mavlink stream -r 50 -s ATTITUDE -u 14556
mavlink stream -r 50 -s ATTITUDE_QUATERNION -u 14556
mavlink stream -r 50 -s ATTITUDE_TARGET -u 14556
mavlink stream -r 50 -s SERVO_OUTPUT_RAW_0 -u 14556
mavlink stream -r 20 -s RC_CHANNELS -u 14556
mavlink stream -r 250 -s HIGHRES_IMU -u 14556
mavlink stream -r 10 -s OPTICAL_FLOW_RAD -u 14556
logger start -e -t
mavlink boot_complete
replay trystart
user@workstation:~/src/Firmware$
PreviousDriverFrameworkNextArdupilot

Last updated 7 years ago