lee

  • *
  • 42
about uavtalk
« on: January 07, 2016, 08:54:29 am »
Hi, all
I am learning the uavtalk protocol, but I can not understand the "Data" field, could you help me please?

For example, the message of "mag sensor" as followed, there are 26 bytes in the "Data" filed:
Code: [Select]
*******************************************************
--- Mag Sensor Structure ---
Sync(1): 3c
MsgType(1): 22
Length(2): 26
ObjID(4): 70dad456
InstID(2): 0
Data(26): 00 00 39 c3 00 00 c8 42 00 00 55 43 00 00 00 00 2c 23 0d 3f b9 1f 23 40 ca 6b
Crc(1): 46
*******************************************************
--- Mag Sensor Structure ---
Sync(1): 3c
MsgType(1): 22
Length(2): 26
ObjID(4): 70dad456
InstID(2): 0
Data(26): 00 00 35 c3 00 00 e0 42 00 00 5b 43 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Crc(1): 35

But in the soure code file "magsensor.h", I found the different data structure definition, it has 16 bytes only:
Code: [Select]
typedef struct {
    float x;
    float y;
    float z;
    float temperature;
} __attribute__((packed)) MagSensorDataPacked;

Then, I noticed that there may be eight bytes of metadata in this message, but 16 plus 8 equals 24, it is also two bytes less...

Also, I do not know which is the mag of data bytes, which bytes of data are mata...
Could give me some suggestion please? Looking forward to your reply.

Best Regards!

lee

  • *
  • 42
Re: about uavtalk
« Reply #1 on: January 07, 2016, 09:11:14 am »
Oh, I am wrong, "Length" means "Length of header and data, not checksum".
Now, the result looks like this:
Code: [Select]
*******************************************************
--- Mag Sensor Structure ---
Sync(1): 3c
MsgType(1): 22
Length(2): 26
ObjID(4): 70dad456
InstID(2): 0
Data(16): 00 00 35 c3 00 00 d6 42 00 00 56 43 00 00 00 00
Crc(1): 31
« Last Edit: January 07, 2016, 10:16:18 am by sstc lee »

lee

  • *
  • 42
Re: about uavtalk
« Reply #2 on: January 09, 2016, 10:33:21 am »
Hi, friends
I set the FlexiPort for telemetry, and it output all of the OBJECT messages.
Now, for example,  if I don't want the "MagSensor" message, how to modify the source code?
Could you help me, please?
Best Regards!

m_thread

  • *****
  • 87
  • GCS is my home
    • LibrePilot
Re: about uavtalk
« Reply #3 on: January 09, 2016, 11:03:18 am »
Hi
You don't modify the source code to change the set of information sent over the telemetry link. You go in to the GCS and changes the Metadata for each UAVO you want or don't want to be sent including the update method and rate. Look in the UAVO browser in the System tab in GCS. If you can't figure it out, just ask and I or someone else will help you for sure.

Re: about uavtalk
« Reply #4 on: January 09, 2016, 05:34:21 pm »
Start by going to System tab; press the eyeball, enable "Show Metadata"

Go into "Data Objects" and for each item you don't want to see, go into MetaData and disable stuff.

lee

  • *
  • 42
Re: about uavtalk
« Reply #5 on: January 10, 2016, 02:32:28 am »
Hi, m_thread and Cliff, thank you very much!
According to your reply, I have disabled the "Mag Sensor" data successfully.
"MetaData"  is also uavtalk object, I read the source code, and I think it's OBJID is the ID of corresponding item plus 1.
Code: [Select]
#define MetaObjectId(id) ((id) + 1)Do I understand it right, please?

Re: about uavtalk
« Reply #6 on: January 10, 2016, 02:56:13 am »
That sounds correct. I have never had to program to change the MetaData.

lee

  • *
  • 42
Re: about uavtalk
« Reply #7 on: January 10, 2016, 03:21:41 am »
I want to know how the uavtalk works, and I have tested it as we guessed it.
The result as followed:
Code: [Select]
*******************************************************
--- Mag Sensor Meta Structure ---
Sync(1): 3c
MsgType(1): 22
Length(2): 18
ObjID(4): 70dad457
InstID(2): 0
Data(8): 50 00 d0 07 00 00 00 00
Crc(1): b
Thank you for your reply again!
I will continue to research the communication between flightcontrol and GCS.

Best Regards!