-
-
Notifications
You must be signed in to change notification settings - Fork 510
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
param_server: implemented change_param_? functions #2085
base: main
Are you sure you want to change the base?
Conversation
Rebasing against main. @julianoes But Edit: Nevermind! Just removed the build folder and rebuild MAVSDK completely. Now it works. |
77fdb0b
to
194f1b9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am sorry if that is a stupid question, but I need to ask it again 🙈:
Given that the change_server_param*
functions have exactly the same signature as the provide_server_param*
ones, and given the fact that change_server_param
anyway has to check if the param already exists or not...
... why can't we keep the current API and just "update" the param if provide is called a second time?
So one could call:
provide_param_int("SYS_HITL", 0); // This initializes the value the first time
[...]
provide_param_int("SYS_HITL", 1); // This changes the value (which was previously set to 0)
Why is that not possible? 🤔
To me it's super weird to say "if you call provide_param
twice for the same param, you'll get an error that you need to handle, and if you call change_param
on a param that was not previously "provided", then you'll get another error that you need to handle".
|
It would not be clearer to me to do
BTW is that a MAVLink limitation? It is a bit sad to not be able to add a param at runtime 😕. |
Quote from https://mavlink.io/en/services/parameter.html#parameters_invariant: "The protocol requires that the parameter set does not change during normal operation/after parameters have been read." That page can explain it better than me, so definitely worth a read 😄 |
Yeah I don't think that there is a reasonable technical reason for that, it's just the way it is designed, I suppose 🤷. Anyway if there is no other way, I am fine for the But again, let's @julianoes be the judge of that 🙈 |
I need to have a closer look at |
I had updated all the third party dependencies in the meantime: #2069. |
@JonasVautherin the technical reason, from what I understand, is that you query all parameters using a "num_params" variable. So, once you start a transfer, you can't have the indices change from under you. I suppose you're saying that this "num_params" variable should only be valid for the time of a transfer. That way you could change it later. |
Yes, I was just saying that the specs say that the number of params cannot change, but I can imagine a protocol that allows for transferring an arbitrary number of variables reliably 🙈. That's why it was not obvious to me at first that MAVLink would have this limitation. |
I vote against turning MAVSDK into a "non-compliant component" and just add the change function to the param_server 😉 |
Sure, I'm all for honoring the specs, that's not what I meant 🤣. Those are still two independent problems, though, and the MAVLink specs don't imply the MAVSDK API in this case. Fine if you guys think that splitting And to me it seems like the intent in the current implementation was to reuse |
🤷♂️ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to catch the case where a provide
is misused and actually changes the param, right? And we should make it really clear in the proto docstring what the difference between provide and change is!
The implementation for mavlink/MAVSDK-Proto#317
Tested in the autopilot_server example, after adding a change_param_int for MY_PARAM from 1 to 2:
Not tested whether other connected mavlink instances receive a PARAM_VALUE after a parameter change.