-
Notifications
You must be signed in to change notification settings - Fork 13.7k
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
Add IC engine control module #24055
base: main
Are you sure you want to change the base?
Add IC engine control module #24055
Conversation
🔎 FLASH Analysispx4_fmu-v5x [Total VM Diff: 712 byte (0.03 %)]
px4_fmu-v6x [Total VM Diff: 688 byte (0.03 %)]
Updated: 2025-02-07T09:29:08 |
src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp
Outdated
Show resolved
Hide resolved
src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp
Outdated
Show resolved
Hide resolved
This pull request has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there: |
src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp
Outdated
Show resolved
Hide resolved
src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.hpp
Outdated
Show resolved
Hide resolved
src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp
Show resolved
Hide resolved
src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.hpp
Outdated
Show resolved
Hide resolved
src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp
Outdated
Show resolved
Hide resolved
src/modules/internal_combustion_engine_control/InternalCombustionEngineControl.cpp
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I made some comments, but in general it looks good to me
8eb6dfb
to
00375b9
Compare
Signed-off-by: Silvan Fuhrer <[email protected]>
Signed-off-by: Silvan Fuhrer <[email protected]>
Signed-off-by: Silvan Fuhrer <[email protected]>
Signed-off-by: Silvan Fuhrer <[email protected]>
Signed-off-by: Silvan Fuhrer <[email protected]>
d810d24
to
c5f8416
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beside the small comments I would have one "feature" request: To add a 1s delay between the starting retries. That should help to reduce wear on the starter motor and makes the starter retries audibly distinguishable from each other.
if param compare -s ICE_EN 1 | ||
then | ||
internal_combustion_engine_control start | ||
echo "****INFO [init] Internal Combustion Engine Control started" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
echo "****INFO [init] Internal Combustion Engine Control started" |
This is a left over from debugging.
@@ -81,3 +81,5 @@ CONFIG_EXAMPLES_PX4_MAVLINK_DEBUG=y | |||
CONFIG_EXAMPLES_PX4_SIMPLE_APP=y | |||
CONFIG_EXAMPLES_WORK_ITEM=y | |||
CONFIG_MODULES_SPACECRAFT=n | |||
|
|||
CONFIG_MODULES_INTERNAL_COMBUSTION_ENGINE_CONTROL=y |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CONFIG_MODULES_INTERNAL_COMBUSTION_ENGINE_CONTROL=y |
This was also just for testing.
float32 choke_control # [0,1] | ||
float32 starter_engine_control # [0,1] | ||
|
||
uint8 user_request # user intent for on/off/keep |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uint8 user_request # user intent for on/off/keep | |
uint8 user_request # user intent for on/off |
I don't think the keep is implemented, is it?
static_assert(num_data_points == (int)OutputFunction::IC_Engine_Starter - (int)OutputFunction::IC_Engine_Ignition + 1, | ||
"number of functions mismatch"); | ||
|
||
uORB::Subscription _topic{ORB_ID(internal_combustion_engine_control)}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uORB::Subscription _topic{ORB_ID(internal_combustion_engine_control)}; | |
uORB::Subscription _internal_combustion_engine_control_sub{ORB_ID(internal_combustion_engine_control)}; |
values: | ||
0: No activation | ||
1: On arming - disarming | ||
2: Mavlink? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2: Mavlink? | |
2: Mavlink - TODO |
short: Apply choke when stopping engine | ||
long: TBD | ||
type: boolean | ||
default: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would change the default to true.
short: Try to re-start engine if it stops | ||
long: TBD | ||
type: boolean | ||
default: false |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default: false | |
default: true |
max: 10 | ||
decimal: 1 | ||
increment: 0.1 | ||
default: 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
default: 1 | |
default: 0 |
ICE_IGN_DELAY: | ||
description: | ||
short: Cold-start delay after ignition before engaging starter | ||
long: TBD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
long: TBD | |
long: In case that the ignition takes a moment to be up and running, this parameter can be set to account for that. |
|
||
if (user_request == UserOnOffRequest::On && !_engine_tried_to_restart) { | ||
_state = State::Starting; | ||
instantiateEngineStart(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instantiateEngineStart(); | |
_state_start_time = now; |
This method isn't needed anymore I would say.
And just store now
at the beginning of the Run() function.
The RPM based functionality requires #24041
Solved Problem
Adding fuel engine support to PX4, including:
Solution
Adding now module to handle ICE acutators. It gets fed by user inputs (for now manual control) and actuator_motors (TODO: add identifier which actuator_motor instances are fuel engines), and outputs the 4 fuel engine actuators: ignition, throttle, choke, starter motor.
A flow chart of the solution:
![Screenshot from 2025-02-07 09-25-14](https://private-user-images.githubusercontent.com/60040461/410827406-1f571790-bf58-4980-84c0-0b29f384a475.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5OTgzNDUsIm5iZiI6MTczODk5ODA0NSwicGF0aCI6Ii82MDA0MDQ2MS80MTA4Mjc0MDYtMWY1NzE3OTAtYmY1OC00OTgwLTg0YzAtMGIyOWYzODRhNDc1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA3MDA0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY0YTZmMDJkNWNiZjY5MmQ4NzVlNDA0YjczMjAxMWRhODkwYjhlYzk1YjAyNWMyM2M4ZTliOTdjMjZjY2M2ZTMmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.W1tg_dfVhvnNj0O8L6XuVzj6KIg09TavqF9ijjpHXtY)
The proposed state machine:
![Screenshot from 2025-02-06 14-39-13](https://private-user-images.githubusercontent.com/60040461/410481116-628b6c76-b28c-45a1-bd0f-4f54a5b099e3.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5OTgzNDUsIm5iZiI6MTczODk5ODA0NSwicGF0aCI6Ii82MDA0MDQ2MS80MTA0ODExMTYtNjI4YjZjNzYtYjI4Yy00NWExLWJkMGYtNGY1NGE1YjA5OWUzLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA3MDA0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTE5YjExNTYwZjZmZTI5YjE0MTY4NWIxY2UyNGM2M2MxMGQ3NDdhNTI3ZDk0NDM5NDg5ZmI5YmRlYmI1ODFlNDkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.wH1MWvQ8KtmzItc85NMx5jnYbHDQ5l1Aat-ahATowqM)
Changelog Entry
For release notes:
Alternatives / Follow-ups
Couple of ideas for followup work:
- publish engine status over MAVLink EFI_STATUS
Test coverage
Tested on bench.
Context
Note: This feature is not enabled by default and needs to be configured together with the rpm capture driver: CONFIG_MODULES_INTERNAL_COMBUSTION_ENGINE_CONTROL=y
CONFIG_DRIVERS_RPM_CAPTURE=y
Below is a plot from the test bench:
![Screenshot from 2025-02-06 12-07-44](https://private-user-images.githubusercontent.com/60040461/410482073-16a06467-6be4-4fe7-a52f-88fc231f7eb6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzg5OTgzNDUsIm5iZiI6MTczODk5ODA0NSwicGF0aCI6Ii82MDA0MDQ2MS80MTA0ODIwNzMtMTZhMDY0NjctNmJlNC00ZmU3LWE1MmYtODhmYzIzMWY3ZWI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDA3MDA0NVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU2NjI4M2E0Nzc1NTlkZTkzNTI5NzcyNDBiN2EzNGVjMDZmYjg3NWUwZGQxYzg4MWZiYWNjMDFhMmNmNDg0NjkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.D1qK6dAtZcK9LWln4RY2_7VFDRAO2s_Idx7vsrRQLAA)
During the starting and running state there was a fault and ICE control was able to recover.