-
-
Notifications
You must be signed in to change notification settings - Fork 511
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
Add actuator control to offboard plugin #782
Add actuator control to offboard plugin #782
Conversation
Corresponding commit in MAVSDK-Proto: irsdkv/MAVSDK-Proto@d271875
dae4c49
to
60bcc8a
Compare
60bcc8a
to
295fbe4
Compare
Hi @julianoes I tried to implement your suggestion. If I misunderstand something I will be grateful if you will explain it. Thank you! |
@irsdkv what do you think about this suggestion? #771 (comment) So the API would be:
and if the last 8 entries are zero, we only send the message to control group 0, and we don't need to send the message to control group 1. Would that work? |
Unfortunately, due to px4 uORB subscription subsystem, if we need to fill all controls to zero - we should send all-zero message. If we don't do this then |
Ok, what about NAN? |
Hm. I think that this can be a possible solution |
6db0e64
to
3fd30c2
Compare
3fd30c2
to
ea7a971
Compare
to 7 in Group 0 will be set to zero. | ||
If index of first NAN value will be great than 8 then two messages (to | ||
Group 0 and Group 1) will be sent. In this case all controls from first NAN value | ||
to 7 in Group 1 will be set to zero. */ |
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.
Perhaps this description can be more understandable :)
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.
😄 what about:
Up to 16 actuator controls can be set. To ignore an output, set it to NaN.
The first 8 actuator controls internally map to control group 0, the latter 8 actuator controls map to control group 1.
Depending on what controls are set (instead of NaN) 1 or 2 MAVLink messages are actually sent.
Given that description is a bit awkward, would it be clearer, like that:
struct ActuatorControl {
struct Group {
float controls[8];
};
Group groups[2];
}
(Or is that almost what you had suggested in the beginning? Sorry for the long discussion)
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.
All ok, I understand that you just want to construct a good solution :)
struct ActuatorControl { struct Group { float controls[8]; }; Group groups[2]; }
This is the possible solution, but In this case, in my assumption we need to change ActuatorControl structure in Proto too due to API "consistency". It can be like that:
message ControlGroup {
repeated float controls = 1;
}
message ActuatorControl {
repeated ControlGroup control_group = 1;
}
But this will be too comlpicated?
If you just don't want to have field like group_number
in data types then I have this proposal:
struct ActuatorControl {
struct Group {
float controls[8];
};
union {
Group groups[2];
float controls[16];
};
}
In this case current protobuf message can be used.
Also description of usage can be like that:
Up to 16 actuator controls can be set. To ignore an **output group**, set it to NaN.
In case of **all** controls in the group is NaN than this group will not be sent (otherwise all NaN controls will sent as zero).
The first 8 actuator controls internally map to control group 0, the latter 8 actuator controls map to control group 1.
Depending on what controls are set (instead of NaN) 1 or 2 MAVLink messages are actually sent.
What do you think about it?
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.
message ControlGroup { repeated float controls = 1; } message ActuatorControl { repeated ControlGroup control_group = 1; }
But this will be too comlpicated?
I'd say that's fine.
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.
Okay, I will implement it.
In this case the union
is not required.
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.
Done
1e49244
to
05c6028
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.
Thanks, mostly ok, I think.
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.
Great thanks for the continuous changes!
It's a pleasure. Thank you too 😄 |
CI complains about
Try adding |
Looks like the grpc service doesn't quite compile (anymore): |
My bad. Seems like just need to update proto submodule rev |
I think now you only need:
|
Done |
@irsdkv Thanks for all the work! We recently fixed the clang-format issues, that should be fine now. Sorry for the inconvenience there 😅. Can you try |
I think all works ok :) |
Hmm somehow it seems like some styling was still wrong. I pushed a fix, let's hope it works this time :-). |
Oh, sorry. It was my changes. I did it because I thought it was more readable and similarly to other functions like this. I apologize for not telling you this. P.S. Whew. Seems that this pull request has a hard fate :) |
Oh, you're missing some docs (see Jenkins):
Good news is that this is the last CI test 😆 |
Argh, somehow having issues with Jenkins. Trying to fix that. |
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.
Thanks again.
Implementation of set_actuator_control method due to #771 (review).
I think that this solution most corresponds to mavlink message specification compared first PR.
Also in protobuf3 "0" is the default for numeric types so this would hide the complexity.
The corresponding MAVSDK-Proto PR is here.