Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk gyro/acc reads, temperature sensor framework #2846

Merged
merged 4 commits into from
Mar 13, 2018

Conversation

digitalentity
Copy link
Member

This PR changes gyro/acc drivers to read acceleration/temperature/gyro data in one transaction. This should save some bus overhead compared to reading acceleration/gyro separately.

Also introduced framework for temperature sensors. Currently only one sensor - gyroscope/MPU. This temperature readings could be shown in OSD or used in future to compensate for temperature drift of accelerometer.

@digitalentity digitalentity added this to the 1.9.1 milestone Feb 28, 2018
@digitalentity digitalentity changed the base branch from master to development February 28, 2018 06:58
[TASK_TEMPERATURE] = {
.taskName = "TEMPERATURE",
.taskFunc = taskUpdateTemperature,
.desiredPeriod = TASK_PERIOD_HZ(10), // 10 Hz
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm pretty sure it can go down to 1Hz and no one would notice

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, probably. Temperature inertia is quite large.

@shellixyz
Copy link
Collaborator

Might also be used if no other alternative is available to compensate for changes in air density when reading airspeed with a Pitot tube.

@digitalentity
Copy link
Member Author

digitalentity commented Feb 28, 2018

@shellixyz actually temperature compensation of pitot is not needed. Aerodynamically we are interested in mass air flow across our control surfaces which is dependent on air density and TAS. The combined measurement is called IAS (indicated airspeed) and this is exaclty what's measured by pitot tube.

Stall speed is exactly the same at all altitudes/temperatures/air pressures if you look at IAS, however if you look at TAS - stall speed would be higher at high altitudes due to low air density.

From https://en.wikipedia.org/wiki/Indicated_airspeed:

The IAS is an important value for the pilot because it is the indicated speeds which are specified in the aircraft flight manual for such important performance values as the stall speed. These speeds, in true airspeed terms, vary considerably depending upon density altitude. However, at typical civilian operating speeds, the aircraft's aerodynamic structure responds to dynamic pressure alone, and the aircraft will perform the same when at the same dynamic pressure. Since it is this same dynamic pressure that drives the airspeed indicator, an aircraft will always, for example, stall at the published indicated airspeed (for the current configuration) regardless of density, altitude or true airspeed.

@shellixyz
Copy link
Collaborator

Very interesting. I didn't think about that. Learning every day 😃. Still could be used for compensating the TAS if displayed in the OSD.

@digitalentity
Copy link
Member Author

I think showing TAS in OSD could lead to confusion and complaints about stall happening at different airspeeds (TAS). Originally pitot driver was attempting to calculate TAS, but after I realized that IAS is more meaningful to the pilot (and by coincidence easier to calculate) - 1f70cb0 was merged to calculate IAS instead.

@DzikuVx
Copy link
Member

DzikuVx commented Feb 28, 2018

Yes, IAS is all what is really required here

typedef enum tempSensor_e {
TEMP_GYRO = 0,
TEMP_COUNT
} tempSensor_t;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't "tempSensor_e" be more 'enum-like' name? Like most other typedefs in codebase

@Pairan
Copy link

Pairan commented Mar 3, 2018

Temperature
just, as I'm not so deep in all the coding and the ideas, but would this thing be something simply to be connected to an UART or pad:

http://www.analog.com/media/en/technical-documentation/data-sheets/TMP35_36_37.pdf

A mate came up with this for minimosd lately ...

@fiam
Copy link
Member

fiam commented Mar 3, 2018

@Pairan acc/gyro, MCU and baro have their own builtin temperature sensors, so most pilots won’t need any additional ones. The one you linked might be handy to monitor temperature for an specific component (eg a camera inside the fuselage).

@Pairan
Copy link

Pairan commented Mar 3, 2018

ah, I see ... considering myself educated for the moment :)

@digitalentity digitalentity merged commit 00d9492 into development Mar 13, 2018
@digitalentity digitalentity deleted the de_bulk_mpu_read branch March 13, 2018 08:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants