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

When setting pos_sp_triplet yaw, also set the yaw valid flag to true #12480

Merged
merged 2 commits into from
Oct 8, 2019

Conversation

dusan19
Copy link
Contributor

@dusan19 dusan19 commented Jul 15, 2019

I ran into a problem when executing a mission with following mission items:

  1. Set ROI location (different than the initial drone heading)
  2. Takeoff
  3. Waypoint
    The following happens: The drone takes off at the takeoff location and hovers there indefinitely instead of going to the next waypoint (mission item 3).
    I observed this using the simulation with a multicopter.

After some debugging I found out that this is the what leads to this behavior:

  1. ROI mission item is processed and reports mission item reached
  2. Takeoff mission item is processed and takeoff work item is inserted
  3. Work item is completed, drone took off, and the actual takeoff nav_cmd type is being processed. In set_mission_item() current nav_cmd is changed from takeoff to waypoint, since the drone took off already, at the same step mission item yaw is set to NAN. Furthermore, set_mission_item() calls mission_item_to_position_setpoint() which sets the triplet yaw valid flag to false since yaw is set to NAN.
  4. The drone reaches the takeoff position as nav_cmd is set to waypoint, but the yaw is not reached. mission::on_active() calls heading_sp_update() which sets the mission item yaw to face the ROI location and sets the pos_sp_triplet yaw to the same value. This should ensure that the drone yaws towards the ROI, but the yaw_valid flag is false so this doesnt happen and the yaw setpoint is never reached, which means that the mission item is never reached.

Solution:
Proposed solution is just setting the yaw_valid flag to true when heading_sp_update() updates the heading. This fixed the problem in my case, with a multicopter executing the mission mentioned above.

julianoes
julianoes previously approved these changes Jul 15, 2019
Copy link
Contributor

@julianoes julianoes left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! I think that makes sense.

@dagar or @MaEtUgR can you double check?

@dusan19
Copy link
Contributor Author

dusan19 commented Aug 26, 2019

Hey, can you guys merge this fix if there is no complaints?

@dusan19
Copy link
Contributor Author

dusan19 commented Oct 7, 2019

@dagar should the merge go in the other direction (after rebasing)?

@dagar
Copy link
Member

dagar commented Oct 8, 2019

It's a merge into the pull request branch to make sure everything still passes CI. Then the entire thing is squashed and merged back to master. Alternatively it could have been rebased, but this is what github let's you do easily through the web interface.

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.

3 participants