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

Navigator: loiter: remove unnecessary _loiter_pos_set #21776

Merged
merged 2 commits into from
Jun 30, 2023

Conversation

sfuhrer
Copy link
Contributor

@sfuhrer sfuhrer commented Jun 29, 2023

Solved Problem

While working on #21775 I noticed this seemingly unnecessary class variable _loiter_pos_set, that was set to false in on_inactive() or in on_active, and then though only ever checked in on_activation (through set_loiter_position()). I don't see how it could be false when entering on_activation(), and thus can just be removed, or am I missing something?

Solution

Remove it!

Changelog Entry

For release notes:

Refactor: remove unnecessary variable

Test coverage

Bit of SITL testing.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
MaEtUgR
MaEtUgR previously approved these changes Jun 30, 2023
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

It was introduced here: 8960ab3
But I cannot possibly understand what for. Maybe an unfinished thought about setting the loiter position once armed when already being in hold mode but I'm pretty sure it never worked correctly since as you mention the loiter point is never set again once hold mode is engaged 🤷‍♂️

Maybe a draft implementation contained a second call to set_loiter_position() and that's where it had an effect.

I also did some tests and I cannot find a case to enter the loiter's on_activation() with the flag true.

src/modules/navigator/loiter.h Outdated Show resolved Hide resolved
@MaEtUgR MaEtUgR merged commit 4348dcc into main Jun 30, 2023
2 of 83 checks passed
@MaEtUgR MaEtUgR deleted the pr-navigator-remove-_loiter_pos_set-main branch June 30, 2023 13:40
@junwoo091400
Copy link
Contributor

image

Idk why but the merge commit in main branch itself doesn't show these build failures, any clue why in this PR page itself it shows so many build errors? @MaEtUgR

harrisondragoon pushed a commit to harrisondragoon/PX4-Autopilot that referenced this pull request Jun 30, 2023
* Navigator: loiter: remove unnecessary _loiter_pos_set

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>

* Navigator: loiter: remove commented line

---------

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
Co-authored-by: Matthias Grob <maetugr@gmail.com>
antbre pushed a commit to BioMorphic-Intelligence-Lab/PX4-Autopilot that referenced this pull request Sep 14, 2023
* Navigator: loiter: remove unnecessary _loiter_pos_set

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>

* Navigator: loiter: remove commented line

---------

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
Co-authored-by: Matthias Grob <maetugr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants