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

Enable loiter type offboard position setpoint for Fixedwing vehicles #13199

Merged
merged 3 commits into from
Oct 28, 2019

Conversation

Jaeyoung-Lim
Copy link
Member

@Jaeyoung-Lim Jaeyoung-Lim commented Oct 15, 2019

Describe problem solved by this pull request
This PR Fixes #13180 , where sending the loiter type offboard position setpoint on a fixed wing vehicle will result in a fly away. Loiter setpoints can be useful for fixed wing offboard mode as normal position setpoints are passed as a reference to the l1 controller so there are no explicit constraints on the radius of the vehicle while keeping close to the position setpoint.

The reason the it wasn't working was

  • Commander thinks it is a valid setpoint, as it is receiving enough SET_POSITION_TARGET_LOCAL_NED messages, therefore the vehicle is able to switch to offboard mode.
  • The fixed wing position controller treats the setpoint as a loiter setpoint as it is marked here as a lotier setpoint.
  • However, as the loiter_radius and loiter_direction is not set from SET_POSITION_TARGET_LOCAL_NED, it is left as zero.

Describe your solution
Set the loiter_radius and lotier_direction if loiter_radius<=0it is invalid (which probabiliy means it is in offboard mode following position setpoints). It uses the default NAV_LOTIER_RAD parameter as default loiter radius

Test data / coverage
This log shows a flight which is being sent a offboard local position setpoint at [0.0m, 0.0m, 20.0m] and being switched between mission mode and offboard mode

@Jaeyoung-Lim Jaeyoung-Lim requested a review from sfuhrer October 15, 2019 16:17
@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Oct 15, 2019

@hamishwillee The types of position setpoints are in general UNDOCUMENTED. I realized this is a thing by going through the code. Now that it works would it make sense to add this to the documentation?

@hamishwillee
Copy link
Contributor

The types of position setpoints are in general UNDOCUMENTED. I realized this is a thing by going through the code. Now that it works would it make sense to add this to the documentation?

@Jaeyoung-Lim
How does the "type" of the setpoint get determined? I.e. I can't see it in https://mavlink.io/en/messages/common.html#SET_POSITION_TARGET_LOCAL_NED so it looks entirely internal to PX4.
Can someone determine what type of setpoint they are dealing with?

Upshot, I can't answer this yet, because I don't understand where these come from and how they are used.

@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Oct 16, 2019

@hamishwillee Exactly. It seems to be coming from #3405 and the type definitions didn't make it through the mavlink spec. The definitions just use raw bitfields so it is hard to track where it is coming from.

I do like the fact that we can use the type_mask to configure how the setpoint can be followed.

In my opinion, this should either be pushed to the mavlink standard or at least be documented somewhere.

@hamishwillee
Copy link
Contributor

@Jaeyoung-Lim Thanks for the clarification. I don't know if this should be public or not, but if it is then IMO it has been done incorrectly.

I have created mavlink/mavlink#1250 to discuss whether it should be public or not. Depending on how that falls out will define how this is documented.

Can you tell me the difference between the idle and loiter setpoints, and why knowing the setpoint type is useful (as an answer to the linked PR?)

@Jaeyoung-Lim
Copy link
Member Author

Jaeyoung-Lim commented Oct 17, 2019

@hamishwillee Specifying the position of the setpoint does not always fully define the expected behavior of the vehicle.

  • An idle setpoint will make the vehicle be in idle state - zero throttle, zero roll / pitch.
  • A Loiter setpoint will make the vehicle circle around the setpoint.
  • A normally passed postion setpoint will make the vehicle use the position setpoint as a reference to the L1 controller, so it will fly in a flower like pattern.

All three types use the same position setpoint, but the behavior is handled differently in the fixed wing position controller.

sfuhrer
sfuhrer previously approved these changes Oct 17, 2019
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.

Looks reasonable to me. Haven't tested it in offboard, but tested it a bit in VTOL, doesn't seem to break anything in the other modes.

@hamishwillee
Copy link
Contributor

@Jaeyoung-Lim What do the setpoints do on other vehicle types?

@Jaeyoung-Lim
Copy link
Member Author

@hamishwillee I have replied in the user guide!

@Jaeyoung-Lim
Copy link
Member Author

@sfuhrer Can we get this merged?

@sfuhrer
Copy link
Contributor

sfuhrer commented Oct 24, 2019

@sfuhrer Can we get this merged?

Yes!

@dagar
Copy link
Member

dagar commented Oct 28, 2019

This really makes me think that loiter radius should be a FW parameter rather than navigator.

@dagar dagar merged commit 71fbe58 into master Oct 28, 2019
@dagar dagar deleted the pr-offboard-loiter-sp branch October 28, 2019 21:42
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.

Offboard position setpoints with loiter type mask makes Fixed wing vehicle fly away
4 participants