Hi Experts,

I'm a new comer, im now building a project (using VB.NET) , a Simple GCS to read the attitude (i need pitch, roll, yaw, altitude).

So far i'm exploring this forum, but not solving my problem :(

this is my coding (i have declarations inside a main class), the result then written on datagridview.

    Private Sub btnConnect_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnConnect.Click
        SerialPort1.PortName = cmbPort.Text 'Set SerialPort1 to the selected COM port at startup
        SerialPort1.BaudRate = cmbBaud.Text 'Set Baud rate to the selected value on

        'Other Serial Port Property
        SerialPort1.Parity = IO.Ports.Parity.None
        SerialPort1.StopBits = IO.Ports.StopBits.One
        SerialPort1.DataBits = 8 'Open our serial port

        btnConnect.Enabled = False 'Disable Connect button
        btnDisconnect.Enabled = True 'and Enable Disconnect button

    End Sub

Private Sub Timer2_Tick(sender As Object, e As EventArgs) Handles Timer2.Tick
            intVariable = SerialPort1.BytesToRead
            bufferByte = New Byte(intVariable - 1) {}
            SerialPort1.Read(bufferByte, 0, intVariable)

            For i As Integer = 0 To intVariable - 1
                  ccc = ccc & Convert.ToChar(bufferByte(i))

            DataGridView1.Rows(0).Cells(0).Value = ccc
        Catch ex As Exception
        End Try

but this only shows strange string i don't understand, like :

"þ3ýBeginning INS calibration; do not move plane"

so, could you please help :D

*i attach the screenshot

Views: 448


Reply to This

Replies to This Discussion

The scrambled data you are seeing is actually correct. The APM sends 2 data streams out at the same time on the same channel. (I wont go in to why it does this since I dont know exactly) The first stream is the console text and the second stream is binary data from the vehicle sent in Mavlink format.


There are standard routines around that parse the Mavlink data and which will ignore the text

Here is some code for parsing the data for an OSD, which is based on Sandro Benigno's original MinimOSD code.


You can see what is being sent by looking at the mavlink code for the vehicle:


That is for ArduPlane but there are similarly named files functions in the other vehicle directories.

The code is mainly written in C and C++ as are the Mavlink libraries. I have no idea if there are any Mavlink libraries written in VB.net.

Thanks for reply dude,

Based on the link u give, i still dont understand about the channel (this parameter should be included inside the function)

void Plane::send_attitude(mavlink_channel_t chan)
const Vector3f &omega = ahrs.get_gyro();
ahrs.pitch - radians(g.pitch_trim_cd*0.01f),


so, on what channel should i fill ? do u have any idea? please explain

You can be communicating via mavlink on several channels at the same time. Think different radio frequencies or different serial ports etc. You can set each channel up to send different data.
The channels are given names
but these are enums which are really integers underneath MAVLINK_COMM_0 == 0, MAVLINK_COMM_1 == 1 etc.
Look up C enums for more about how that works.

If you are using  an APM2.x hardware then I think it only communicates on MAVLINK_COMM_0 so chan is set to 0
This also may explain why the console text comes through on the same channel. There are not enough uarts on the APM to put the console on a separate uart

im using APM 2 dude, and i think on this hardware the message ID's sent from it are varies.

im requesting the attitude but the message i receive are so many, there are attitude, altitude, battery, etc.

could you please show me the method to request data stream ??

no matter you use any syntax, C, C++, JAVA, VB, C# i understand those all


Reply to Discussion



Season Two of the Trust Time Trial (T3) Contest 
A list of all T3 contests is here. The current round, the Vertical Horizontal one, is here

© 2020   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service