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

MAVLink app: Enable protocol version handshaking #7344

Merged
merged 4 commits into from
Jun 4, 2017
Merged

Conversation

LorenzMeier
Copy link
Member

@LorenzMeier LorenzMeier commented Jun 3, 2017

This allows the ground control station or any other communication partner to query the supported versions. The key aspect is to send the response in MAVLink 2 framing to test the link with a MAVLink 2 framed message.

Before connecting QGC:

instance #0:
	mavlink chan: #0
	no telem status.
	flow control:	OFF
	rates:
	tx: 23.215 kB/s
	txerr: 0.000 kB/s
	rx: 0.000 kB/s
	rate mult: 1.000
	accepting commands: YES
	MAVLink version: 1
	transport protocol: UDP (14556)

After connecting QGC with this extension:

instance #0:
	GCS heartbeat:	988721 us ago
	mavlink chan: #0
	type:		GENERIC LINK OR RADIO
	flow control:	OFF
	rates:
	tx: 30.495 kB/s
	txerr: 0.000 kB/s
	rx: 0.021 kB/s
	rate mult: 1.000
	accepting commands: YES
	MAVLink version: 2
	transport protocol: UDP (14556)

This allows the ground control station or any other communication partner to query the supported versions. The key aspect is to send the response in MAVLink 2 framing to test the link with a MAVLink 2 framed message.
@LorenzMeier LorenzMeier requested a review from bkueng June 3, 2017 09:47
@LorenzMeier LorenzMeier added this to the Release v1.7.0 milestone Jun 3, 2017
@LorenzMeier
Copy link
Member Author

@mhkabir This hopefully makes your life easier on RTK and @bkueng I hope this makes geofencing easier to work with.

@LorenzMeier
Copy link
Member Author

Output on a Pixhawk:

instance #0:
        GCS heartbeat:  593486 us ago
        mavlink chan: #0
        type:           3DR RADIO
        rssi:           219
        remote rssi:    219
        txbuf:          94
        noise:          61
        remote noise:   58
        rx errors:      0
        fixed:          0
        flow control:   ON
        rates:
        tx: 1.285 kB/s
        txerr: 0.000 kB/s
        rx: 0.021 kB/s
        rate mult: 0.366
        accepting commands: YES
        MAVLink version: 2
        transport protocol: serial (/dev/ttyS1 @57600)

instance #1:
        mavlink chan: #1
        no telem status.
        flow control:   OFF
        rates:
        tx: 0.984 kB/s
        txerr: 0.000 kB/s
        rx: 0.059 kB/s
        rate mult: 0.300
        accepting commands: YES
        MAVLink version: 1
        transport protocol: serial (/dev/ttyS2 @57600)

instance #2:
        GCS heartbeat:  909627 us ago
        mavlink chan: #2
        type:           USB CDC
        flow control:   OFF
        rates:
        tx: 15.062 kB/s
        txerr: 0.000 kB/s
        rx: 0.021 kB/s
        rate mult: 1.000
        accepting commands: YES
        MAVLink version: 2
        transport protocol: serial (/dev/ttyACM0 @2000000)

@LorenzMeier
Copy link
Member Author

@dagar Can you review?

@LorenzMeier LorenzMeier requested a review from dagar June 3, 2017 20:18
@LorenzMeier LorenzMeier mentioned this pull request Jun 3, 2017
@dagar
Copy link
Member

dagar commented Jun 3, 2017

Looks good. I was expecting the handshake to be more involved.
While I was looking around I didn't see mavlink v1.0 actually being used anywhere. Is that correct or did I miss something? Can we drop it?

@LorenzMeier
Copy link
Member Author

The simulator interfaces still depend on v1. They use some hacked serialization which assumes v1 and need to be converted to using the correct library calls.

Searching for "v1.0/"

src/drivers/pwm_out_rc_in/pwm_out_rc_in.cpp:
   52  #include <systemlib/pwm_limit/pwm_limit.h>
   53  #include <dev_fs_lib_serial.h>
   54: #include <v1.0/checksum.h>
   55: #include <v1.0/mavlink_types.h>
   56: #include <v1.0/common/mavlink.h>
   57  
   58  

src/drivers/snapdragon_rc_pwm/snapdragon_rc_pwm.cpp:
   54  #include <uORB/topics/actuator_controls.h>
   55  
   56: #include <v1.0/mavlink_types.h>
   57: #include <v1.0/common/mavlink.h>
   58  
   59  #include "drivers/drv_pwm_output.h"

src/modules/simulator/simulator.h:
   58  #include <uORB/topics/optical_flow.h>
   59  #include <uORB/topics/distance_sensor.h>
   60: #include <v1.0/mavlink_types.h>
   61: #include <v1.0/common/mavlink.h>
   62  #include <geo/geo.h>
   63  namespace simulator

Tools/sitl_gazebo/include/gazebo_mavlink_interface.h:
   45  #include <sdf/sdf.hh>
   46  
   47: #include "mavlink/v1.0/common/mavlink.h"
   48  
   49  #include "gazebo/math/Vector3.hh"

@LorenzMeier LorenzMeier merged commit 8c3b900 into master Jun 4, 2017
@LorenzMeier LorenzMeier deleted the proto_ver branch June 4, 2017 08:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants