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

Multicopter takes off in HOLD on ground #11197

Closed
julianoes opened this issue Jan 11, 2019 · 13 comments · Fixed by #11233
Closed

Multicopter takes off in HOLD on ground #11197

julianoes opened this issue Jan 11, 2019 · 13 comments · Fixed by #11233
Assignees
Labels

Comments

@julianoes
Copy link
Contributor

julianoes commented Jan 11, 2019

I found a regression while running the Dronecode SDK integration tests. Before arming, the SDK sets PX4 into HOLD mode. That way we make sure that a drone does not shoot up right after being armed but always sits on ground and just spins the motors in idle, so this is a safety precaution.

However, after 5887a23 the drone suddenly starts hovering right after arming even though it's in HOLD mode.

The SDK command to test this is:

make && build/default/integration_tests/integration_tests_runner --gtest_filter="SitlTest.ActionHoverAsync"

FYI: @Stifael

https://logs.px4.io/plot_app?log=c387cdf8-120a-4aab-90ca-bcfb559a5ea5

@Stifael
Copy link
Contributor

Stifael commented Jan 11, 2019

It seems that the issue is caused by an other bug, but the changes from 5887a23 makes it now visible.
For whatever reason, if the commander arms in Hold, then Flighttask sends out a thrust-setpoint of 0 instead of NAN.

@julianoes
Copy link
Contributor Author

Ok, what do you suggest to fix it?

@Stifael
Copy link
Contributor

Stifael commented Jan 11, 2019

No suggestion, except of finding the bug. I only spent a couple minutes on trying to find the bug, so I hope that on monday I will figure it out. If it is a time critical issue, then we could revert it

@julianoes
Copy link
Contributor Author

Ok thanks. Maybe @MaEtUgR has an idea too.

@MaEtUgR
Copy link
Member

MaEtUgR commented Jan 13, 2019

@julianoes I found this issue as well when I did some SDK tests such that I learn how to eventually add orbit. Can you check if #11206 fixes it?
EDIT: Just checked, I think it doesn't.

@Stifael
Copy link
Contributor

Stifael commented Jan 13, 2019

@MaEtUgR, as i wrote above, the reason is a thrust-setpoint of 0. If you are in hold, the thrust setpoint should be NAN, otherwise the logic breaks.

@Stifael
Copy link
Contributor

Stifael commented Jan 13, 2019

By the way, if you are in hold during flight, the thrust setpoint is NAN as expected. This, however, is not the case if the drone is put into Hold mode before arming...

@MaEtUgR
Copy link
Member

MaEtUgR commented Jan 13, 2019

This, however, is not the case if the drone is put into Hold mode before arming...

Strange 🤔

I found the minimal revert hotfix: #11207

@Stifael
Copy link
Contributor

Stifael commented Jan 14, 2019

Ok, I know now what module causes it.
The default for auto is now the jerk-limited Flighttask (https://github.com/PX4/Firmware/blob/master/src/modules/mc_pos_control/mc_pos_control_params.c#L681-L688). With this default, there is a thrust and velocity setpoint at the same time, which is not supported. Changing MPC_AUTO_MODE back to Default line tracking (which, by the way is not default anymore), the issue is gone.

@bresch, can you look into it. I think this bug justifies my concern of having two code paths for Auto (AutoMapper vs AutoMapper2) despite sharing similar or even the same functionalities.

@Stifael
Copy link
Contributor

Stifael commented Jan 14, 2019

By the way, this kind of bug can be captured with the integration-test ulog pipeline.

@MaEtUgR
Copy link
Member

MaEtUgR commented Jan 14, 2019

@bresch It's because the zero thrust point of https://github.com/PX4/Firmware/blob/master/src/lib/FlightTasks/tasks/AutoMapper2/FlightTaskAutoMapper2.cpp#L120 gets through when you arm in hold mode. The same line also exists in AutoMapper(1) but for some reason it doesn't get executed in that situation. We should have only one "mapper" implementation if they are copies of each other with the same goal (#11209).

@Stifael
Copy link
Contributor

Stifael commented Jan 14, 2019

@bresch @MaEtUgR in Automapper, the thrust will be set to NAN if the state changes from idle to any other state: https://github.com/PX4/Firmware/blob/master/src/lib/FlightTasks/tasks/AutoMapper2/FlightTaskAutoMapper2.cpp#L61-L62

@bresch
Copy link
Member

bresch commented Jan 17, 2019

@Stifael The issue was not in the AutoMapper but in how the AutoLineSmoothVel FlightTask handled the case where a position setpoint and a velocity setpoint is NAN. That was considered as an unknown command and the velocity setpoint was forced to zero.
https://github.com/PX4/Firmware/blob/ef54bff4ed45755b4762ef58db21fa37d612d44e/src/lib/FlightTasks/tasks/AutoLineSmoothVel/FlightTaskAutoLineSmoothVel.cpp#L178-L181
I made a quick fix to solve it and I'll open a PR soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment