Servers by jDrones

Need advice for building your own GCS

We have our own ground control station. We are expanding the capabilities of the program. I want to add support for the MAVLINK protocol. We have the ability to control ARDUPLAN. We have difficulties with connecting ARDUCOPTER. To connect successfully to ARDUCOPTER, first connect ARDUCOPTER to MISSIONPLANNER. After that, there is no connection problem, you can download the route and fly. What MISSION PLANNER sends to the flight controller at the initial stage ???
I do not deal with this issue personally. I’m trying to help our programmer. My question may not be correct.
I expect advice that could help us.

1 Like

To work as a GCS with Mavlink you need to respond to the Mavlink messages every second as it uses this to determine that the GCS is still connected and working. Without this Heartbeat the ArduCopter is going to assume that the GCS has failed and ignore it.


I am writing my own GCS also and I have the same problem like Smolman had.
If I am connected to APM, I can read only ATTITUDE, VRF_HUD and HEARTBEAT messages from APM.
If I am sending a HEARBEAT from my GCS every second, I can read a RADIO and RADIO_STATUS also.
But if I first connect to MISSION PLANNER and after that to my GCS, I can read everything, read and count waypoints etc…
How I have to respond to MAVLink messages exactly to make it work like in MP?

There are enable messages that can be send to tell the Auto Pilot to send these messages and at what rate to send them. You can also set parameters to enable these messages for what serial port you are using in the parameter list.

When you start Mission Planner it probably does that so when you connect you can see those messages.


I have been looking for this couple of days but have found no solution. Trying search through MP source code but it is a bit diffucult to understand.

Hi David,

You can get the rest of the messages by sending a REQUEST_DATA_STREAM message with the rates at which you’d like to receive certain classes of messages.

I’d recommend reading through MAVLink Step by Step - it’s a great guide!


I am sending a REQUEST_DATA_STREAM message:

                         new MAVLink.mavlink_request_data_stream_t()
                             req_message_rate = 20,
                             req_stream_id = (byte)MAVLink.MAV_DATA_STREAM.ALL,
                             start_stop = 1,
                             target_component = ComponentID,
                             target_system = SystemID

DATA_STREAM.ALL should read ALL data. I know it is deprecated now, but it still works isn’t it? Or should I replace it with a MESSAGE_INTERVAL message as recommended?

Yes the guide MAVLink Step by Step is good guide and I have benen readin it already.

One more question. I am sending a HB packet every second to APM with the following code (which is from MP):
if (hbSend.Second != DateTime.Now.Second)
MAVLink.mavlink_heartbeat_t hb = new MAVLink.mavlink_heartbeat_t()
type = (byte)MAVLink.MAV_TYPE.GCS,
autopilot = (byte)MAVLink.MAV_AUTOPILOT.INVALID,
mavlink_version = 3
byte[] htb = mavlink.GenerateMAVLinkPacket10(MAVLink.MAVLINK_MSG_ID.HEARTBEAT, hb);
//Console.WriteLine("Writing packet HB: " + hb);
serialPort.Write(htb, 0, htb.Length);
hbSend = DateTime.Now;

Does the MAV_TYPE.GCS mean, that sysid of my SW is automaticly set to 255?
And if my FC is APM, should I set AUTOPILOT.ARDUPILOT instead of AUTOPILOT.INVALID?

Thank you

Got it finally :joy:

Hey there David, what did you have to change to make it work? Curious in case someone else would like to do something similar :slight_smile:

Hi Sami, I have to say it was my big mistake in my code. A REQUEST_DATA_STREAM message has been prepared, but I have forgotten to send it to the APM :rage:. Now I can read all the requested data.

Good to hear, and good luck!

Servers by jDrones