Commit Graph

23150 Commits

Author SHA1 Message Date
Peter Duerr 5be23060e7 Fix resource leaks identified by cppcheck
* Where possible rearrange error checks to avoid branching
* Otherwise add missing `fclose`, `close`, `px4_close` calls before return
2017-08-07 22:05:17 +02:00
Vicente Monge 0a61e9b279 micro RTPS CMakeLists.txt identation 2017-08-07 12:00:35 +02:00
Vicente Monge a93174dee4 Fix for manual/automatic micro RTPS bridge generation 2017-08-07 12:00:35 +02:00
Beat Küng 4ee9cb2e2f px4airframes markdown: always use '/' for path separation
Because it's an URL and os.path.join() will use '\' on windows.
2017-08-07 11:12:51 +02:00
Vicente Monge d1e39ed9e0 Added link to documentation and suppress local doc 2017-08-07 09:46:56 +02:00
Lorenz Meier 490f40bee1 Sensors: Use temperature for airspeed validation to avoid false positives for high-performance airspeed sensors
This is required to enable new high-performance sensors which otherwise would provide incorrect readings.
2017-08-06 20:52:37 +02:00
Lorenz Meier 45f2a52a7d Sensor startup: Simplify and fix Pixhawk 2.1
This change simplifies the sensor startup and fixes the detection of airspeed sensors on Pixhawk 2.1
2017-08-06 20:52:23 +02:00
Sander Smeets c81dd46b02 land detector VTOL inherit MC maybe_landed (#7738)
* maybe_landed state for VTOL inherited from MC
* set correct land detector for SITL
2017-08-06 10:02:56 -04:00
David Sidrane 102003c664 rc.sensors:Use HW type to refine startup / deprecate mpu9250 on PixhawkMini
Using the hwvercmp on FMUv2 HW derivatives built with px4fmu_v3_default
   to ues a more targeted startup approach:

  1) Detect V3 and V2M

  2) On V3 use the external mpu9250 to further discriminate between 2.0
     and 2.1. Then only start the devices that are on that version of
     the board.

 3) Due to HW errata on PixhawkMini deprecate mpu9250.
     The mpu9250 will not start reliably on the PixhawkMini
     Since we have an ICM20608 and an External Mag the
     mpu9250 is not to be used.
2017-08-05 19:26:20 +02:00
David Sidrane ed74530da8 mpu9250:More cleanup 2017-08-05 19:26:20 +02:00
David Sidrane 5bb084408d bmi160_main:Make the internal interface conditional on PX4_SPIDEV_BMI
px4fmuv2 had PX4_SPIDEV_BMI defined, for the v3 cmake, but never
   provided a Chip select decoded by PX4_SPIDEV_BMI. PX4_SPIDEV_BMI
   has been removed from V2, but PX4_SPIDEV_EXT_BMI still remains
   and has a chip select assigned to it.
2017-08-05 19:26:20 +02:00
David Sidrane 43843b753d px4fmu-v2, px4fmu-v3:Restruture SPI Selects and DRDY
The removes the alias so it is clear what bus and port bit
    is associated with as CS or DRDY signal.

    This becomes important when varients of V2 a) use the CS on differnt
    busses or b) swap a RDY (in) for a CS (out). In both cases,
    a CS on once buss, can back feed and cause sensor reset to not be
    able to turn off the power if all the pins are not tunered
    off
2017-08-05 19:26:20 +02:00
David Sidrane d58a802eaa px4fmu-v2:Use versioning API to only change a GPIO for pixhawkmini
Pixhawk mini has reused the GPIO_SPI_CS_EXT1 signal that was associated
   with SPI4. We can not in good faith assert a CS on a bus wer are not resetting.
   So we must do this only on HW_VER_FMUV2MIN
2017-08-05 19:26:20 +02:00
David Sidrane 553c649252 px4fmu-v2:Init GPIO_VDD_3V3_SENSORS_EN off at reset
Insure a 0.0 voltage initial condition on VDD_3V3_SENSORS
  By starting the GPIO_VDD_3V3_SENSORS_EN, low and deferring
  the GPIO init of the slave selects and drdy signals until
  board_app_initialize. We get ~ 80 ms of power off time
  with 0.00 voltage applied to the sensors.
2017-08-05 19:26:20 +02:00
David Sidrane 60ce1bc5c5 px4fmu-v2:Add GPIO_VDD_USB_VALID and initalize it 2017-08-05 19:26:20 +02:00
David Sidrane 5fd8ef1055 px4fmu-v2:Insure the discharge of the pins PWM pins on rest.
On resets invoked from system (not boot) insure we establish a low
  output state (discharge the pins) on PWM pins before they become
  inputs.
2017-08-05 19:26:20 +02:00
David Sidrane 4832ad3191 ver:Add support for HW versioning
1) Add hwtypecmp command to allow rc to further enumerate PX4FMU_V2
      for sub types of 'V2' -FMUv2  'V2M' PixhawkMini, 'V30' Cube

   2) Extend hw to report to display
      HW type
      HW version
      HW revision
2017-08-05 19:26:20 +02:00
David Sidrane afb01d015e px4fmu-v2:Use simple HW versioning API to differentiate V2 variant at runtime.
There are several boards that share the px4fmu-v2 build as px4fmu-v3 build.

   It was initially envisioned, that the build would be binary compatable and
   the RC script would probe different sensors and determine at runtime the
   HW type. Unfortunately, a failed sensor, can result in mis-detection
   of the HW and result in an improper start up and not detect the HW
   failure.

   All these boards's bootloader report board type as px4fmu-v2.
   This precludes and automated selection of the correct fw if it
   had been built, by a different build i.e. px4fmu-cube etc.

   We need a way to deal with the slight differences in HW that effect
   the operations of drivers and board level functions that are different
   from the FMUv2 pinout and bus utilization.

   1) FMUv3 AKA Cube 2.0 and Cube 2.1 Bothe I2C busses are external.
      This effected the mag on GPS2 not reporting Internal and
      having the wrong rotation applied.

   2) FMUv3 does not performa a SPI buss reset correctly.
      FMUv2 provides a SPI1 buss reset. But FMUv3 is on
      SPI4. To complicate matters the CS cross bus
      boundries.

   3) PixhawkMini reused a signal that was associated with SPI4
      as a SPI1 ready signal.

   Based on hardware differnce in the use of PB4 and PB12 this code
   detects: FMUv2,  the Cube, and PixhawkMini and provides the
   simple common API for retriving the type, version and revision.

   On FmuV5 this same API will be used.
2017-08-05 19:26:20 +02:00
David Sidrane dfdb61d2a7 board_common:Add support for simple hardware versioning
Define methods to get:
    1) The sub type of the hardware as a string.
    2) The version as an integer
    3) The revision as an integer
2017-08-05 19:26:20 +02:00
David Sidrane c8bd60bef8 Mpu9250:Allow internal reset to complete, when started from VDD of 0V
Per the data sheet: Start-up time for register read/write from power-up is
   Typically 11 ms and the Maximum is 100 ms.

   It seems the power up reset is only triggered at VDD < 150 mV. So the
   symptom reported: Failure is only happening after a long power down is
   consistent with VDD not dropping below 150 mV, therefore not generating
   a POR and being ready to be written with out delay.

  This fix adds a delay of 110 ms to ensure the reset has ended with some.
  margin.
2017-08-05 19:26:20 +02:00
Lorenz Meier d10116e54a Update MAVLink version 2017-08-05 16:00:00 +02:00
José Roberto de Souza 1a3315e397 msg: Fix build in python3
We can afford a slower performance in this parsers with python2 to
keep compability with python3.
http://sebastianraschka.com/Articles/2014_python_2_3_key_diff.html#xrange
2017-08-05 11:04:44 +02:00
David Sidrane 5e0a25c9c7 nuttx-patches:Removed unused patchs 2017-08-04 11:31:50 -10:00
David Sidrane a31e626bb9 stm32f7:Backport of pinmap changes.
Juha Niskanen  committed 326ab01 2017-06-20
         STM32 F7: Set I2C4 SDA and SCL pins to open drain mode

       Titus von Boxberg  committed f3267dd 2017-07-17
         I2C4_SDA can also be on GPIO PB7

      Titus von Boxberg  committed 28eab90 2017-07-27
         No FSMC, only FMC for STM32F7
2017-08-04 11:31:50 -10:00
Beat Küng a2ef611a30 dataman: improve error reporting 2017-08-04 18:08:51 +02:00
Beat Küng 45e185f8e3 mavlink: document verbose command 2017-08-04 18:08:51 +02:00
Beat Küng 843cb05ef4 mavlink_mission: fix send_mission_count: must always use MAV_MISSION_TYPE_MISSION
Because it's only used for missions
2017-08-04 18:08:51 +02:00
Beat Küng 34e31641ab mavlink_mission: print mission_type on clear_all verbose output 2017-08-04 18:08:51 +02:00
Beat Küng 25cc64947a mavlink_mission: add check for fence & safe point on regular mission upload 2017-08-04 18:08:51 +02:00
Beat Küng b1730b67e4 mission: keep 'offboard mission updated' printf as a warning
Useful to see when a in-flight mission update happens from the log.
2017-08-04 18:08:51 +02:00
Beat Küng fde1c061ed fix mavlink_mission: mission_set_current message only applies to MISSION_TYPE_MISSION
and thus the current _mission_type does not matter.
2017-08-04 18:08:51 +02:00
Beat Küng 6d85a3c4e4 geofence: lock geofence items during a write transfers
- avoids race conditions when geofence data is updated in flight. During
  a transfer, the geofence module will not check for violations, which
  is done with the new dm_trylock method.
- there is an update counter stored in dataman, and for each write
  transaction this is increased, so that the geofence module can reload
  the data upon data change (after it's unlocked).
- single dm item updates are atomic already, so resetting the polygons
  to 0 does not need locking.
2017-08-04 18:08:51 +02:00
Beat Küng cb580c5268 navigator/mission.cpp: check result of dm_lock
and remove duplicated output, mavlink_log_critical already outputs to the
console
2017-08-04 18:08:51 +02:00
Beat Küng 3d3e6428c2 msg/geofence_update.msg: remove this topic
We'll use dataman to check for geofence data updates.
2017-08-04 18:08:51 +02:00
Beat Küng 72501df88e dataman: add dm_trylock & add lock for FENCE_POINTS items 2017-08-04 18:08:51 +02:00
Beat Küng 1942641ff6 semaphore: add px4_sem_trywait
directly mapped to the posix method sem_trywait
2017-08-04 18:08:51 +02:00
Beat Küng ed478f40fd geofence: implement circular areas 2017-08-04 18:08:51 +02:00
Beat Küng 6667b6434b mavlink_mission: replace warnx, add mission_type to verbose output 2017-08-04 18:08:51 +02:00
Beat Küng cf3b068179 mavlink: add 'verbose [on|off]' command 2017-08-04 18:08:51 +02:00
Beat Küng 371586be2c MAVLink: Add verbose command 2017-08-04 18:08:51 +02:00
Beat Küng 32491626b6 mavlink mission: set mission_type in mavlink_mission_count_t message 2017-08-04 18:08:51 +02:00
Beat Küng 401d6a1a6f navigator status: print how many polygons there are currently loaded 2017-08-04 18:08:51 +02:00
Beat Küng 4c1328483d geofence: disable altitude check if not configured
It currently cannot be configured via mavlink mission protocol.
2017-08-04 18:08:51 +02:00
Beat Küng 2981ece921 geofence: do not show an error for MAV_FRAME_GLOBAL_RELATIVE_ALT{,_INT} items
Since the altitude is not used, we can ignore this as well.
2017-08-04 18:08:51 +02:00
Beat Küng e52491c023 geofence: there is no altitude for geofence vertices, remove the TODO 2017-08-04 18:08:51 +02:00
Julian Oes 0ed29192b8 mavlink_mission: don't reset vertex_count
Since vertex_count is in a union with do_jump_current_count, we can't
always reset the current count, otherwise the vertex_count ends up being
0.
2017-08-04 18:08:51 +02:00
Beat Küng c4cdaa48e0 dataman, mission_feasibility_checker: remove unneeded uorb includes 2017-08-04 18:08:51 +02:00
Beat Küng 82716012bd geofence_update.msg: notify navigator on geofence update 2017-08-04 18:08:51 +02:00
Beat Küng 328e84117e navigator geofence: switch to new dataman data structure, support multiple polygons
This also removes the 'navigator fence <lon> <lat>' command to simplify
code (I don't think there's still use for that anymore). However the
file loading is still supported.

If goefence.txt does not exist, navigator will not clear the geofence
anymore on startup.
2017-08-04 18:08:51 +02:00
Beat Küng a987886ca3 mavlink: add fence & rally to protocol capabilities 2017-08-04 18:08:51 +02:00