allows the scalar model values (mass, disc area, momentum drag etc) to
be customised as parameters for copters and quadplanes. A json model
file sets the defaults for the parameters
The SIM_FRM_BBDRAG and SIM_FRM_MDRAG drag coefficients default to
zero on planes so the plane model alone handles drag and the
auto-tests don't need retuning. Setting them on a quadplane gives
more realistic airbraking in VTOL modes
Commit d2fc8cac ("SITL: Improve SIM::Battery energy consumption") made
unlimited-capacity batteries (the SITL default) sag under load where they
previously had none. As the simulated voltage scales motor thrust linearly,
there was no longer any way to run a sim vehicle without that thrust penalty.
Add a SIM_BATT_RES_OHM parameter that overrides the vehicle model's internal
resistance: negative keeps the model value (unchanged default behaviour), 0
disables sag entirely, and a positive value sets an explicit resistance. It is
applied live via Battery::maybe_reset(), so it can be changed without a reboot.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This PR clarifies the intended SIM_BATT_* param behavior
Step 1: Split Frame's battery management into smaller parts
Step 2: Move battery managagement out of Frame to Aircraft-children which have a Frame
Step 3: Move SITL::Plane's battery consumption up one level in the 'function stack'
Step 4: SIM::Battery manages its own initial voltage
Step 5: Make Aircraft responsible for managing battery resets
Step 6: Frame now does not use/have a SIM::Battery
(It uses the batt owned by Aircraft-children which have a Frame.)
Step 7: Put battery maybe-reset logic into SITL::Battery
Only one ever exists so there's little reason to construct all
possibilities ahead of time and store them in global RAM. Instead, keep
a list of the parameters and only construct the one requested. Saves
some 60K of RAM on hardware when using sim on hardware.
In particular, enough is saved to get esp32empty copter building again.
But esp32 sim on hardware still does not work due to other regressions.
this allows for any output to be an ESC, which allows for proper
simulation of quadplanes with ESCs on outputs 5-8 or 9-12, for testing
notch filtering
this takes account of motor expo, velocity of air over propellers,
mass, size and other factors
It also allows for frame parameters to be supplied as an external json file
The parameter values are time in milliseconds and body-frame
acceleration in m/s/s
So to test throw mode:
mode throw
param set SIM_SHOVE_Z -30
arm throttle
param set SIM_SHOVE_TIME 500
RC_Channel: To nullptr from NULL.
AC_Fence: To nullptr from NULL.
AC_Avoidance: To nullptr from NULL.
AC_PrecLand: To nullptr from NULL.
DataFlash: To nullptr from NULL.
SITL: To nullptr from NULL.
GCS_MAVLink: To nullptr from NULL.
DataFlash: To nullptr from NULL.
AP_Compass: To nullptr from NULL.
Global: To nullptr from NULL.
Global: To nullptr from NULL.
Includes parameters enabling a ground level magnetic anomaly to be modelled.
TODO - add automatic setting of declination, inclination and field strength using WGS-84 position.
this adds non-turbulent wind support for the built-in simulators. I
added it primarily for quadplane testing, but it should also be useful
for multicopter navigation testing.
Remove unnecessary includes, reorder them in blocks separated by a blank
line
- Corresponding header file (if exists)
- System headers
- Other ArduPilot library headers
- "Local" headers (from the same library)
Now that SITL is compiled only when it's needed (i.e. using the SITL
board), there's no need to ifdef its files based on the
CONFIG_HAL_BOARD. So remove them.
This commit changes the way libraries headers are included in source files:
- If the header is in the same directory the source belongs to, so the
notation '#include ""' is used with the path relative to the directory
containing the source.
- If the header is outside the directory containing the source, then we use
the notation '#include <>' with the path relative to libraries folder.
Some of the advantages of such approach:
- Only one search path for libraries headers.
- OSs like Windows may have a better lookup time.