Skip to content

Conversation

muramura
Copy link
Contributor

@muramura muramura commented Jun 6, 2025

A FLOAT value is being compared using the INT type. Therefore, it will be changed to INT type.

@muramura muramura closed this Jun 6, 2025
@muramura muramura reopened this Jun 6, 2025
float circle_last_num_complete;
int circle_last_num_complete;
Copy link
Contributor

Choose a reason for hiding this comment

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

I did consider doing in this way.

I think there's scope for printing partial circles if you are circling slowly, which is why I went with float here.

Copy link
Contributor Author

@muramura muramura Jun 7, 2025

Choose a reason for hiding this comment

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

The number of rotations must be an integer. For example, 0.5 rotations cannot be specified.

0.99 is 0
1.01 is 1
1.99 is 1

This condition returns TRUE when the specified number of times or more has been reached.

return num_circles_completed >= turns;

https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Mission/AP_Mission.cpp#L1109

Copy link
Contributor

Choose a reason for hiding this comment

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

The number of rotations must be an integer. For example, 0.5 rotations cannot be specified.

Are you sure? Have you tested that? We are supposed to handle fractional turns:

        float get_loiter_turns(void) const {
            float turns = LOWBYTE(p1);
            if (type_specific_bits & (1U<<1)) {
                // special storage handling allows for fractional turns
                turns *= (1.0/256.0);
            }
            return turns;
        }

@muramura muramura force-pushed the AP_Change_the_variable_type_to_INT branch from 8973098 to ef7f058 Compare June 7, 2025 00:27
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.

2 participants