Using MAVLink with Autonomous Autopilot

628 views
Skip to first unread message

valerio...@hotmail.it

unread,
Jan 25, 2012, 12:41:08 PM1/25/12
to MAVLink
Hi, I would know if it was possible to use QGroundControl as GCS for
an autopilot that I've developed wholy in Simulink and that is not
based on commercial autopilots. If it would be possible, how have I to
do?
Thank you very much!

Bryant

unread,
Jan 25, 2012, 1:18:16 PM1/25/12
to MAVLink
It's definitely possible as I'm doing it with my autopilot right now,
though you'll need to be able to interface with C-code. I'm assuming
you are using the Real-time Workshop to generate C-code from your
project and then that's getting compiled? That's how my project is
being built and it's definitely possible if that's the case.

You should first start here: http://www.qgroundcontrol.org/dev/mavlink_onboard_integration_tutorial
and read through that to start. If you use the 1.0 version of MAVLink
some of the code examples on that page are wrong, however, but looking
at /include/common/mavlink_msg_heartbeat.h should clear up any issues.
Also note that the status message needs to be transmit along with the
heartbeat for the vehicle to actually show up in the list of vehicles
in QGC.

Good luck and post with any questions you have as I just went through
this process.

On Jan 25, 9:41 am, "valerio.zane...@hotmail.it"

valerio...@hotmail.it

unread,
Jan 25, 2012, 2:33:21 PM1/25/12
to MAVLink
Thank you for the answer! I'm using simulink and then i compile the
program with Real Time Workshop to generate the C-code. For more
information I've to build the C-code on Arduino Mega Board (that i
would also connect to the GCS QGroundControl). Could you share with me
any examples about the connection with the your own Autopilot? Thank
you for all...any help is very important for me!

valerio...@hotmail.it

unread,
Jan 25, 2012, 2:37:05 PM1/25/12
to MAVLink
"I've to build the C-code on Arduino Mega Board ..."

I'm sorry, to be precise, I wanted to say that I have to UPDATE the C-
code on Arduino Mega board!

valerio...@hotmail.it

unread,
Jan 25, 2012, 2:37:45 PM1/25/12
to MAVLink
Sorry again, UPLOAD is the correct word!

On 25 Gen, 20:37, "valerio.zane...@hotmail.it"

Bryant

unread,
Jan 25, 2012, 4:39:32 PM1/25/12
to MAVLink
I'm not certain if you have this ability with your target device, but
I'm able to call C-functions using a special block directly within
Simulink and so I can call helper functions that patch into the
MAVLink functions to communicate using it. For example I have a block
that calls a function that transmits the MAVLink heartbeat message
over UART1 every .1s. If you aren't able to do this you'll need to use
the 'legacy_code' tool in Simulink to create S-function blocks that
can interface with the MAVLink code. You can find out more about that
tool using 'help legacy_code' at the Matlab command line. Otherwise
you should look up examples on interfacing C code with your target
platform, which it sounds like is the ATMega328 or whatever Arduino
runs on.

Valerio Zanetti

unread,
Jan 31, 2012, 11:17:45 AM1/31/12
to mav...@googlegroups.com
Which is the minimum pack of file that it's necessary to configure the gcs for an autonomous autopilot?

I'm referring to the very basic use of GCS without camera or something like that.

Could anyone specify them?

Help me please!!!!!Thank you all!

Valerio

Bryant

unread,
Jan 31, 2012, 12:26:46 PM1/31/12
to MAVLink
This is a better question for whichever GCS you're actually using and
you should pose these questions to them directly. However if you're
using QGroundControl then you need to transmit both a
MAVLINK_MSG_HEARTBEAT and a MAVLINK_MSG_SYS_STATUS message for
QGroundControl to recognize a vehicle. I set both of these to a 1Hz
transmission rate for my vehicle. And to update the map with the
vehicle position and orientation you'll also want to send
MAVLINK_GPS_RAW_INT and MAVLINK_MSG_ATTITUDE.

If you're using QGroundControl you should post questions directly to
that Google Group: http://groups.google.com/group/qgroundcontrol

valerio...@hotmail.it

unread,
Mar 21, 2012, 4:52:54 PM3/21/12
to mav...@googlegroups.com
Hi Bryant, I've to reconsider this topic because I need a support. As you can read in the old messages I've to link Mavlink to Simulink. I think it would be unnecessary to link Mavlink to Arduino, isn't it? I mean, my arduino is in communication with simulink via serial port through which arrive several information from sensors on the host side. So I only need to pass those serial values to Mavlink; is this reasonment right? I can't see valid reasons to bypass Simulink to link directly Mavlink to Arduino. What do you think? Thank you.

Bryant

unread,
Mar 21, 2012, 9:34:20 PM3/21/12
to mav...@googlegroups.com
Unfortunately I don't really understand your question. I'm not processing any of the MAVLink data within Simulink. I have Simulink compiling down to run on my microcontroller and then only QGC is receiving it.

Bryant

Valerio Zanetti

unread,
Mar 22, 2012, 8:53:52 AM3/22/12
to mav...@googlegroups.com
Ok Bryant, it's exactly what I was asking. So you don't pass throuh Simulink to connect the microcontroller to QGC. My issue now:

How can I connect for example the switch block (in simulink) for manual/auto mode to the main screen of QGC?

In the same way, how can I send the uplink log file for waypoints?

Thank you!

Valerio

Date: Wed, 21 Mar 2012 18:34:20 -0700
From: susu...@gmail.com
To: mav...@googlegroups.com
Subject: Re: [MAVLINK] Re: Using MAVLink with Autonomous Autopilot

Bryant

unread,
Mar 22, 2012, 11:44:39 AM3/22/12
to mav...@googlegroups.com
Unfortunately I can't help you here. Your questions are all too dependent on your environment, which I know nothing about. As for the waypoints, you need to use the mission protocol (http://qgroundcontrol.org/mavlink/waypoint_protocol).

Best of luck,

Bryant

Valerio Zanetti

unread,
Mar 22, 2012, 12:07:06 PM3/22/12
to mav...@googlegroups.com
Ok I see, thank you anyway. Can I ask you if it's enough adding files to /thirdparty/mavlink/MyAutopilot folder to link the microcontroller to QGC? Can you help me in the general steps to follow for linking to QGC (without referring to my specific platform)?

Thank you!

Valerio


Date: Thu, 22 Mar 2012 08:44:39 -0700

Bryant

unread,
Mar 22, 2012, 12:10:03 PM3/22/12
to mav...@googlegroups.com
I don't understand what you're asking. You mean you have your own version of MAVLink and you're trying to get QGC to understand it? If that's the case you can just replace the MAVLink code within QGC with your own code. So I just delete all the header files under thirdpart/mavlink/include I think and replace it with my own MAVLink version (which includes the common messages). I'm not certain how it's supposed to work, but that's what I do.

Bryant

Valerio Zanetti

unread,
Mar 22, 2012, 12:17:56 PM3/22/12
to mav...@googlegroups.com
Ok sorry it's my fault about misunderstanding. I have an Autopilot absolutely mine (so no ardupilot, no ualberta,.. none of them listed inside the folder thirdparty/mavlink/include) that runs on a microcontroller .

Ok, the question is: which steps have I to follow to link my autopilot to QGC? which are the necessary files in the folder thirdparty/mavlink/include?

Thank you. I hope this is clearer.

Valerio


Date: Thu, 22 Mar 2012 09:10:03 -0700

Bryant

unread,
Mar 22, 2012, 12:35:32 PM3/22/12
to mav...@googlegroups.com
I just delete ALL of their files in the mavlink/include folder and replace them with my own. I generated my own MAVLink version with pymavlink and stuck those generated files into the thirdpart/mavlink/include folder.

Also you don't need to create your own MAVLink implementation right away to start using QGC with your autopilot. In fact most of the messages you'll be sending are straight out of common.xml. I'd recommend not dealing with your own MAVLink version until you get the common messages up and running (for example HEARTBEAT and SYS_STATUS, which are the bare minimum for QGC to recognize your vehicle).

Bryant

Valerio Zanetti

unread,
Mar 22, 2012, 1:06:10 PM3/22/12
to mav...@googlegroups.com
Ok thank you, Bryant.

How many files compose your own MAVLink version? Does it depends on the specific platform?

Thanks!

Valerio


Date: Thu, 22 Mar 2012 09:35:32 -0700

Bryant

unread,
Mar 22, 2012, 4:04:22 PM3/22/12
to mav...@googlegroups.com
pymavlink generates all the files I need, I only have about 8 or so
custom message and pymavlink generates 1 .h file for each message along
with some extra helper files, so I don't know how many total.

Bryant

On Thursday, March 22, 2012 10:06:10 AM, Valerio Zanetti wrote:
> Ok thank you, Bryant.
>
> How many files compose your own MAVLink version? Does it depends on
> the specific platform?
>
> Thanks!
>
> Valerio
>

> ------------------------------------------------------------------------

> ------------------------------------------------------------------------


> Date: Thu, 22 Mar 2012 09:10:03 -0700

> From: susu...@gmail.com <mailto:susu...@gmail.com>
> To: mav...@googlegroups.com <mailto:mav...@googlegroups.com>


> Subject: Re: [MAVLINK] Re: Using MAVLink with Autonomous Autopilot
>
> I don't understand what you're asking. You mean you have your own
> version of MAVLink and you're trying to get QGC to understand it?
> If that's the case you can just replace the MAVLink code within
> QGC with your own code. So I just delete all the header files
> under thirdpart/mavlink/include I think and replace it with my own
> MAVLink version (which includes the common messages). I'm not
> certain how it's supposed to work, but that's what I do.
>
> Bryant
>
> On 3/22/12 9:07 AM, Valerio Zanetti wrote:
>
> Ok I see, thank you anyway. Can I ask you if it's enough
> adding files to /thirdparty/mavlink/MyAutopilot folder to link
> the microcontroller to QGC? Can you help me in the general
> steps to follow for linking to QGC (without referring to my
> specific platform)?
>
> Thank you!
>
> Valerio
>

> ------------------------------------------------------------------------


> Date: Thu, 22 Mar 2012 08:44:39 -0700

> From: susu...@gmail.com <mailto:susu...@gmail.com>
> To: mav...@googlegroups.com <mailto:mav...@googlegroups.com>


> Subject: Re: [MAVLINK] Re: Using MAVLink with Autonomous Autopilot
>
> Unfortunately I can't help you here. Your questions are all
> too dependent on your environment, which I know nothing about.
> As for the waypoints, you need to use the mission protocol
> (http://qgroundcontrol.org/mavlink/waypoint_protocol).
>
> Best of luck,
>
> Bryant
>
> On 3/22/12 5:53 AM, Valerio Zanetti wrote:
>
> Ok Bryant, it's exactly what I was asking. So you don't
> pass throuh Simulink to connect the microcontroller to
> QGC. My issue now:
>
> How can I connect for example the switch block (in
> simulink) for manual/auto mode to the main screen of QGC?
>
> In the same way, how can I send the uplink log file for
> waypoints?
>
> Thank you!
>
> Valerio

> ------------------------------------------------------------------------


> Date: Wed, 21 Mar 2012 18:34:20 -0700

> From: susu...@gmail.com <mailto:susu...@gmail.com>
> To: mav...@googlegroups.com <mailto:mav...@googlegroups.com>


> Subject: Re: [MAVLINK] Re: Using MAVLink with Autonomous
> Autopilot
>
> Unfortunately I don't really understand your question. I'm
> not processing any of the MAVLink data within Simulink. I
> have Simulink compiling down to run on my microcontroller
> and then only QGC is receiving it.
>
> Bryant
>
> On 3/21/12 1:52 PM, valerio...@hotmail.it

> <http://groups.google.com/group/qgroundcontrol>
>
>
>
>

Reply all
Reply to author
Forward
0 new messages