Commit Graph

52648 Commits

Author SHA1 Message Date
Peter Barker d319370080 RC_Channel: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker a10ed0e87f PID: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker c829b109bf AP_Vehicle: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker e1dd53eb17 AP_TECS: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker ce312a3750 AP_Scripting: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker df60565769 AP_Mission: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker dd589934cc APM_Control: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker 0c32eeca2e AP_Logger: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker 8ec0eed749 AP_Landing: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker 6a97056736 AP_Camera: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker d73cd7d0e3 AC_WPNav: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker e5e4dee708 AC_PID: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker 66f0a0f42b AC_AutoTune: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Peter Barker c1e776fc46 AC_AttitudeControl: stop libraries including AP_Logger.h in .h files
AP_Logger.h is a nexus of includes; while this is being improved over
time, there's no reason for the library headers to include AP_Logger.h
as the logger itself is access by singleton and the structures are in
LogStructure.h

This necessitated moving The PID_Info structure out of AP_Logger's
namespace.  This cleans up a pretty nasty bit - that structure is
definitely not simply used for logging, but also used to pass pid
information around to controllers!

There are a lot of patches in here because AP_Logger.h, acting as a
nexus, was providing transitive header file inclusion in many (some
unlikely!) places.
2022-04-08 19:18:38 +10:00
Andrew Tridgell 2b2cac3f19 autotest: fixed annoying gdb pagination on reboot 2022-04-08 09:00:22 +10:00
Andrew Tridgell 08e22095a9 Tools: added script to make using a crash_dump.bin easier 2022-04-07 18:11:10 +10:00
Andrew Tridgell 3bdcff263d Plane: release notes for 4.2.0beta5 2022-04-07 10:07:25 +10:00
Andy Piper e0adbb978e 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-07 07:21:21 +10:00
Peter Barker b80cc9a610 AP_Logger: remove old, unused log metadata for MON 2022-04-06 21:54:15 +10:00
Peter Barker 7c526d52fe autotest: correct streaming-boolean bug for parsing of log structures from code 2022-04-06 21:54:15 +10:00
Peter Barker 55d0cf4b03 autotest: add diagnostics for log parse issues 2022-04-06 21:54:15 +10:00
Peter Barker 9f7ae1ee96 autotest: extract ids and message infos per-file, not on aggregate
Will allow for better diagnostics when something goes wrong
2022-04-06 21:54:15 +10:00
Peter Barker 00de10d796 AP_HAL_ChibiOS: use structure for writing out WDOG,MON message 2022-04-06 21:54:15 +10:00
Peter Barker a546bc797c AP_Logger: source IDs and structs from HAL_ChibiOS 2022-04-06 21:54:15 +10:00
Peter Barker 6ac68c5875 Blimp: remove land_acel_ef_filter
Landing is for wimps
2022-04-06 17:36:51 +10:00
Peter Barker adf9c21d48 AP_NavEKF3: remove instance id from EK3 external interface
Removes passing of instance id in interfaces where -1 was the only value
ever passed in
2022-04-06 17:36:05 +10:00
Peter Barker b762aac6ce AP_AHRS: remove instance id from EK3 external interface
Removes passing of instance id in interfaces where -1 was the only value
ever passed in
2022-04-06 17:36:05 +10:00
Peter Barker c2112565b5 AP_GPS: remove redundant _blend_mask check
filling in of these values is already gated by checking the mask
2022-04-06 17:31:42 +10:00
Peter Barker 4332ed8f36 AP_GPS: use sq function for squaring numbers 2022-04-06 17:31:42 +10:00
Iampete1 2589fa1b3b AP_GPS: UBlox: add TIM-TM2 logging 2022-04-06 17:22:30 +10:00
Iampete1 0a0178988d AP_Logger: add 1e-9 log multiplyer 2022-04-06 17:22:30 +10:00
Peter Barker 717edae9ef hwdef: fix redefinition of Solo values in CubeSolo/CubeGreen-Solo
adding fmuv3 into the list of firmwares we might run on Solo was a late
addition to the recent PRs.  It was forgotten that the inheritance would
cause a redefition failure
2022-04-06 16:38:23 +10:00
Andrew Tridgell 37d8feb928 hwdef: disable GPS drivers on low flash boards
only leave uBlox enabled on boards that are running out of flash
2022-04-06 14:14:07 +10:00
Andrew Tridgell c9bbfd94c0 hwdef: set AUTOBUILD_TARGETS None on eval boards 2022-04-06 14:13:44 +10:00
Andrew Tridgell 10d7ea9358 Tools: recognise "AUTOBUILD_TARGETS None"
and make for easier testing on command line
2022-04-06 14:13:44 +10:00
李孟晓 2d37bc9c78 AP_HAL_ChibiOS: CUAV-Nora: add usart3 support 2022-04-06 11:04:08 +10:00
Peter Barker 5539b55c01 Copter: factor failsafe reporting 2022-04-06 10:40:09 +10:00
Andrew Tridgell 06b6632f30 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-06 07:46:29 +10:00
Peter Barker d2c3c578c2 hwdef: add hwdef for CubeOrange-SimOnHardware 2022-04-05 18:10:14 +10:00
Peter Barker 582eed12bf autotest: correct extraction of fields from LogWrite messages 2022-04-05 17:57:40 +10:00
Peter Barker 934a125875 Tools: add script which tells you how Copter.ap changes over time
This is a global state object which we really want to get rid of - but
while we have it it does contain some useful state.

pbarker@bluebottle:~/rc/ardupilot(pr/du32-change)$ ./Tools/scripts/du32_change.py ~/rc/log32.bin
1648874490: Creating connection
Original armed_with_airmode_switch: 0
Original auto_armed: 0
Original compass_mot: 0
Original gps_glitching: 0
Original in_arming_delay: 1
Original initialised: 1
Original initialised_params: 1
Original land_complete: 1
Original land_complete_maybe: 1
Original land_repo_active: 0
Original logging_started: 1
Original motor_interlock_switch: 0
Original motor_test: 0
Original new_radio_frame: 1
Original pre_arm_check: 1
Original pre_arm_rc_check: 1
Original prec_land_active: 0
Original rc_receiver_present: 1
Original system_time_set_unused: 0
Original throttle_zero: 1
Original unused1: 0
Original unused2: 0
Original unused3: 0
Original unused_was_simple_mode bit1: 0
Original unused_was_simple_mode bit2: 0
Original usb_connected_unused: 0
Original using_interlock: 0
2022-04-01 08:19:27.03:  -in_arming_delay
2022-04-01 08:19:31.04:  +auto_armed -throttle_zero
2022-04-01 08:19:38.04:  -land_complete -land_complete_maybe
2022-04-01 08:20:34.29:  +throttle_zero
2022-04-01 08:20:35.29:  -auto_armed +land_complete +land_complete_maybe
pbarker@bluebottle:~/rc/ardupilot(pr/du32-change)$
2022-04-05 17:56:37 +10:00
Andrew Tridgell 392e80001f 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-05 17:46:52 +10:00
Andrew Tridgell 093acc1577 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-05 17:46:52 +10:00
Andrew Tridgell 055ee6ba82 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-05 17:46:52 +10:00
Andrew Tridgell 1b6620b42f 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-05 17:46:52 +10:00
Andrew Tridgell a0c867bce7 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-05 17:46:52 +10:00
Andrew Tridgell f6f6521b28 Revert "hwdef: changed MatekH743 to a 32 bit timer"
This reverts commit 7dc5911572.
2022-04-05 17:46:52 +10:00
Andrew Tridgell 5ef9c5aaa5 HAL_ChibiOS: constrain more timer timeouts 2022-04-05 17:46:52 +10:00
Andrew Tridgell 4c977eb7a0 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-05 17:46:52 +10:00
Andrew Tridgell a95b429acc 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-05 17:46:52 +10:00