Commit Graph

13217 Commits

Author SHA1 Message Date
David Sidrane 99902807c9 SITL Moved magic numbers for battery V div and A per V to px4_config.h 2017-01-21 11:45:36 +01:00
David Sidrane a8b9c906f6 Board_config.h will provide the BOARD_BATTERYx_V_DIV
Prep to distrubte the magic numbers assgined in parameters.cpp
  to the board_config.h

  common/board_common.h will define:
  1) BOARD_BATTERY[1|2]_V_DIV as 0.0f if not defined to ensure
      the missing default trips a low voltage lockdown

  2) BOARD_BATTERY[1|2]_A_PER_V as 0.0f if not defined to ensure
     the default leads to an unrealistic current value.
2017-01-21 11:45:36 +01:00
David Sidrane 1c3ebadb85 Removed unused defines AVIONICS_ERROR_VOLTAGE and AVIONICS_WARN_VOLTAGE 2017-01-21 11:45:36 +01:00
David Sidrane 0bb0e92378 gpio_led removed dependancy on CONFIG_ARCH_BOARD_xxxx
The gpio leg can use either the FMU GPIO_SERVO (Aux Pins)
  or the FMUv1 style IO pins.

  We define either LED_ON_SERVO_GPIO or LED_ON_EXT_GPIO_AND_PIO
  based on if the board_config provides GPIO_SERVO_1 or
  GPIO_EXT_1.

  For LED_ON_SERVO_GPIO we further define GPIO_MIN_SERVO_PIN and
  the GPIO_MAX_SERVO_PIN based on the highest GPIO_SERVO_x provided
  by the board_config

  When base the ability to use the PX4PIO not in the existance of
  the path but on the define BOARD_USES_PX4PIO
2017-01-21 11:45:36 +01:00
Lorenz Meier 084e714f62 Mixer: Fix yaw throttle adjustment
When a motor hits a limit we only want to lower the collective throttle as much as the total limit, not per motor hitting the limit.
2017-01-21 08:33:51 +01:00
Paul Riseborough 1d66d4b051 sensors: Allow for difference in temperature readings across sensors
We need to track the temperature change in each sensor instance individually when using it as basis for publication.
2017-01-21 08:31:56 +01:00
Larry Wang 1beb2911e2 init shmem early to avoid random crash in fastrpc (#6407)
* init shmem early to avoid possible crash

* fix_code_style

* Keep the initialziation to NULL, remove the duplicate memory allocation
2017-01-21 08:30:46 +01:00
Beat Küng c1b1d03515 mc_att_control: use a maximum of 3 gyros 2017-01-19 19:24:52 +01:00
Beat Küng 21a3e4d36a mc_att_control: fix out-of-bounds access if system has multiple gyros 2017-01-19 19:24:52 +01:00
Beat Küng ab9e0aa524 sensors temp compensation: do an orb_copy to get the driver ID
This removes the necessity, that the driver class ID matches the uorb topic
instance.

Also improve error handling & reporting
2017-01-19 19:24:52 +01:00
Beat Küng 41d220ac2d sensors: reorder initialization calls
needed for the next commit
2017-01-19 19:24:52 +01:00
Beat Küng f6f145cbe8 sensors & mc_att_control: increase stack sizes due to recent changes 2017-01-19 19:24:52 +01:00
Beat Küng fd48d9c190 sensors: print status of temp compensation with 'sensors status' 2017-01-19 19:24:52 +01:00
Beat Küng 916a04bc56 sensors temp compensation: use SENSOR_COUNT_MAX instead of just 3 2017-01-19 19:24:52 +01:00
Beat Küng 117826a31f sensors temp compensation: refactor into a separate class
- reduces some code duplication
- provides clear API & separation for temp compensation

additional changes:
- added timestamp to sensor_correction topic
- reduced its publication rate, to only when voting index or scales or
  offsets change (if there is more than 1deg change in temperature)
2017-01-19 19:24:52 +01:00
Beat Küng 23d278cc43 sensors temp compensation: minor cleanup 2017-01-19 19:24:52 +01:00
Beat Küng f38843278d voted_sensors_update: make msl_pressure static const 2017-01-19 19:24:52 +01:00
Beat Küng e1ff6af792 mc_att_control_main: initialize _sensor_corrections properly 2017-01-19 19:24:52 +01:00
Beat Küng 535b1ea0dd voted_sensors_update: simplify accel & gyro poll methods 2017-01-19 19:24:52 +01:00
Beat Küng 7d5cd02c70 mc_att_control_main: fix bound check for gyro instance 2017-01-19 19:24:52 +01:00
Beat Küng bbd47389e0 voted_sensors_update: fix copy paste naming mistake 2017-01-19 19:24:52 +01:00
Beat Küng 0765ed552c sensor_correction.msg rename {gyro,accel,baro}_select to match uORB convention 2017-01-19 19:24:52 +01:00
Lorenz Meier 00d26b75e9 MC att control: Harden against incorrect indices 2017-01-19 19:24:52 +01:00
Lorenz Meier 905c091f8c MAVLink receiver: Use fake device ID 2017-01-19 19:24:52 +01:00
Paul Riseborough eac6dfed3c mc_att_control: Sync attitude loops to gyro data
Sync the attitude controller to the raw gyro data to remove the latency in the rate loops caused by the sensor and estimator modules.
Attitude data latency will increase as it will be from the previous EKF update, however attitude loops are less latency sensitive.
Thermal compensation and bias data will be from the previous frame.
2017-01-19 19:24:52 +01:00
Paul Riseborough 0485c2b94a sensors: add baro pressure temperature compensation and reporting 2017-01-19 19:24:52 +01:00
Paul Riseborough 0ba31b521c uavcan: Populate baro device ID
TODO - use unique HW ID
2017-01-19 19:24:52 +01:00
Paul Riseborough 677616ed83 mavlink: Populate baro device ID
TODO - use unique HW ID
2017-01-19 19:24:52 +01:00
Paul Riseborough c2fc283fdb sensors: Update single axis temp comp method to 5th order
This allows future use with baro sensors that require a higher fit order
2017-01-19 19:24:52 +01:00
Paul Riseborough f8cef1e9ab attitude_estimator_q: populate control state gyro bias data
Populate with zeros.
TODO provide estimate.
2017-01-19 19:24:52 +01:00
Paul Riseborough 27e6f07485 ekf2: publish control state gyro bias data 2017-01-19 19:24:52 +01:00
Paul Riseborough 63f032832f Add prototype IMU temperature compensation
Enabled using TC_A_ENABLE and TC_G_ENABLE parameters
Disabled by default.
IMU offsets and scale factors for selected sensor published to sensor_correction topic
TODO Parameter storage method is cumbersome
2017-01-19 19:24:52 +01:00
Matthias Grob db581fa5e8 mc_pos_control: hotfix for possible thrust below minimum thrust setting
Hotfix after a crash because of a heavily negative desired thrust that got clipped to 0 by the mixer.
0 thrust meant no more attitude tracking.
2017-01-19 18:05:57 +01:00
Beat Küng e7db0ed098 test_mixer & mixer: use memmove instead of memcpy
Both, src & dst use the same array, thus potentially overlapping.
Behavior of memcpy in that case is undefined.
2017-01-18 18:23:42 +01:00
Chris Lovett 33a307873a Enable rc mode change switch to override offboard mode. This is a safety feature, in case offboard control goes crazy, user can always regain control by switching modes to stabilize, or alt hold or position hold, however they have configured the mode change RC switch. 2017-01-18 18:15:58 +01:00
Sander Smeets ba10db06c2 Code formatting 2017-01-17 03:14:26 -08:00
Sander Smeets d0dad4ad7d Indenting 2017-01-17 03:14:26 -08:00
Sander Smeets de039ca870 VTOL back transition acceptance radius calculation 2017-01-17 03:14:26 -08:00
Lorenz Meier 7fd06ee913 MAVLLink simulator interface: Simulate minimum airspeed noise 2017-01-16 08:26:37 -08:00
Lorenz Meier b8598c4407 Sensors: Adjust airspeed fail checks 2017-01-16 08:26:37 -08:00
Lorenz Meier a13082bfed commander: Widen pre-flight check for airspeed 2017-01-16 08:26:37 -08:00
wangxdflight 67c3102db4 updated to remove a compilation flag check as orb_exists() is already supported 2017-01-16 08:25:58 -08:00
wangxdflight b693e29d64 enable px4 flight for excelsior(legacy) 2017-01-16 08:25:58 -08:00
Lorenz Meier 12767c8538 MC position controller: Stop holding position once ground contact is established.
This ensures the system does not tip over on landings. Tested in SITL with a GPS drift model.
2017-01-16 08:25:26 -08:00
Matthias Grob 5b54d78128 land detector: changed minimum throttle threshold to have useful landing detection in real world scenarios 2017-01-16 08:25:26 -08:00
Matthias Grob 39f9647291 mc_pos_control: fixed float literals and commented calculations 2017-01-16 08:25:26 -08:00
Matthias Grob f95fb0f20f land detector: commented takeoff throttle values for each mode 2017-01-16 08:25:26 -08:00
Matthias Grob 5f3cbbbbc2 mc_pos_control: changed thrust calculation to 3D projection onto body z axis
until now the desired thrust was simply the absolute value of the thrust setpoint vector
but a multicopter is only capable of producing thrust in its (negative) body z axis
this leads to excess thrust during attitude tracking errors

one important use case is:
trying to land with minimal thrust in NED z axis against gravity
but the position controller still correcting some small horizontal estimation errors
then this prevents unwanted thrust in a completely wrong direction
2017-01-16 08:25:26 -08:00
Julian Oes d63db203ba mc_pos_control: don't publish attitude sp 2x 2017-01-16 08:25:26 -08:00
Matthias Grob 7ab2958757 land_detector: added takeoff throttle threshold
if we control manually and are still landed, we want to stay idle until the pilot rises the throttle
2017-01-16 08:25:26 -08:00