1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-24 16:55:36 +03:00
Commit graph

149 commits

Author SHA1 Message Date
ctzsnooze
7156dc84a3
Update turtle / crashflip mode (#13905)
* stop motors after 90 degrees of rotation and with max rate

* handle no accelerometer data

* improve check for acc, although seems to be OK without it

* disable all attenuation if rate is set to zero

* refactoring thanks Karate

* use sensors.h

* remove unnecessary arming check

* exit crashFlip immediately switch is reverted if throttle is zero

* add Crashflip Rate to OSD

* Revert unnecessary changes in crashflip core.c code

and clarify comments about crashflip switch

* update / minimise comments, thanks Karate

* ensure all names say `crashflip` consistently

* Undo quick re-arm because motrors were not reversed

* fix issue with reversed motors, we must disarm

* ignore yaw rotation and set gyro limit to 1900 deg/s

* default attenuation to off (crashflip_rate = 0)

* refactoring, increase rate limit to allow stronger inhibition

* enable in race_pro mode

* don't attenuate on attitude until a significant change occurs

* no attenuation for small changes

* Updates from review by PL

* remove whitespace

* refactor motorOutput, update comments, renaming variables

thanks PL

* changes from review PL

* only permit fast re-arm if crashflip rate set and crashflip was successful

* properly exit turtle mode

* add crashFlipSuccessful to unit test extern c

* small updates from review

* improved crashflip switch handling

* remove unnecessary motors normal check
2024-10-05 07:58:33 +10:00
ctzsnooze
f890287598
Auto-disarm on landing impact (#13803)
* Disarm on landing

* Changes from review comments, thanks PL

* Sorry missed that one

* calculate Acc magnitude once only, not multiple times

* Include gyro factors as in crashRecovery

* Fix bug in CrashRecovery delta gains

Add temporary debugs to monitor error and delta inputs

* remove 1G subtraction for accMagnitude

thanks Karate

* Use AccDelta or Jerk - thanks Karate

* Revert using Gyro Setpoint and Delta

* Fix typo, thanks Mark

* increment PG version to 9
2024-08-10 08:34:51 +02:00
tbolin
ae71256da7
Throttlebased EzLanding (#12094)
* ezLanding

* Add ez_landing throttle mode

* Correct EzLanding scaling of motorMixRange

* Correct mixer_type switch bracing style

* Remove motor value cliping ez landing mode

- rename mixer type cli setting to EZLANDING from EZLANDING_THROTTLE
- remove EZLANDING_CLIP cli setting
- double default ez_landing_threshold
- halve default ez_landing_limit
- check  and  limits in cli settings
- remove mixer type dependent settings in mixer_init
- remove clip based code in mixer.c

* Change ez_landing setting values and refactoring

- Halve defaul ez_landing_threshold setting and double in init instead.
  Now stick deflection equal to ez_landing_threshold should give approimately full authority.
  Previously it was the point where the mixer was allowed to raise the throttle to 100 % (which wouuld never be required)
- Increase ez_landing_threshold maximum to 200 (from 100) to allow settings that increase authority by a little at full stick deflection
- Increase ez_landing_limit maximum to 75 which is the point where EzLanding should act identical to the Legacy mixer with airmode on
- remove throttle percent from
- simplify calculation of , since throttle stick deflection is no longer involved
- update/remove outdated comments

* Remove old EZLANDING entries in mixerType enum

* Add mixer_type setting to blackbox log header

---------

Co-authored-by: ctzsnooze <chris.thompson@sydney.edu.au>
Co-authored-by: Mark Haslinghuis <mark@numloq.nl>
2023-12-09 02:36:41 +01:00
Ivan Efimov
9bbe2836a4
Fix: disable sag compensation if RPM limit is active (#12918) 2023-08-08 08:51:53 +10:00
Tanner Beard
26701f0638
RPM Limiter (#12054) 2023-05-29 06:18:16 +10:00
QuadMcFly
7dedaa4254
Add Octo X8 + to mixer defaults (#12175) 2023-01-29 02:19:47 +01:00
borisbstyle
4a916af6a9 Added DYNAMIC mixer 2020-12-08 12:04:18 +01:00
borisbstyle
75da17a00e New linear mixer (credits to @tylercorleone) 2020-12-08 12:04:07 +01:00
Michael Keller
3d7ac0dc6b Improved the naming of the digital idle offset getter. 2020-10-30 16:12:04 +01:00
Michael Keller
6c1cb60784 Added the dynamic idle throttle offset to the blackbox header to fix the motor output display. 2020-10-27 02:01:26 +01:00
mikeller
1a6514cd9b Refactored mixer / servo init. 2020-10-15 07:45:46 +13:00
mikeller
7836bc220c Fixed motorOutputLimitLow in blackbox and OSD. 2020-08-31 22:00:23 +12:00
Bruce Luckcuck
2317b5fe8d Disable GPS RESCUE if mixer is fixed-wing type
GPS Rescue flight control logic only knows how to fly multirotors and engaging GPS Rescue on a fixed-wing craft would result in an immediate loss of control and crash. For example, when GPS Rescue is engaged it attempts to yaw to the home direction heading and this won't work on fixed wing (particularly the flying wing mixer with no rudder). Next it tries to attain the target altitude exclusively with throttle control - not how altitude is controlled with a fix-wing aircraft.

Also the GPS Rescue no-fix arming prevention logic shouldn't be applied.
2020-07-27 18:49:34 -04:00
mikeller
b6689edc26 Removed VBat PID compensation. 2020-06-22 01:12:47 +12:00
Bruce Luckcuck
37069ba267 Fix initialization of mixer related pidProfile settings
Previously the variables were only initialized at boot and were not updated when the pidProfile changed.
2020-03-18 10:38:31 -04:00
Tdogb
3243aafdb9 crashflip expo 2019-12-17 12:57:47 -05:00
Tdogb
73a280cc85 initial commit of crashflip motor power percentage control 2019-12-16 17:24:55 -05:00
mikeller
e0a6f1ab14 Improved fixed wing detection. 2019-11-17 14:05:07 +13:00
Bruce Luckcuck
be79913726 Change virtual current meter to use setpoint rather than rcCommand throttle
Use the final calculated throttle value that may be affected by throttle limiting, throttle boost, etc. instead of the rcCommand input when calculating the virtual current meter.
2019-11-08 16:16:16 -05:00
jflyper
542146c702 Motor code refactor (Phase 1) 2019-07-17 01:33:39 +09:00
jflyper
0e63596abd Move motorConfig_s, motorDevConfig_s and associated PG handling into pg/motor.[ch] 2019-06-29 20:03:54 +09:00
Kenneth Mitchell
82d1736890
Call initEscEndPoints after auto changing profiles.
Reset escEndPoints with OSD.

Fix include order.
2019-04-27 18:32:25 -04:00
Bruce Luckcuck
81c226e769 Periodically try to activate DSHOT telemetry if enabled but not working
If DSHOT telemetry is enabled but one or more ESC's are not supplying valid telemetry packets, then send the DSHOT command to enable telemetry once a second while disarmed until all ESC's are supplying telemetry.

Addresses the issue of the flight controller booting without the ESC's powered. In this case the initial command at boot to enable bidirectional telemetry will be missed by the ESC since they're not powered. If the battery is subsequently plugged in the ESC's will default to bidirectional telemetry disabled.

This change will detect that ESC's are not supplying telemetry and attempt to preiodically enable them.
2019-03-17 17:45:08 -04:00
Bruce Luckcuck
99685c21c6 Add setpoint to blackbox logging
Currently only rcCommand values are included in the log data and the configurator calculates the actual setpoint values based on rates values added to the blackbox header. The problem with this is that the rates information is only written at arming so if the rates change during the log (rateprofile change, in-flight adjustments, etc.) then the calculated setpoints will be incorrect. There's no way to tell from the log that this happened. This often causes confusion because it will suddenly make it appear in the log that the PID controller is not acheiving the requested rates when it's just a presentation error. Also the rates will be incorrectly calculated when the user selects Raceflight style rates as the rates type is not supplied in the log header (and the viewer doesn't have the forumla for them anyway).

This change adds the actual setpoint values for each axis as used by the PID controller, removing the necessity for the viewer to perform any calculations. In addition to showing any rate changes, it will also show any cases where other flight features have modified the setpoints from the user's input. These were invisible previously (examples include level modes, Acro Trainer, GPS Rescue, yaw spin recovery, etc.).

Also the throttle value used in the mixer is included in the throttle axis. This allow visualization of things that affect the commanded throttle like throttle boost, throttle limit, GPS Rescue, angle level strength, etc.
2019-01-25 09:01:55 -05:00
mikeller
c684547984 Cleaned up Dshot defines. 2018-12-25 00:55:26 +13:00
mikeller
ea99f7785b Fixed crash flip with 3D enabled. 2018-11-07 02:55:29 +13:00
borisbstyle
00dbaf9fa7 Cleanup code // add unittestst for iterm windup 2018-09-10 23:38:39 +02:00
ctzsnooze
4c917efa50 Smooth anti gravity 2018-07-21 23:49:41 +12:00
Bruce Luckcuck
5cd886017d Fix throttle angle correction when smoothing throttle; reduce processing overhead
Change the logic to not modify rcCommand directly and instead apply the additional throttle directly in the mixer.

Also move the logic to the attitude task instead of having it calculate in the PID loop. The logic relies on an angle that's only updated in the attitude task so there was no point in running the calculation every PID loop.
2018-06-28 15:56:01 -04:00
Bruce Luckcuck
809c2a950b Update RPM data in smartport and frsky_hub telemetry
Both previously displayed eRPM.  frsky_hub RPM data is constrained to int16 so the value sent is RPM/10.

Updates per review and function renaming
2018-05-04 07:53:18 -04:00
Bruce Luckcuck
063f3829d4 Display ESC telemetry as real RPM in the OSD
The telemetry data provides eRPM/100.  Added a `motor_poles` parameter (defaulting to 14) that is used to calculate the physical RPM.

RPM = (telemetry_rpm * 100) / (motor_poles / 2)

Most motors we commonly use are 14 poles, but the user can adjust if needed for their setup.

Also calculate actual RPM for DEBUG_ESC_SENSOR_RPM, but to fit with in int16 the log value will be RPM/10.
2018-05-04 07:51:16 -04:00
blckmn
a9f74cd6df Removed excess trailing spaces before new lines on licenses. 2018-04-25 20:58:00 +10:00
blckmn
46fe22b4bd Direct license replacement 2018-04-22 09:22:46 +10:00
Bryce Johnson
588addd6dd added crashflip_motor_percent. This will use the other motors while doing a turtle. (#5600) 2018-04-06 20:24:48 +12:00
Martin Budden
ccb49583e9 Add hooks for triflight 2018-01-20 13:59:45 +00:00
mikeller
b489d0ba9d Renamed 'parameter_group' to 'pg'. 2017-12-19 23:36:31 +13:00
Martin Budden
d0a77bc917 Keep ITerm zero for 250ms after motor reversal in 3D mode 2017-12-01 21:36:32 +00:00
Michael Keller
39c02c083e Merge pull request #3832 from martinbudden/bf_pidsum_limits
PID sum limits applied before scaling
2017-10-12 00:01:58 +13:00
Michael Keller
ce824a60d6 Fixed mixer for 3D / Dshot. (#4161) 2017-09-17 15:45:39 +01:00
mikeller
c8f528c0af Inhibit Dshot motor beeping while motors are running (armed or motor test). 2017-08-25 09:16:43 +12:00
Martin Budden
6c8b0f3adf Avoid necessity for pidInitMixer 2017-08-24 17:34:31 +01:00
mikeller
91ffa4b88c Fixed Dshot command sending to all motors. 2017-08-23 01:59:34 +12:00
Martin Budden
554bd1257d Reduced MAX_SUPPORTED_MOTORS from 12 to 8 2017-07-29 21:28:54 +01:00
mikeller
b20ede5165 Added command 'motor 255' (all motors) to CLI. 2017-07-09 17:41:39 +12:00
borisbstyle
4ff7b9394b mixTable() separation for readability 2017-07-05 13:43:02 +02:00
borisbstyle
277755a719 Separate 3D state checks from mixTable() function for readability 2017-07-05 09:50:36 +02:00
Michael Keller
779823fb79 Cleaned up Dshot naming, containment. 2017-06-25 18:20:29 +12:00
borisbstyle
b21877438e Convert motor values at the final stage // Increase resolution 2017-06-19 09:51:17 +02:00
mikeller
991e69974f Added more mixer optimisations from #2898. 2017-04-23 18:26:06 +12:00
Michael Keller
40a2bee492 Made float parameter calculation static. 2017-04-21 13:18:23 +12:00