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

node: ignore messages not sent by the target uas #256

Closed
wants to merge 1 commit into from
Closed

node: ignore messages not sent by the target uas #256

wants to merge 1 commit into from

Conversation

claymation
Copy link
Contributor

This change is intended to prevent heartbeat messages sent
by a GCS from interfering with those sent by the target UAS.

This change is intended to prevent heartbeat messages sent
by a GCS from interfering with those sent by the target UAS.
@claymation
Copy link
Contributor Author

The reason for this PR (and #254) is that my ROS application inspects the "mode" field of the /mavros/state message to determine what it should do: if the FCU (APM) is in GUIDED mode, my code will do one thing, and if the FCU is in any other mode, my code will wait pending further instructions. This is useful for being able to toggle functionality using a flight mode switch on my RC transmitter.

The problem is that my FCU also has attached to it a 3DR radio, over which it receives MAVLink packets from APM Planner. The APM code, for better or worse, forwards all heartbeat messages across all links, causing mavros to receive the heartbeats from APM Planner in addition to those from APM. After #254, the mode strings will be correct, but they will still confuse my code, as it oscillates between GUIDED (from FCU) and CMODE(0) (from GCS).

This change prevents that by filtering out foreign messages upon receipt.

@vooon
Copy link
Member

vooon commented Mar 23, 2015

This change breaks 3dr_radio plugin. Also seems that you breaks UART with multiple connections.
UART (RS232) is point-to-point.

Better connect your modem to OBC and then use gcs_url:=serial://device.

@claymation
Copy link
Contributor Author

Yeah, I'm sure this "fix" has many problems, but I don't think that putting the telemetry modem behind mavros is a fix, either. The telemetry modem provides out-of-band monitoring and control should anything go wrong with my code, mavros, or the OBC. Besides, the Pixhawk has multiple serial ports and APM & PX4 support multiple serial links for a reason.

Really what I'm not understanding is, if MAVLink can support up to 255 devices, why do most GCS's seem to assume there will only be one FCU on the link? mavproxy.py has the same problem that mavros has, namely that it assumes that every heartbeat message it hears is coming from the target system, without actually verifying that.

So I don't know where exactly the fix belongs, but I don't think it belongs in hardware.

@vooon
Copy link
Member

vooon commented Mar 23, 2015

Hm, you mean that you used TELEM1/2 for OBC and modem? But why OBS listens modem messages? Only if APM route it internally, maybe disable this feature?

Initially mavros designed for onboard computer, where two FCU on same link is very unusual.
As i know only QGC, and based on it APM Planner 2 will support multiple UAS connections.

@claymation
Copy link
Contributor Author

Correct, TELEM1 is connected to the radio and the USB UART is connected to mavros. APM automatically forwards heartbeats across all links—there is currently no way to disable this:

https://github.com/diydrones/ardupilot/blob/master/libraries/GCS_MAVLink/MAVLink_routing.cpp#L191

I am happy to submit a pull request to them to make the forwarding optional. It serves no purpose to me, and seems like a waste of radio bandwidth, but I'm sure they have a reason for it.

vooon added a commit that referenced this pull request Mar 23, 2015
vooon added a commit that referenced this pull request Mar 23, 2015
vooon added a commit that referenced this pull request Mar 23, 2015
@vooon
Copy link
Member

vooon commented Mar 23, 2015

Please try my latest changes.

@vooon
Copy link
Member

vooon commented Apr 6, 2015

Any update?

@vooon vooon closed this Apr 6, 2015
@claymation
Copy link
Contributor Author

Yes, this works great, thanks! Sorry for the tardy reply.

@samacumen
Copy link

How can one change System_Id and Component_Id on Mavros?

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

Successfully merging this pull request may close these issues.

None yet

3 participants