-
-
Notifications
You must be signed in to change notification settings - Fork 504
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
Fix to allow non-flight controller heartbeats to be processed #1760
Conversation
This fix reverts the change, but still allows the warning for new vehicle types.
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.
Actually, this reverts my changes and allows vehicle type to be changed by non autopilot heartbeats again, which makes no sense. Can you brace the vehicle change so it only happens if the autopilot sends it
You’re right, it would. I misinterpreted the intent of your change. Thought
you just wanted to give a warning. I’ll update. And thanks for the review!
…On Tue, May 3, 2022 at 5:18 PM bazfp ***@***.***> wrote:
***@***.**** requested changes on this pull request.
Actually, this reverts my changes and allows vehicle type to be changed by
non autopilot heartbeats again, which makes no sense. Can you brace the
vehicle change so it only happens if the autopilot sends it
—
Reply to this email directly, view it on GitHub
<#1760 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARQH2473DVC6SRO4JV3RVLVIGJ3TANCNFSM5U7K5OXQ>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
@bazfp please confirm the update fixes it |
I tried it and got this kind of output:
🤔 |
I'm sure I'm missing something, but the logic that prints the error message is the same (heartbeat is from an autopilot and the vehicle type has changed). Furthermore, it's odd that the types are not printed out by the warnings. And it works just fine with you in the other version? How can I replicate your test? See anything I'm missing? |
Is the intent of MAVSDK to only support autopilot types? Why would a system not want to receive non autopilot components heartbeats? For example, how would you connect to component 192, which is QGC's component ID with this implementation? The heartbeat protocol doesn't state anything about rejecting heartbeats that aren't autopilot types. It just says to mark them like so
How would a MAVSDK system connect and listen to heartbeats from these other systems? |
No, that's certainly not the intent. A |
I will revisit this in the next days, thanks for the PR. |
There is no point in having a warning when first changing from the initial MAV_TYPE_GENERIC, hence we ignore that.
I've added two commits to prevent it from warning initially, and to fix the actual warning so it shows the MAV_TYPE value properly. @bazfp @JonasVautherin could you check if this works for you like 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.
Seems to be working fine for me, both on sim and on the bench 👍
Ok, I'm going to merge it and revisit later if this doesn't work for you @bazfp. |
This looks like it works for me. The intent of the original change was to stop rogue MAVLink components incorrectly setting the entire system vehicle type for MAVSDK. It was my mistake that it blocked them :) |
Thanks, everyone! |
} else { | ||
const auto new_vehicle_type = static_cast<MAV_TYPE>(heartbeat.type); | ||
if (heartbeat.autopilot != MAV_AUTOPILOT_INVALID && _vehicle_type != new_vehicle_type && | ||
_vehicle_type != MAV_TYPE_GENERIC) { |
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 believe this is a mistake, should this read new_vehicle_type != MAV_TYPE_GENERIC
instead? Otherwise MAVSDK will forever be stuck as generic type.
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.
Just ran into some issues while testing this:
@bazfp ok what about it? 🤔 |
The change from #1752 inadvertantly threw a warning for all heartbeats that came from an "INVALID" autopilot. However, this is acceptable according to the Heartbeat protocol. This small commit fixes that issue.