-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Support filtering incoming messages based on target_id #585
Conversation
5824887
to
94f5b62
Compare
The assumption in this code is that 0 is the sourceSystem for a broadcast message, and I don't think it is. I think that we probably don't see messages unless they are either intended for us or for broadcast. We need to confirm this. Also if 0 was a broadcast message then this still wouldn't help us because that would mean we would be getting any broadcast heartbeats (and these might be setting our mode). Anyway, if I'm right, then we don't need the filter on src != 0. However we do need to consider whether we will process broadcast messages at all. Is there a case where we ever want to read messages from anything that isn't the vehicle? Last of all, we need to think about working out what our target id should be. A default of 1 should work in most cases but we probably should think about code to detect the value if at all possible. Minimally something to help people if connect fails to understand this is a likely cause. |
Remember there are two use cases for DroneKit - at the vehicle end AND as a GCS. The GCS case is where you would want to process ALL vehicle IDs.
|
@mikerob Well you'd want to process all ids, but I think that given the 1:1 nature of the connection between a vehicle and an autopilot you would do that through separate vehicle objects - upshot that changing to only intercept the one specified id makes a lot of sense. What we would need to change to properly support this model though is a better way to discover all the vehicles on the network and return the Vehicle object that makes sense for each. I'd see that as "step2". Perhaps in the mean time have vehicle get only messages from the supported vehicle, and any vehicle if 0 is set as the target. |
dronekit/__init__.py
Outdated
if self._target_system: | ||
src = msg.get_srcSystem() | ||
if src != self._target_system and src != 0: | ||
return |
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.
should we deal with this at the forward_message
level?
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.
this patch mostly makes sense to me, but it uncovers some new scenarios we might have not been ready to address here. What is DroneKit doing now:
What is our core backend good for right now (mavlink):
In theory we should always assume we are not the only link in the network connected to a Flight Controller, this PR makes sense to me because it allows us to filter through vehicle messages, but it doesn't do much with all the GCS (or broadcast) messages, I think we might need to add a new state machine for all the broadcasted messages, this might have a big cost since most users won't really care so we need to be careful how we add this new state machine. @peterbarker just make sure our tests pass and I'll proceed with merging, if you need help I'll gladly commit some time to get this merged this is big. |
94f5b62
to
d065cf2
Compare
@peterbarker are you still working on this? |
On Mon, 29 Aug 2016, Ramon Roche wrote:
@peterbarker are you still working on this?
Yes.
|
627c482
to
7d60fd0
Compare
This looks good Peter. I would like to try it. Can you please rebase ? |
Connections do outgoing heartbeats We look for heartbeats coming from MAVSystems Close connection on vehicle disconnect option
Additionally, it is now a method on a connection not a vehicle
7d60fd0
to
eef45b0
Compare
@amilcarlucas Rebased. |
Good to see you reviving old branches @peterbarker 👍 |
On Tue, 17 Oct 2017, Ramon Roche wrote:
Good to see you reviving old branches @peterbarker 👍
:-)
This and the pymavlink one are some of my biggest disappointments,
actually. They add some really nice functionality, but I haven't managed
to get the pymavlink changes in (yet?).
This one's been pretty stable... a few people have used it relatively
recently IIUC....
|
Thank you @peterbarker ! |
Thank you Peter. Any clues why the tests fail ? |
I'm closing this:
Somebody'll have to work out how we do dronekit-python with multiple targets in pymavlink using the new pymavlink options :-) |
No description provided.