Pixhawk angle to arduin update rate?

Hello everyone,

I was wanting to feed the euler angle output (which would be supported by the airspeed sensor) from a pixhawk to an arduino? I was then going to use these angles in a custom stabilization algorithm for my VTOL which would be done by the arduino.

Does anyone know the upper limit of how many unique samples of the three angles (yaw,pitch,roll) you can transfer over every second? I think I will probably be needing to transfer over about 50 samples each second…

Thanks

50Hz should be possible at 921600 baud.

Thanks for your reply Amilcarlucas, I do not see this baud rate available through the arduino serial moniter, I’m not sure if that’s a bad thing or not.

Secondly, 50Hz isn’t horrible, but do you know if I could get higher than that, like 100 Hz?

Thanks for your time.

100Hz is high. Did you calculate the baud rate required to transmit the necessary mavlink messages at 100Hz? Will arduino support that baud rate?
My guess is that the arduino is the bottleneck here.

I did not calculate the baud rate, I know essentially nothing about the mavlink communication method between arduino and a pixhawk 4.

Hm, I do see that the arduino serial moniter supports 2 baud rates higher than the one you mentioned. So hopefully the arduino doesn’t limit it too bad.

How do you suggest I verify the fastest transfer rate? Probably just have to buy a pixhawk 4 and try it out myself?

Thanks for your time.

You can calculate the theoretical bitrate by using the bitrate calculation tool: https://github.com/ArduPilot/pymavlink/blob/master/tools/mavtelemetry_datarates.py

But to be sure, yes you would need to test it on real hardware using the very latest master branch firmware.

Thanks for the tip, ill check it out.

Have a good one

Shef

Hey wait amilcarlucas, do you know if the pixhawk updates its angles in response to the input from an airspeed sensor or does it instead takes the airspeed data and then just do something akin to trimming the aircraft without touching its angles?

The angles that are sent and displayed in a GCS are the body angles theta, phi, psi angles. Aerodynamic angles alpha, beta are calculated based on the estimated wind vector.

Hi Tuna Lobster, thanks for your response.

What’s the difference between aerodynamic angles and body angles?

And secondly, do you know which of these angles are sent via mavlink to the arduino using juan’s method, found here: MAVLink and Arduino: step by step

Or perhaps you can receive both?

Thanks

A quick summary of body vs aerodynamic angles is here.

You can request data from the autopilot by sending a MAVLink message or by changing parameters in ArduPilot. @jplopezll program is a great example to start from to send and receive messages. More information on requesting data is detailed here in the documentation. You’ll probably want to request the ATTITUDE message and/or the AOA_SSA message. You can also see a complete list of common and ArduPilot MAVLink messages and all the detailed info that goes along with each message.

TunaLobster,

Thank you for the links, ah, now I understand what you meant by “aerodynamic angles”. If the wind is strong enough from a certain direction, the angle of attack calculated can vary quite widely from the absolute pitch angle relative to the earth. For my project, I must have angles that are relative to the earth and they must be compensated for by airspeed sensors (or gps/GNSS, but ill go with airspeed) so that acceleration can be accounted for-at least in part.

So question for you, are you sure that the body angles as you describe them are not updated with the airspeed measurements?

Body angle have nothing to do with aerodynamics in ArduPilot. Aerodynamic angles are only estimations. There were discussions at one point of adding in a feature for alpha and beta measurements (here), but there hasn’t been any movement on that in a while.

What are you meaning by acceleration compensation?

Hey Tuna :smiley:

“Body angle have nothing to do with aerodynamics in ArduPilot”

quite.

“What are you meaning by acceleration compensation?”

When any IMU is used without a velocity aiding feature (airspeed sensor/ GPS), it will give inaccurate body angles (if only temporarily) when subjected to either

A) Large magnitude linear acceleration
B) Large sustained acceleration (like a plane staying in a banked turn for a while)

So, that’s why I need the body angles outputted from the pixhawk to be supported by an additional filter that accounts for translational accelerations.

also, that post you linked is quite interesting, however magnetic sensors cannot measure or account for the accelerations I speak of much like accelerometers cannot. But thank you for sharing it.

Usually to reset the integrators for the inertial navigation system (INS) a GPS position is used. An airspeed sensor would only help resolve part of the integration problem. You can dive into the code to learn the particulars of ArduPilot take on INS.

Thanks for the tip TunaLobster. Sounds good, have a good one!