Commit Graph

29104 Commits

Author SHA1 Message Date
Andy Piper
6253578d06 AP_HAL: add BLHeli_S ESC type and use it to control bitwidths
adjust BLHeli_S bitwidth and ticks to support more ESC variants.
2022-05-28 16:08:17 +09:00
Randy Mackay
96f0fee7b3 AP_InertialSensor: extend ENABLE_MASK param desc IMUs 4 to 7 2022-05-28 16:08:17 +09:00
Randy Mackay
72f0de65d2 AP_NavEKF3: replace AP_HAL::millis() with dal.millis() 2022-05-28 16:08:17 +09:00
Andy Piper
9f9c5c30ae AC_AutoTune: allow high ANGLE_P gains 2022-05-28 16:08:17 +09:00
Andy Piper
25d6e9b1bb AP_HAL: add bitwidth hal definitions.
revert to original bitwidths for neopixel and profiled
add proper neopixel test that observes spec'ed timings
2022-05-28 16:08:17 +09:00
Andy Piper
9af46cbf5e AP_HAL_ChibiOS: move bitwidths to AP_HAL 2022-05-28 16:08:17 +09:00
Andrew Tridgell
957eb68bee AP_BoardConfig: expose BRD_SAFETYENABLE on all boards
default BRD_SAFETYENABLE to 0 on boards with no safety switch, which
gives us the same behaviour as before, but users can choose to enable
the safety

this fixes two problems:

  - CAN servos and ESCs work on boards with no safety switch
    (eg. MatekH743 with CAN)

  - during startup we could get spurious outputs before out aircraft
    type is setup
2022-05-28 16:08:17 +09:00
Andrew Tridgell
b2086d1e96 HAL_ChibiOS: always start with safety enabled
we want it enabled during early boot to prevent incorrect ESC and
servo output
2022-05-28 16:08:17 +09:00
Andrew Tridgell
39de7be71f AP_UAVCAN: added CAN_Dx_UC_ESC_OF parameter
this allows for an offset in ESC numbering for much more efficient CAN
bandwidth usage.

For example, on a coaxial OctoQuad quadplane the ESCs are typically
setup as outputs 5 to 12. An ideal setup is to split these over 2 CAN
buses, with one CAN bus for the top layer and the one bus for the
bottom layer (allowing for VTOL flight with one bus failed).

Without this offset parameter you would be sending RawCommand messages
like this:

bus1: [ 0, 0, 0, 0, ESC1, ESC2, ESC3, ESC4 ]
bus2: [ 0, 0, 0, 0, 0, 0, 0, 0, ESC1, ESC2, ESC3, ESC4 ]

this is very wasteful of bus bandwidth, with bus1 using 3x the
bandwidth it should and bus2 using 4x the bandwidth it should (the
above will take 3 can frames for bus1, and 4 can frames for bus 2)

With this patch you can set:

CAN_D1_UC_ESC_OF = 4
CAN_D2_UC_ESC_OF = 8

and you will get this on the bus:

bus1: [ ESC1, ESC2, ESC3, ESC4 ]
bus2: [ ESC1, ESC2, ESC3, ESC4 ]

that takes just 1 can frame per send on each bus
2022-05-28 16:08:17 +09:00
Peter Barker
d435181756 AP_Mission: support *10 multipler when storing/retrieving radius in NAV_LOITER_TURNS 2022-05-28 16:08:17 +09:00
Andrew Tridgell
913b789592 AP_Vehicle: added QLAND_INSTEAD_OF_RTL mode reason 2022-05-28 16:08:17 +09:00
Andrew Tridgell
0fd3fac65f AP_Mission: allow NAV_VTOL_TAKEOFF in is_takoff_next() 2022-05-28 16:08:17 +09:00
Andrew Tridgell
d614594526 AP_Airspeed: fixed airspeed cal on 2nd airspeed sensor
we need to use the pressure from the sensor we are calibrating
2022-05-28 16:08:17 +09:00
Andrew Tridgell
52458b6f54 AP_NavEKF: getYawData also provides number of clipping models
In the case of the compass calibrator we do not want to use the GSF
result if any model is degenerate.  We've had a compass calibrate in
flight 180-degrees out from what it should have.
2022-05-28 16:08:17 +09:00
Peter Barker
2a5e9f76ac AP_Compass: do not use GSF if any model has been clipped 2022-05-28 16:08:17 +09:00
Andrew Tridgell
ee41132483 AP_EFI: added fuel usage integration for Lutan EFI
allows for EFI_COEF1 and EFI_COEF2 to be set to get fuel consumption
on GCS
2022-05-28 16:08:17 +09:00
Andrew Tridgell
bb1ee4e34c AP_Mission: improved handling of large LOITER_TURNS
instead of wrapping we should use MIN with 255, which is closer to
what was requested
2022-05-28 16:08:17 +09:00
Joshua Henderson
5ac3f9aa33 AP_Airspeed: remove negative pressure set unhealthy 2022-05-28 16:08:17 +09:00
Leonard Hall
f65a6a302b AC_AttitudeControl: Allow diabling of slew limit 2022-05-16 08:16:16 +09:00
Andrew Tridgell
2a700f677a hwdef: added FlyingMoonF427 support 2022-05-16 08:16:16 +09:00
Andrew Tridgell
008671f16a hwdef: added FlyingMoonF407 board support 2022-05-16 08:16:16 +09:00
Andrew Tridgell
a324cf80e5 HAL_ChibiOS: fixed RSSI from IOMCU analog pin 103
need to check new pin not old pin
2022-05-16 08:16:16 +09:00
Andrew Tridgell
32cb2442a9 AP_Logger: fixed a bug in wrapped log count
fixes #20687
2022-05-16 08:16:16 +09:00
Andrew Tridgell
63140014c1 AP_AHRS: fixed bug in blended EKF bias
The bug fix in #20431 was incomplete, and ended up with the wrong
blended accel bias. This fixes it
2022-05-07 08:40:54 +09:00
Andrew Tridgell
274d526a69 AP_Scripting: added quicktune.lua script
rapid tuning for VTOL control
2022-05-07 08:40:54 +09:00
Andrew Tridgell
5483e26374 AP_Scripting: added get_rpy_srate binding
and norm_input_dz binding
2022-05-07 08:40:54 +09:00
Andrew Tridgell
cd48dd0b6d AC_AttitudeControl: added get_rpy_srate() 2022-05-07 08:40:54 +09:00
Andrew Tridgell
2f60c452e6 AP_Compass: fixed custom orientation in 3 compass drivers
this prevents an internal error and mag failure with DroneCAN, MSP or
ExternalAHRS compasses
2022-05-07 08:40:54 +09:00
Andy Piper
ec0df918e5 AP_InertialSensor: move frontend update into ramfunc. 2022-04-29 08:06:29 +09:00
Andy Piper
921379ceb9 AP_FlashIface: make sure XIP flash is ready before returning 2022-04-29 08:06:29 +09:00
Andy Piper
f3319c7fc0 AP_HAL_ChibiOS: add I2C and compass backend to drivers in memory on H750
move more of EKF into memory on H750
move rc handling into memory on H750
disable double math on SPRacing H7
2022-04-29 08:06:29 +09:00
Randy Mackay
c53e507978 AP_Arming: add pre-arm check of disabled servo channels 2022-04-29 08:06:29 +09:00
Andy Piper
0d096985db SRV_Channel: observe disabled_channels when enabling channels
setup disabled_channels observing channels that are implied to be digital
allow none to be a valid channel function once again
2022-04-29 08:06:29 +09:00
Andy Piper
8a0093eae8 AP_HAL_ChibiOS: determine presence of disabled channels based on digital channels in a group 2022-04-29 08:06:29 +09:00
Andy Piper
a0140fb73e AP_HAL: add accessor for disabled channels to RCOutput 2022-04-29 08:06:29 +09:00
Andy Piper
a66355fa8b AP_BLHeli: keep a record of disabled motors 2022-04-29 08:06:29 +09:00
Bill Geyer
cabdafeeb9 AC_AutoTune: fix gain determination fail logic 2022-04-29 08:06:29 +09:00
Bill Geyer
e904f4ba38 AC_AutoTune: use failed state to exit 2022-04-29 08:06:29 +09:00
Bill Geyer
58d46114bc AC_AutoTune: use generic load gain method to save flash 2022-04-29 08:06:29 +09:00
Andy Piper
dcb634b3d8 AP_HAL_ChibiOS: bdshot version of MatekF765-Wing 2022-04-29 08:06:29 +09:00
Andy Piper
579fd22ca4 AP_HAL_ChibiOS: use narrower bitwidths for dshot and LEDs to allow more accurate prescaler calculation 2022-04-29 08:06:29 +09:00
Andy Piper
91732555a5 AP_HAL: update prescaler tests 2022-04-29 08:06:29 +09:00
Randy Mackay
9c778d134a AP_RPM: pre-arm displays gpio vs servo_ch conflict 2022-04-29 08:06:29 +09:00
Randy Mackay
61ea5c9cb2 AP_Relay: pre-arm displays gpio vs servo_ch conflict 2022-04-29 08:06:29 +09:00
Randy Mackay
423e5cb96d AP_Button: pre-arm displays gpio vs servo_ch conflict 2022-04-29 08:06:29 +09:00
Randy Mackay
e8fe09329f AP_HAL: add GPIO::pin_to_servo_channel method 2022-04-29 08:06:29 +09:00
Randy Mackay
98ac0a4106 AP_HAL_ChibiOS: GPIO comment removes mention of BRD_PWM_COUNT 2022-04-29 08:06:29 +09:00
Randy Mackay
debbc36547 AP_IOMCU: valid_GPIO_pin checks if pin configured for GPIO 2022-04-29 08:06:29 +09:00
Randy Mackay
6a07a3a981 AP_IOMCU: convert_pin_number leaves input untouched on failure 2022-04-29 08:06:29 +09:00
Randy Mackay
97406f09a8 AP_RPM: avoid attach interrupt retry and spam to GCS if PIN = -1 2022-04-29 08:06:29 +09:00
xianglunkai
7e44d0bf22 AP_Proximity_Boundary_3D:correction of miswriting 2022-04-29 08:06:29 +09:00
Andrew Tridgell
c6240312cc AP_Logger: removed annoying message on missing logs 2022-04-29 08:06:29 +09:00
Andrew Tridgell
43f1a11a5b AP_Logger: fixed log listing with gap, and EKF error on log list
this fixes two issues:

The first issue that if we are missing a log file in the middle of the
list then it was not possible to download recent logs, as we get the
incorrect value for total number of logs. This happened for me with
107 logs, with log62 missing from the microSD. It would only show 45
available logs, so the most recent logs could not be downloaded.

The second issue is that get_num_logs() was very slow if there were a
lot of log files in a directory. This would cause EKF errors and ESC
resets. Using a opendir/readdir loop is much faster (approx 10x faster
in my testing with 107 logs on a MatekH743).
2022-04-29 08:06:29 +09:00
xianglunkai
fa3c1fef18 AP_Logger: must set default fd = -1 2022-04-29 08:06:29 +09:00
Andrew Tridgell
b7dc09acbc SITL: update for changed INS_NOTCH parameter name 2022-04-29 08:06:29 +09:00
Andrew Tridgell
19b4a5fdf5 AP_HAL_ChibiOS: update for changed INS_NOTCH parameter name 2022-04-29 08:06:29 +09:00
Andrew Tridgell
5db3a06751 AP_InertialSensor: move INS_HNTC2 to a new parameter table ID 2022-04-29 08:06:29 +09:00
QioTek
4289b6bc1b AP_HAL_ChibiOS: ICM4 series sensors as an alternative with IMU3.
AP_HAL_ChibiOS:  ICM4 series sensors as an alternative with IMU3.
2022-04-29 08:06:29 +09:00
mateksys
81e6426dc6 AP_HAL_ChibiOS:add icm42688p as substitution 2022-04-29 08:06:29 +09:00
Andrew Tridgell
5e0bfa9a60 AP_Scripting: increase default heap size in SITL and on F7/H7
if we have 500k or more memory then use 100k heap for Lua, making
setup easier
2022-04-29 08:06:29 +09:00
Andrew Tridgell
d2bb387218 AC_AttitudeControl: use deadzone for pitch
when pitch for nose-in and tail-in is enabled we should use the
deadzone
2022-04-29 08:06:29 +09:00
Andrew Tridgell
8cc03726f3 AC_AttitudeControl: added an option for pitch weathervaning
when nose-in or tail-in, if the aircraft has significant pitch
asymmetry in hover then we would spin around in no wind if we use
pitch as an input

this makes pitch input for nose-in and tail-in optional and off by
default to preserve existing behaviour
2022-04-29 08:06:29 +09:00
Andrew Tridgell
d75e0c7a1c HAL_ChibiOS: disable fatal exceptions for DMA errors
this zeros-watchdog was caused by a SPI DMA error on STM32F405:

  https://discuss.ardupilot.org/t/crash-with-4-2-0-beta-and-4-3-0-daily-bdshot/83297

we had incorrectly left these internal errors enabled when asserts
were not enabled. That led to a osalSysHalt()

without these we get an spi_fail internal error, caught by the
SPIDevice code
2022-04-29 08:06:29 +09:00
Andrew Tridgell
2ee2742707 AP_InertialSensor: catch FIFO overruns on BMI088
we have seen errors where the BMI088 gets out of sync, so that the 3
axes are rotated. The data is shifted by 4 bytes, so that X=Z, Y=X
and Z=Y

this changes the BMI088 to "stop on full" mode, which is what Bosch
use in their example drivers, and also catches FIFO overrun events and
triggers a full FIFO reset. This should fix the problem with the FIFO
sync
2022-04-29 08:06:29 +09:00
李孟晓
2dae778103 AP_HAL_ChibiOS: CUAV-Nora: add usart3 support 2022-04-09 17:12:27 +09:00
Andy Piper
9ce281ae14 AP_HAL_ChibiOS: fix dshot timeout bug where the elapsed pulse is longer than the send time
dshot timeouts should be no longer than the pulse interval
use correct timestamp for dmar send time
2022-04-09 17:12:27 +09:00
Andrew Tridgell
eccec866f5 HAL_ChibiOS: incorrect class of class in uart TX timeout
need to call chEvtGetAndClearEventsI() as we are in a system lock
state
2022-04-09 17:12:27 +09:00
Andrew Tridgell
f3c19575e9 HAL_ChibiOS: fixed H7 flash storage
this fixes the flash re-init problem when flash storage fills on
H7. It was caused by rejecting writes where one or more of the 32 byte
chunks was not all 0xff but was equal to the current data. That
happens when writing to the sector header in AP_FlashStorage

it also moves the interrupt disable inside the loop to allow for
other interrupts to run between blocks
2022-04-09 17:12:27 +09:00
Andrew Tridgell
5a46280ce3 HAL_ChibiOS: use 16 byte lines for flash storage on H7
this halves the number of flash writes needed, and makes flash storage
twice as space efficient on H7

On H7 we need to write 32 bytes at a time to flash, which corresponds
to 30 bytes of data in AP_FlashStorage. By using a 16 byte storage
line we don't waste as much space
2022-04-09 17:12:27 +09:00
Andrew Tridgell
186f1db6d5 HAL_ChibiOS: increase monitor thread stack by 512
this is needed to ensure that the log writes of MON and WDOG don't
overflow monitor thread stack
2022-04-09 17:12:27 +09:00
Andrew Tridgell
ab93818570 HAL_ChibiOS: added expected delays on flash writes
this prevents a long loop internal error on disarm after a large
amount of flash writes when armed on a board with flash storage
2022-04-09 17:12:27 +09:00
Andrew Tridgell
5e76e7aa7b HAL_ChibiOS: disable interrupts during flash operations
we have now shown that interrupts being enabled during flash
operations can cause the infamous "68ms" bug, or watchdog when using a
32 bit timer on boards using flash for storage

The issue is quite repeatable with a load of a very large waypoint
file (over 500 waypoints) using "wp ftpload" in MAVProxy. This puts a
huge load on flash storage.

Our current working theory is that while doing flash writes for
storage on dual-bank we block access to only one bank, so if another
thread uses a timeout function with a short timeout while the flash
write is happening and chVTDoTickI calls code which crosses the flash
bank boundary then it can cause chVTDoTickI to violate the assumption
that no more than CH_CFG_ST_DELTA ticks pass while it is calculating
the value to set in the system timer. In that case we get a delay of a
full timer wrap, which is 68ms on boards with 16 bit timer and 70
minutes on boards with 32 bit timer
2022-04-09 17:12:27 +09:00
Andrew Tridgell
e343d9d86b Revert "hwdef: changed MatekH743 to a 32 bit timer"
This reverts commit 7dc5911572.
2022-04-09 17:12:27 +09:00
Andrew Tridgell
b497de8c12 HAL_ChibiOS: constrain more timer timeouts 2022-04-09 17:12:27 +09:00
Andrew Tridgell
057340cb1d HAL_ChibiOS: prevent long timeouts in DShot
this prevents bad calculated timeouts in DShot. The timeout would
sometimes come out as 0xFFFFFFFF, which led to an assert and could
block the thread

This fix is meant to be minimilistic to allow it to be merged easily
into 4.2. A better fix would fix all the uint32_t wrap handling in
DShot
2022-04-09 17:12:27 +09:00
Andrew Tridgell
2b4a17fef7 AP_Math: added unsigned versions of constrain functions
sometimes it really does matter that we use constrain_uint32() instead
of constrain_int32(). For example, if we have a value like 0xFFFFFFFF
then the result will be very different

we should use unsigned constrain when dealing with unsigned values
2022-04-09 17:12:27 +09:00
Andrew Tridgell
6a6a5adae0 AP_Logger: fixed @SYS file logging
the key fix is the reset of the fd to -1. Without that fix we only
ever log @SYS/uarts.txt

The timing change is needed to get the files out in a reasonable
time. The function is actually getting called at 100Hz or less, not
1kHz (measured on MatekH743 copter at 400Hz). So we need to run it
faster to get the files logged in a reasonable time
2022-04-09 17:12:27 +09:00
Andy Piper
4f8c486278 AP_HAL_ChibiOS: spro H7 extreme updates.
cannot currently use both IMUs on spro H7 extreme due to CPU load
2022-04-09 17:12:27 +09:00
Peter Barker
45aebfdf74 AP_AHRS: subtract accel bias from correct ins accel instance
In the case that you have INS_USE indicating IMUs should be used, but
EK3_IMU_MASK leaving some IMUs unused, we subtract the bias from the
wrong INS data
2022-04-09 17:12:27 +09:00
Andrew Tridgell
58e356557a AP_Logger: increase stack of log_io thread by 256
This was seem on omnibusf4pro, it is a bit too close:

  log_io PRI= 59 sp=0x20015CC0 STACK=144/1656
2022-04-09 17:12:27 +09:00
Bill Geyer
152c98831b AP_Math: add chirp function to support frequency sweeps in systemid and autotune 2022-03-30 19:12:45 +09:00
Bill Geyer
eae1e6cda7 AC_Autotune: clean up variable init for dwell 2022-03-30 19:12:45 +09:00
Bill Geyer
f782215194 AC_AutoTune: use chirp function in AP_Math for frequency sweeps 2022-03-30 19:12:45 +09:00
Bill Geyer
da7164c1e4 AC_AutoTune: combine dwell_run_test for angle and rate 2022-03-30 19:12:45 +09:00
Bill Geyer
68f0eb9e5d AC_AutoTune: combine dwell_init methods 2022-03-30 19:12:45 +09:00
Bill Geyer
14fea56206 AC_AutoTune:tradheli-streamline gcs messages 2022-03-30 19:12:45 +09:00
Peter Barker
cade8b36a0 AC_AutoTune: Vector tidying 2022-03-30 19:12:45 +09:00
Peter Barker
1a84c17fee AC_AutoTune_Heli: use structure assignment to clear structures 2022-03-30 19:12:45 +09:00
Peter Barker
55af020639 AC_AutoTune: use structure assignment for test results 2022-03-30 19:12:45 +09:00
Peter Barker
3686f32671 AC_AutoTune: createstructure to hold specific test's sweep results 2022-03-30 19:12:45 +09:00
Henry Wurzburg
94c0701f17 HWDEF: add SLCAN OTG port, correct defaults.param errors 2022-03-30 19:12:45 +09:00
Andy Piper
bb86b35f03 AP_HAL_SITL: correct disable channel maths
unilaterally write rcoutput to appease the sitl gods
2022-03-30 19:12:45 +09:00
Andy Piper
15614bd879 SRV_Channel: don't count disabled channels in mask and setup functions
disable channels that are not in use
2022-03-30 19:12:45 +09:00
Andy Piper
70bba0cc99 AP_HAL_ChibiOS: fix ESCs constantly arming on rover with dshot commands
make sure debug will compile
take into account active channels when configuring bdshot
add channel mask debug output
correct set bdshot telemetry position at startup
make sure all channels in a bdshot group are pulled high to prevent spurious pulses
2022-03-30 19:12:45 +09:00
AndKe
1805ff4e6d AP_HAL_ChibiOS: add OREOLED to CubeGreen 2022-03-30 19:12:45 +09:00
Andrew Tridgell
5a24abafe9 hwdef: changed MatekH743 to a 32 bit timer
the 68ms issue is still present on this board. Switching to a 32 bit
timer will fix it, but loses us the tonealarm support
2022-03-30 19:12:45 +09:00
Andrew Tridgell
c74ace877a AP_Param: fixed param class conversion code
param class conversion was unconditionally overwriting the parameter
from the old parameter. This meant if the user has set a value in an
old firmware they could not change it in a new firmware.

I hit this with ARSPD_TYPE. I had previously set this to 0 in a
previous use of the board, and found that it kept resetting to 0 on
the new firmware when I tried to enable airspeed
2022-03-30 19:12:45 +09:00
Andrew Tridgell
e4cf969168 AP_Logger: added terrain correction logging field 2022-03-30 19:12:45 +09:00
Andrew Tridgell
eb52867dad AP_Terrain: added logging of terrain correction 2022-03-30 19:12:45 +09:00
Andrew Tridgell
6fa866d1b4 AP_Scripting: restored corrected boolean in height_amsl binding 2022-03-30 19:12:45 +09:00