How to read parameters with Telemetry

Hello guys,

I’m very newbie to qgroundcontrol. After I customize original firmware ( only multicopter position control section) with fuzzy logic which updates p,i,d values depending upon velocity error and velocity error derivative. I want to make sure that this logic works well. In order to understand, I want to read some parameters in code while quadcopter moves. Is there any option to do ?

Do you have these values stored as real parameters? If so, you can just refresh the parameters from parameter editor to download new values.

This should already work through telemetry (QGC) if you create new parameters that are defined with PARAM_DEFINE_FLOAT or PARAM_DEFINE_INT32.

@dagar @DonLakeFlyer Thank you for your replies. I’ve check parameters section but i want to obtain variable values which is changing during fligh( like pitch, yaw and roll in main screen widget ). The variable that i want to obtain is vel_p vector in mp_pos_control_main.cpp

You’ll need to get the data out over mavlink. The existing messages are defined here.

1 Like

Thank you so much for your advise. I’ve read the link that you send and tried to understand concept with reading In Mavlink section there is an alternative way to creating custom mavlink message which is called Debug Values. (

Is it possible to do with that way. Can i see the variable that i want through qgroundcontrol with that way. I’ve tried to implement example to my code but it gives error because of C normal and C ++ compatible issue. Example is given as C code. Error occurs because of struct debug_key_value_s dbg ={.key"vel",.value=0.0f}; part which is not C++ compatible.

I’ve never used debug values personally, but it looks like a great option for this.

If you’re hitting issues with initialization like that just keep it simple and do it like this.

struct debug_key_value_s dbg;
dbg.key = "velx";
dbg.value = 0.0f;
1 Like

In this tutorial there are 3 steps to add.

First step is adding a header.

#include <uORB/uORB.h>
#include <uORB/topics/debug_key_value.h>

Second step is advertising the debug value topic in front of main loop.

struct debug_key_value_s dbg = { .key = “velx”, .value = 0.0f };
orb_advert_t pub_dbg = orb_advertise(ORB_ID(debug_key_value), &dbg);

This code snippet is changed with your advise.

struct debug_key_value_s dbg;
dbg.key = “velx”;
dbg.value = 0.0f;

Last step is sending in main loop. I’ve add this code just after manupulating _params.vel_p value.

dbg.value = _params.vel’_p(0);
orb_publish(ORB_ID(debug_key_value), pub_dbg, &dbg);

I’ve tried different combinations in order not to get error. When i add

struct debug_key_value_s dbg;
dbg.key = “velx”;
dbg.value = 0.0f;

code in front of main loop. It gives ‘dbg’ does not name a type error.

After this I’ve moved dbg.key and dbg.value part in main loop just before changing the value that i want to observe and it gives incompatible types in assignment of ‘const char[5]’ to int8_t[10] error.

If I erase dbg.key part in code it complies without error but i don’t see the result in analyze widget in qgroundcontrol. There is no variable which gives the value that i want. Do you have any idea to solve. If you would have same problem how would you solve. I’m new to pixhawk environment and Mavlink looks hard to understand completely. Can you sort me basic steps about how to get _params.vel_p variable in mc_pos_control_main.cpp

Thank you so much for your attention.

Did you include the uORB header?

#include <uORB/topics/debug_key_value.h>

For sure. I’ve added <uORB/topics/debug_key_value.h> and #include <uORB/uORB.h>

I’ve finally get the results with debug key value method as I mentioned before. I’m changing the debug key value and publishing in mc_pos_control_main.cpp. It is now visible in qgroundcontrol analyze widget. But it’s only visible when i connected with usb cable. When i try to connect with telemetry I can’t see it. Do you have any idea.

I can’t see that value when i connect with telemetry.

Do you have any idea? I can see the values on USB but still can’t find why my values are not visible when i connect with Telemetry.

It looks like debug isn’t streamed by default over a regular telemetry.

You can request the stream over mavlink, or start the telem instance in a different mode.

I have the same problem!
I can’t assign a name to my variable like “velx” i get the same error incompatible types in assignment of ‘const char[5]’ to int8_t[10]
Did you solved the problem?