Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hwdef: CarbonixCubeOrange - added cx_built_in_test.lua #122

Merged
2 commits merged into from
May 10, 2024

Conversation

loki077
Copy link
Contributor

@loki077 loki077 commented Apr 7, 2024

This commit introduces a Lua script, cx_built_in_test.lua, which serves as a Continuous Built-In Test (BIT) for Carbonix Aircrafts. The script checks multiple functionalities and provides the following features:

Firmware version check: The script ensures that the firmware version is at least 5.0.
ESC Status Check and Fault Detection: The script continuously checks the status of the ESC and detects any faults.
Aircraft type detection: The script automatically detects the type of aircraft (either Ottano or Volanti) based on the EFI type.
Pre-arm checks: The script performs several pre-arm checks, including checking the firmware version, initializing parameters, and checking the aircraft type.
During-arm checks: The script performs checks while the aircraft is armed, including checking ESC telemetry and VTOL failure checks.

This script is designed to enhance the safety and reliability of Carbonix Aircrafts by continuously monitoring their status and detecting any potential issues.

SW-61

@peterbarker
Copy link
Collaborator

Firmware version check: The script ensures that the firmware version is at least 5.0.

The script should be part of the firmware, in ROMFS. This check should be redundant at that point.

ESC Status Check and Fault Detection: The script continuously checks the status of the ESC and detects any faults.

This should be part of the existing ArduPilot pre-arm checks, rather than in a custom script.

Aircraft type detection: The script automatically detects the type of aircraft (either Ottano or Volanti) based on the EFI type.

Seems reasonable, allowing you to share the script across aircraft. But do consider separate-firmware-per-aircraft.

During-arm checks: The script performs checks while the aircraft is armed, including checking ESC telemetry and VTOL failure checks.

Again, ESC telemetry checks where the ESC is actively telling you that there's something wrong should be in the normal firmware. If you're adding heuristics (e.g. voltage-and-current-and-temperature is roughly the same for all ESCs), that's a good use of a script.

Copy link
Collaborator

@peterbarker peterbarker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably also want to have some autotests to make sure this LUA script continues to work.

Some are trivial to test - set EFI_TYPE to 17 and make sure prearms fail with a specific error string.

end

local function vtol_failure_check()
local lost_index = MotorsMatrix:get_thrust_boost() and MotorsMatrix:get_lost_motor() or -1
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice check. Result should be persistently failing to pre-arm until the problem is addressed. ArduPilot main firmware has trouble enforcing such a thing (we fly on all sorts of garbage), but for Ottano and Vollanti this would be a significant problem.

local last_fail_msg_time = 0
local telem_failure = false

local function during_arm_check_loop()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not well named in that ArduPilot has "arming checks", which are often refered to as "arm checks". i.e. checks when you do when the user tries to arm the aircraft, not checks done while the aircraft is armed.

So perhaps "
while_armed_check_loop

@loki077
Copy link
Contributor Author

loki077 commented Apr 14, 2024

The script should be part of the firmware, in ROMFS. This check should be redundant at that point.

This was done so legacy aircraft where we are not doing firmware update and just want the lua script would have helped, but now we have decide to upgrade all aircraft so it is good idea to remove that check.

@loki077
Copy link
Contributor Author

loki077 commented Apr 14, 2024

This should be part of the existing ArduPilot pre-arm checks, rather than in a custom script.

agreed

@loki077
Copy link
Contributor Author

loki077 commented Apr 14, 2024

Seems reasonable, allowing you to share the script across aircraft. But do consider separate-firmware-per-aircraft.

agreed

@loki077 loki077 force-pushed the feature/SW-61-esc-engine-safety-check-1 branch from e6bd8b3 to bdc25e9 Compare May 9, 2024 00:05
@ghost
Copy link

ghost commented May 9, 2024

For now we will keep the pre Arm check of ESC telem in LUA and will wait for merging of TAKE_OFF_MIN RPM to be merged in Plane

@ghost
Copy link

ghost commented May 9, 2024

This code was tested on dev/Volanti and V37 flights.,

@ghost ghost requested review from robertlong13 and removed request for robertlong13 May 9, 2024 02:56
@loki077 loki077 force-pushed the feature/SW-61-esc-engine-safety-check-1 branch from bdc25e9 to e7994a6 Compare May 9, 2024 03:14
Added
MotorsMatrix:get_lost_motor()
MotorsMatrix:get_thrust_boost()
esc_telem:get_last_telem_data_ms(esc_index)

SW-61
@loki077 loki077 force-pushed the feature/SW-61-esc-engine-safety-check-1 branch from e7994a6 to 376f266 Compare May 9, 2024 03:44
This commit introduces a Lua script, cx_built_in_test.lua, which serves as a Continuous Built-In Test (BIT) for Carbonix Aircrafts. The script checks multiple functionalities and provides the following features:

Firmware version check: The script ensures that the firmware version is at least 5.0.
ESC Status Check and Fault Detection: The script continuously checks the status of the ESC and detects any faults.
Aircraft type detection: The script automatically detects the type of aircraft (either Ottano or Volanti) based on the EFI type.
Pre-arm checks: The script performs several pre-arm checks, including checking the firmware version, initializing parameters, and checking the aircraft type.
During-arm checks: The script performs checks while the aircraft is armed, including checking ESC telemetry and VTOL failure checks.

This script is designed to enhance the safety and reliability of Carbonix Aircrafts by continuously monitoring their status and detecting any potential issues.

SW-61
@loki077 loki077 force-pushed the feature/SW-61-esc-engine-safety-check-1 branch from 376f266 to 8dd57f9 Compare May 9, 2024 23:17
@ghost
Copy link

ghost commented May 9, 2024

@robertlong13

@ghost ghost merged commit 65c0ed3 into CxPilot May 10, 2024
62 checks passed
@robertlong13 robertlong13 deleted the feature/SW-61-esc-engine-safety-check-1 branch May 10, 2024 03:33
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants