Skip to content

Conversation

mahima-yoga
Copy link
Contributor

@mahima-yoga mahima-yoga commented May 22, 2025

Solved Problem

If COM_HOME_EN is enabled, the home position will reset when landed.

However, during mission execution, we want to prevent the home position from resetting if an intermediate landing occurs. Instead, the home position should remain fixed at the one set at the beginning of the mission.

Solution

  • Check whether the vehicle is still executing a mission before updating home position

To have multiple takeoff items in a mission: I found that this feasibility check fails and prevents you from uploading the mission. Commenting it out works for now, but is probably not a very robust solution.

Changelog Entry

For release notes:

Feature/Bugfix Don't reset home position until a mission is finished

Alternatives

We briefly discussed whether this should be a configuration option. These are the alternative options:

  1. Extending COM_HOME_EN (or introducing a new parameter) that only sets the home_position once in a boot cycle (position where the vehicle was armed the very first time).

    • Pros: more generalized, and gives everyone the option to enable this feature
    • Cons: not explicitly linked to the mission. So the home_position won't update once the mission is finished.
  2. Creating a mission parameter that enables multiple takeoffs. If enabled, home_position doesn't update upon each landing. Something like: MIS_MULTI_TKO_LND?

Test coverage

Tested in SITL:

image

@mahima-yoga mahima-yoga requested review from cmic0 and sfuhrer May 22, 2025 14:53
dakejahl
dakejahl previously approved these changes May 22, 2025
Copy link
Contributor

@dakejahl dakejahl left a comment

Choose a reason for hiding this comment

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

Nice! I like this solution better than the proposed alternatives

Copy link
Contributor

@sfuhrer sfuhrer left a comment

Choose a reason for hiding this comment

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

Can you adapt the parameter description of COM_HOME_EN (add a note that Home is not reset if mission is not complete)?
And do I get it correctly that now if you fly a mission, then take over in a manual mode, land somewhere, takeoff off again --> Home is not updated?

Copy link

github-actions bot commented May 27, 2025

🔎 FLASH Analysis

px4_fmu-v5x [Total VM Diff: 104 byte (0.01 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%    +104  +0.0%    +104    .text
  [NEW]     +56  [NEW]     +56    CSWTCH.278
  +0.0%     +48  +0.0%     +48    g_cromfs_image
  [NEW]     +32  [NEW]     +32    CSWTCH.274
  +2.7%     +32  +2.7%     +32    Commander::run()
  +3.8%      +8  +3.8%      +8    Commander::landDetectorUpdate()
  +0.0%      +8  +0.0%      +8    [section .text]
  [NEW]      +4  [NEW]      +4    CSWTCH.853
  +0.3%      +4  +0.3%      +4    Commander::Commander()
  +0.7%      +4  +0.7%      +4    Commander::arm()
  [DEL]      -4  [DEL]      -4    CSWTCH.850
  [DEL]     -32  [DEL]     -32    CSWTCH.271
  [DEL]     -56  [DEL]     -56    CSWTCH.275
+0.0%     +55  [ = ]       0    .debug_abbrev
-0.0%      -4  [ = ]       0    .debug_info
+0.0%     +37  [ = ]       0    .debug_line
 -60.0%      -3  [ = ]       0    [Unmapped]
  +0.0%     +40  [ = ]       0    [section .debug_line]
+0.0%     +22  [ = ]       0    .debug_loclists
-0.0%      -3  [ = ]       0    .debug_rnglists
+0.0%     +21  [ = ]       0    .debug_str
-0.9%    -104  [ = ]       0    [Unmapped]
+0.0%    +128  +0.0%    +104    TOTAL

px4_fmu-v6x [Total VM Diff: 88 byte (0 %)]
    FILE SIZE        VM SIZE    
--------------  -------------- 
+0.0%     +88  +0.0%     +88    .text
  [NEW]     +56  [NEW]     +56    CSWTCH.278
  +0.0%     +44  +0.0%     +44    g_cromfs_image
  [NEW]     +32  [NEW]     +32    CSWTCH.274
  +2.7%     +32  +2.7%     +32    Commander::run()
  +3.8%      +8  +3.8%      +8    Commander::landDetectorUpdate()
  [NEW]      +4  [NEW]      +4    CSWTCH.853
  +0.3%      +4  +0.3%      +4    Commander::Commander()
  +0.7%      +4  +0.7%      +4    Commander::arm()
  +4.8%      +4  +4.8%      +4    FlightTask
  [DEL]      -4  [DEL]      -4    CSWTCH.850
  -0.0%      -8  -0.0%      -8    [section .text]
 -66.7%     -32 -66.7%     -32    CSWTCH.271
  [DEL]     -56  [DEL]     -56    CSWTCH.275
+0.0%     +55  [ = ]       0    .debug_abbrev
-0.0%      -4  [ = ]       0    .debug_info
+0.0%     +37  [ = ]       0    .debug_line
 -42.9%      -3  [ = ]       0    [Unmapped]
  +0.0%     +40  [ = ]       0    [section .debug_line]
+0.0%     +22  [ = ]       0    .debug_loclists
-0.0%      -3  [ = ]       0    .debug_rnglists
+0.0%     +21  [ = ]       0    .debug_str
+0.4%      +1  [ = ]       0    .shstrtab
+0.0%     +11  [ = ]       0    .strtab
  [NEW]     +11  [ = ]       0    CSWTCH.274
  [DEL]     -11  [ = ]       0    CSWTCH.275
  [NEW]     +11  [ = ]       0    CSWTCH.278
  [DEL]     -11  [ = ]       0    CSWTCH.850
  [NEW]     +11  [ = ]       0    CSWTCH.853
-1.4%     -88  [ = ]       0    [Unmapped]
+0.0%    +140  +0.0%     +88    TOTAL

Updated: 2025-05-28T13:45:58

@mahima-yoga mahima-yoga force-pushed the pr-home_pos_mission branch from cfeba18 to 4093122 Compare May 27, 2025 12:59
@mahima-yoga
Copy link
Contributor Author

mahima-yoga commented May 27, 2025

And do I get it correctly that now if you fly a mission, then take over in a manual mode, land somewhere, takeoff off again --> Home is not updated?

@sfuhrer When you take over the nav_state is no longer NAVIGATION_STATE_AUTO_MISSION, so the home position should update again when landed/taking off. Quickly tested it as well, home position updates:

image

@mahima-yoga mahima-yoga force-pushed the pr-home_pos_mission branch from 4093122 to dbf6903 Compare May 28, 2025 13:39
@mahima-yoga mahima-yoga force-pushed the pr-home_pos_mission branch from dbf6903 to 9ceff18 Compare May 28, 2025 13:40
@mahima-yoga mahima-yoga requested a review from sfuhrer May 28, 2025 13:41
@sfuhrer sfuhrer merged commit 2110da7 into main Jun 2, 2025
71 of 73 checks passed
@sfuhrer sfuhrer deleted the pr-home_pos_mission branch June 2, 2025 08:50
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.

3 participants