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

AC_Avoid: Check if origin is set before any obstacle avoidance algorithm is run #14607

Merged
merged 1 commit into from
Jun 16, 2020

Conversation

rishabsingh3003
Copy link
Contributor

Both BendyRuler and Djikstra's require origin to have been set before being run but BendyRuler does not have this check. This might lead to an issue where the location used in BendyRuler is not initialized (i.e. 0,0,0) and we still run the algorithm.
This issue has been fixed by moving the check up from Djikstra's to PathPlanner.
@rmackay9 @khancyr

@rmackay9
Copy link
Contributor

rmackay9 commented Jun 15, 2020

@rishabsingh3003,

Thanks for this.

One thing we can take advantage of is that once the EKF origin is set, it is never unset. So how about we move the check before the "while (true) {"? I think we will need to add another loop and include a delay of perhaps 500ms. So something like this:

void AP_OAPathPlanner::avoidance_thread()
{
        // require ekf origin to have been set
        bool origin_set = false;
        while (!origin_set) {
            hal.scheduler->delay(500);
            struct Location ekf_origin {};
            {
                WITH_SEMAPHORE(AP::ahrs().get_semaphore());
                origin_set = AP::ahrs().get_origin(ekf_origin));
            }
        }

I'd like to avoida a tight loop where it constantly takes the ahrs semaphore.

@rmackay9 rmackay9 merged commit 34b17d0 into ArduPilot:master Jun 16, 2020
@rmackay9
Copy link
Contributor

great, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants