Voice Announcement Flight time

Just wondering if there is a way to have qGroundcontrol announce flight time whilst flying. I have found this handy on my Taranis but now I am flying with an integrated controller and display… I don’t have that timer announcement and miss it.

Just asking.

1 Like

I am not totally sure, but as far as I know, there is no such message in MavLink and it seems like every application like MP, QGC taranis etc. have their own timer. i.e when they get a MavLink message like arm or set home or another event that indicates takeoff or something like that, they reset this timer to 0 and than simply present it as flight time. The message you have in the taranis is probably from taranis and not from the FC.
And I truly wonder why there is no such functionality in MavLink?
Just my 2C

He Thanks Gal
I don’t think it’s a mavlink function. I think that qGRoundcontrol should be able to announce the flight time numbers as it already reports them on the screen. So its a known value…not sure about it’s accuracy but the value is know. So the app would just need to announce the value.
I did read late last night that there is a request in to have this feature in QGC but it is not there today.
So here’s hoping to it getting into an update sooner then later.

1 Like

Makes sense, each application is implementing it’s own functionality for this feature, because flight time is not in MavLink.

Nope. Not currently supported.

1 Like

Any news on this question.
Trying to determine if there is a way to voice announce flight time or battery percentage.
Hoping things have changed since I first asked this.

I don’t have much experience with QGC, but it appears to support text-to-speech voice warnings for GCS messages of a certain severity (MAV_SEVERITY_WARNING or higher, I think).

So if the flight time feature that you want isn’t yet natively supported, you could use an onboard Lua script to periodically send flight time GCS messages with gcs:send_text().

I have no clue how to do that.
Also does Lua Scripting work on Android.??

It’s run on your flight controller itself, so long as you have at least 2MB of flash.


interesting. Thank you.
I will give it a read

So it appears there is both a voltage value and a flight time value.
I imagine it might be possible to convert ms to Minutes and send the message to the GCS…no idea how at this point.
More reading.
voltage( instance ) - Returns the voltage of the selected battery instance.

get_flying_time_ms() - Returns time in milliseconds since the autopilot thinks it started flying, or zero if not currently flying.

Well I am giving it a try
This is what I have so far. lol

function FlightTime() – periodic function that will be called
local Flight_timeMIN = math.tointeger (vehicle:get_flying_time_ms()*0.000016667) – Convert to minutes integer
gcs:send_text(0, Flight_timeMIN & " Minutes") – send the traditional message

You have the bare bones there. The concatenate operator in Lua is .. rather than an ampersand.

I don’t think the math library supports tointeger(). You are probably looking for math.floor()

There’s a TON of info in this live stream that I presented last week.

I haven’t tested this, but it should work:

local RUN_INTERVAL = 30000

function flight_time()
    local ms = vehicle:get_flying_time_ms()
    if ms < 1 then return flight_time, RUN_INTERVAL end  -- skip if we aren't flying
    local mins= math.floor(ms / 60000)
    gcs:send_text(MAV_SEVERITY_WARNING, tostring(mins) .. " Minutes")
    return flight_time, RUN_INTERVAL

return flight_time()

OK … not Ampersand…good to know.
This is where I got the Integer function. But hey if it’s not needed sweet.
I assume I need to copy this into a file of some sort ending with .Lua.
But what I don’t understand is how does it start or does it start simply because it’s in the Lua Script folder and I have set SCR_ENABLE to 1.

Ah, ok. The math.tointeger() function doesn’t exactly do what you expect. Use math.floor() instead.

As long as the script is named something like flight_time.lua and resides in the scripts directory with SCR_ENABLE=1, it should start automatically.

Awesome thanks Yuri I really appreciate it.
I will have a look at the live stream as soon as I can. This might give me some of the features I have often thought about.


1 Like

So I got out to the field today with the script installed but no announcement. I am unsure how to check to see if it ran or if it worked. @Yuri_Rage

At a minimum, you should see the messages scroll by on the messages tab/screen. Again, I’m not sure how QGC works with respect to text-to-speech.

I think I may have found why it’s not working.
In this documentation it stats the function is “vehicle:get_time_flying_ms() end”

However in the script it’s written.
I suspect this is a good reason it didn’t work.

Replace it with vehicle:get_time_flying_ms() then.