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

[Bug] Simple Position Control fails to set Position Setpoint after stick movement #23589

Closed
vertiq-luca opened this issue Aug 21, 2024 · 4 comments
Assignees

Comments

@vertiq-luca
Copy link
Contributor

Describe the bug

When MPC_POS_MODE is set to simple position control (0) and the aircraft takes off in position mode the aircraft will hold altitude and position. If the right stick is moved to move the aircraft the position setpoint goes to NaN (as expected). Once the stick is released and the vehicle is in braking mode the setpoint remains as NaN. This prevents the vehicle from holding position and instead just uses 0 velocity as the hold mode which isn't very effective.

To Reproduce

set MPC_HOLD_MAX_XY to 0
set MPC_POS_MODE to Simple position control

Take off

Move right stick (mode 2 radio) out of the deadzone and then release.

Observe either the PID position mode XY graph and see that the setpoint has disappeared or look at the logs for the position setpoint.

Expected behavior

I expected the position setpoint to come back when the sticks are released and the vehicle to maintain position.

Screenshot / Media

No response

Flight Log

https://review.px4.io/plot_app?log=c834a12f-958e-4c93-8d69-4b2b34ca54b6

Software Version

1.14dev

Flight controller

ModalAI Voxl2 Mini

Vehicle type

Other

How are the different components wired up (including port information)

No response

Additional context

I chased this down to this line:

I added some printouts in the if else ladder here and found that it was entering this line, but when printing the position setpoint, it is NaN, even though the printed position is a real number.

It seems like var1.xy() = var2.xy() doesn't work? Altitude seems to work because it's only setting var1(2) = var2(2) instead of using the .xy() function.

@MaEtUgR MaEtUgR self-assigned this Sep 11, 2024
@MaEtUgR
Copy link
Member

MaEtUgR commented Sep 11, 2024

Sounds familiar: #22574
Is that change present on your 1.14dev branch?

@DronecodeBot
Copy link

This issue has been mentioned on Discussion Forum for PX4, Pixhawk, QGroundControl, MAVSDK, MAVLink. There might be relevant details there:

https://discuss.px4.io/t/px4-sync-q-a-sep-11-2024/40625/1

@MaEtUgR
Copy link
Member

MaEtUgR commented Sep 11, 2024

I quickly checked and the fix I linked was backported to 1.14:
#22578
It went into the point release PX4 1.14.1
Can you help by requesting the source for the firmware you're using to always update to the point releases? They contain critical bugfixes like this one.
image

@vertiq-luca
Copy link
Contributor Author

Looks like the change was added 9mo ago in their branch if I understand correctly. I must have had a very old commit as my head. Thanks for pointing me to the correct issue and pull request!

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

No branches or pull requests

3 participants