For anyone interested, I've tweaked the OSD firmware to add a timer and a " time to battery empty" indicator.

The timer is very simple and just starts counting when the speed is over 3m/s so you can get the flight time

The time left function attempts to give you an idea of how much time is left until your battery hits a hard coded 11.1v . Thus it's only useful for 3 cells right now, but I'm adding a feature to let you set what the min voltage should be.

It works in a pretty simple way - it just checks the battery voltage every 30 seconds and uses the last five readings to construct a linear regression and then estimate the time left until the battery hits 11.1v.

Of course if you are putting the throttle up and down and doing aerobatics it will be very wrong, but for steady autonomous flying between waypoints it is reasonably useful. The first readings won't appear until after 3:00 of flight when it has the first five readings.

Anyway, just a bit of fun. The attached zip has an updated OSD_config.exe with two new features of Timer and TimeLeft. There is also the new firmware hex file in there with the features that you will need to upload using the OSD_Config tool.

This is kind of alpha, so please don't use if you are relying on your OSD for life and death work!

I've got some ideas to make the OSD and config tool a lot more flexbile in terms of what you can display in there so will try and see how far I can push it over the next few months - when I get some spare time!

Regards

James

Views: 199

Attachments:

Reply to This

Replies to This Discussion

Hi James,

I am interested! :)

Could you share the code you inserted?

I have also made a few changes by the help of the community, like airspeed, home alt, etc. 

I was planning to add flight time also, but as you have already made it, it would be nice to use it. :)

We can put together a version that does it all, if that is ok with you. ;)

Hi Gabor,

Nice work!

The code for the timer is very simple. In OSD_Panels.pde, in the function writePanels, I have an elapsed time counter that is triggered when airspeed rises above 3m/s. 

- this is from inside writePanels

if(startTime > 0)
{
  elapsedTime = (millis() - startTime)/1000;
}

else
{
  if(osd_groundspeed > 3)
  {
    startTime = millis();
  }
}

Printing the time elapsed is a simple matter of using the elapsed time variable

void panTimer(int first_col, int first_line)
{
  if(elapsedTime > 0)
  {
  osd.setPanel(first_col, first_line);
  osd.openPanel();

  osd.printf("%c%2i%c%02i", 0xFB,(elapsedTime/60)%60,0x3A,elapsedTime%60);

  osd.closePanel();

}
}

You will need to add an elapsedTime and startTime variable to the OSD_Vars.h file (it's a long)

You will also need a slot to put the timer in the panel arrays for locating each panel. I overwrote a current panel as I wasn't using it. I'm not sure how many new panels it can handle, but you will need to modify the config tool as well to suit whatever changes you made.

I have attached a zip of the code files, as well. Other changes in this code include

  • a function to show the next waypoint number when flying in auto mode,
  • a time left function that calculates the time left to empty battery from a linear regression (this is a waste of time, I am going to remove it),
  • alt is relative to the home location
  • velocity converted to km/hr

Regards

James

Attachments:

Thank you James,

How did you make config tool?

I added my functions to existing panels, so i can use the old config tool, but i like your workaround much better. :)

Did you use visual studio?

The config tool is a c# application. I just used visual studio express 2010 to compile it. I am also using the arduino plugin for visual studio for the osd and other stuff, its far better than the arduino ide.

I think the ultimate osd config tool would be more flexible and allow you to select any mavlink message and build an overlay from it, rather than just copying what other osd config tools do and give you a set of predefined choices. If I ever get some spare time, thats what i will build.

Cheers

James

Thank you James,

Now my OSD is getting better, and better. ;)

RSS

Social Networking

Contests

Season Two of the Trust Time Trial (T3) Contest has now begun. The fourth round is an accuracy round for multicopters, which requires contestants to fly a cube. The deadline is April 14th.

A list of all T3 contests is here

Groups

Advertisement

© 2013   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service