tobiz / OGN-Flight-Logger

Python APRS/OGN program to log flight times, durations and maximum heights achieved
GNU General Public License v3.0
0 stars 4 forks source link

Missing Parantheses in call to 'print' #5

Closed preshantram closed 9 years ago

preshantram commented 9 years ago

Dear,

Thanks for the script, only I have the following issue when trying to execute the python script.

Could not find libfap.py but It's in the same folder.

image

tobiz commented 9 years ago

Interesting. I've only tested my script on Ubuntu & Rasparian (ie Linux) where the code in module libfap.py works. If you look at the code it does say "This might find the dll for Windows, but it has not been tested"; I copied this code from elsewhere. I take it you have installed the "C" library dll for libfap? The python module libfap.py depends on the "C" library libfap (it says this in the README). If the released libfap.py didn't have a bug the module libfap.py in my code would not be needed but you would still need to install the "C" libfap. If you haven't installed this see: http://www.pakettiradio.net/libfap/. If you have then it would be useful if you could sort out what needs to change; I don't have a Windows machine to test on. The error msg you've got is the result of failing to find the "C" libfap dll, (ie 'Could not find libfap.'). it's not due to not finding libfap.py. I hope that's clear.

preshantram commented 9 years ago

Thanks for the fast response Tobiz. I am getting slightly farther within debian. Only struggling open_db: no module named open_db

tobiz commented 9 years ago

First things first. In response to your issue re 'requests' (which it looks like you've sorted) you also need to install Python package 'requests', see https://pypi.python.org/pypi/requests. Guess I missed that one!

Easiest way to install Python packages is to run sudo pip install NAME-OF-PACKAGE-YOU-WANT

Of course this does require that you have 'pip' but that can be installed by apt-get.

Good luck.

tobiz commented 9 years ago

Ok, I see you've progressed. I'm pretty sure I've got sqlite3 installed, is that what you've got? BTW your white on black screen shots aren't easy to read, black on white is much easier.

preshantram commented 9 years ago

Thanks Tobiz ;-).

Currently I am trying to get the module "open_db".

tobiz commented 9 years ago

Re pysqlite, this looks like you need a python development package installed from the missing Python.h msg (well I think that's what it says, my Dutch isn't that good)

preshantram commented 9 years ago

I managed to fix that problem indeed by installing python-dev. Only I can't find the open_db module.

tobiz commented 9 years ago

It's a local module. I forgot to upload it - it should be there now.

preshantram commented 9 years ago

Thanks that worked Tobiz! Only having some server problems now ;-).

image

tobiz commented 9 years ago

Excellent! Thanks for your help in solving some of these issues. It's all too easy to think it all works when you're working on your own local copy. Not sure why you're having problems connecting to APRS; you are using the URL in the code I take it?

preshantram commented 9 years ago

I am using the following settings Tobiz,

APRS_SERVER_HOST = "aprs.glidernet.org" APRS_SERVER_PORT = 14580 APRS_USER 'PythonEx' APRS_PASSCODE = 32229

Thanks in advance.

Edit: I think it's firewall blocking the connection ;-) ---> works great with a hotspot on my phone!, thanks!

tobiz commented 9 years ago

Good to hear it's working. I'm not sure the end of day processing of flights is correct yet, problem at the moment is getting the data. Interested to know if you find any problems.

preshantram commented 9 years ago

I was able to receive some data from the default airport. We're are about to fly today, what are the steps for configuring this? We got a receiver near the field.

I see a array in the flogger.py for the aircraft, but what's the idea behind this?

Thanks!

tobiz commented 9 years ago

What's your airfield name as it appears in APRS data? The default is "SuttonBnk", see line 635 in flogger.py. This needs to be changed to your airfield name, rather the name of your local flarm receiver which puts data on APRS. I'll change this at some stage to put it in settings.py. BTW we didn't do much flying today, wind too strong, so you'll only see a few records.

preshantram commented 9 years ago

I would like to see some data comming in from EHWO , woensdrecht in the netherlands. I see some activity over there, I changed the flogger.py SuttonBnk to EHWO but it's still trying to get data from SuttonBnk

tobiz commented 9 years ago

Since Sutton Bank is listed on http://wiki.glidernet.org/list-of-receivers#toc22 as SuttonBnk and EHWO appears on http://wiki.glidernet.org/list-of-receivers#toc13 as just that then replacing "SuttonBnk" by "EHWO" is the first thing to change. If you wait I'll generalise the code to put the site code in settings.py. I can't do this till after sunset as I'm running a flogger test at the moment and for some reason 2 connections to APRS kills one of them. After sunset when the test processes the days data I can stop it after looking at the results. Hope that's ok.

tobiz commented 9 years ago

When you ran your flogger.py with my settings as I said it would, it killed mine (ie I can't run two at once)! Not sure why this happens, either username/password or location issue. I've added more parameters to settings.py. You need to set up all the ones for your site, eg lat/lon coords, airfield name etc. The aircraft table was for recording the aircraft in the club fleet; probably not needed now (but might be useful later)

preshantram commented 9 years ago

Still wasn't able to capture some data today, This is my next issue, it's waiting for sunrise but it's still daylight.

image

tobiz commented 9 years ago

I see it has calculated sunrise as 21:27:59 and sunset at 13:05:41 on 13th, which does look a bit strange! It suggests it thinks it's in a very, very interesting location on the Earth where sunrise occurs after sunset on the same day - I wonder where that could be? If you look at the output where it determines if it's daytime or night time it says the GPS coords are: Latitude 52:11:30.1 which sounds about right, ie the Netherlands is ~ same lat as UK, ok. But the Longitude is 5146300:00:00.0!! I suspect longitude is in the range 0-360 which makes the logged value as ~14,000 times round the Earth, no wonder ephem has got confused! I suggest you've got the GPS coords wrong in settings. I suspect it should be ~ +1.0, ie Netherlands is east of Greenwhich, Sutton Bank is west of the meridian ie longitude -1:12:34.7.

preshantram commented 9 years ago

Ah i see, I made a small mistake :smiley: But I changed it too 51.256199 , 3.8935000 And it says sunset is 19:26. thats about right, only exactly 2 hours diffrence

tobiz commented 9 years ago

If I put your GPS coords in a test program I have (which is v.similar to what's in flogger.py) I get (this was run at 20:15:30 UK time):

Is it light at Location? No Ephem date is: 2015/5/13 20:15:30 Next sunrise at: 2015/5/14 03:55:23 ----------------Part 2------------------------------ Previous sunset: 2015-05-13 19:25:34.926860 Previous sunrise: 2015-05-13 03:56:54.808461 Next sunset: 2015-05-14 19:27:05.666796 Next sunrise: 2015-05-14 03:55:22.969170 Is it light at Location? No. Process todays flights Wait till sunrise at: 2015-05-14 03:55:22.969170 Elapsed time: 7:39:52.805925 . Wait seconds: 28192.

It looks ok to me but it might be that ephem is working is UTC. This is controllable ie timezone, but at the moment is it worth it I ask myself. The intention is just not to record when flying is unlikely. The slight difference from what you get is due to elevation=0.0m horizon=0:00:00.0, flogger.py has better values for these.

tobiz commented 9 years ago

I should warn you I've just discovered processing the daily records doesn't work; I'm looking into it.

preshantram commented 9 years ago

Hi Tobiz,

If I am right the flights will be putted in the databse after sunset? So there aren't any possibilities for doing this directly for making a live feed on my website?

Thanks in advance.

tobiz commented 9 years ago

A couple of points. I think you started your flogger.py at 18:37 UK time which resulted in mine returning zero length packets. I think that to avoid this you need to establish your own values for APRS_USER and APRS_PASSCODE # See http://www.george-smart.co.uk/wiki/APRS_Callpass for how to do this. If you use the existing values in settings.py then only one instance will run successfully. 2) Yes the processed flight data is put in the database at sunset, at the moment. The processing of the flight records tries to remove those that are non-flights, eg ground movements. It then tries to work out which successive records are really a single flight because the time between them is too short. Having built a table of these flights it then works out the total flight time for each flight and the max altitude. The final table is the record of the days flights. The original objective of the code was to automate the daily flight log rather than having it on paper. It might be possible to workout how to make this a live feed to a website and I will consider doing this, however I need to concentrate on making the basic idea work reliably, once that's been achieved enhancements can and will be considered. If you have any ideas how to modify the code for a live website feed why not fork the master and develop your ideas there. Once you've got something working I can consider merging it back into the master.

preshantram commented 9 years ago

Thanks for the response again Tobiz. The problem is that I don't have that much experience within python. Maybe I can use the SB_DATA file(log file) for creating a live feed. I am more a webdeveloper =).

tobiz commented 9 years ago

As a simple live feed you could access the following database tables: flight_log2 gets updated at the start of each flight and flight_log_final at the end. flight_log2 is continuously updated during a flight to record the current max altitude. At the end of the flight flight_log_final holds the start and end time and max height. You could read and display these on a website, not sure how but I'm sure it's possible, I have some simple webapps that do this. Note these tables will contain lots of 'jitter' records, eg ground movements. Do you know about http://live.glidernet.org/#c=51.90180,5.78949&z=9. This shows you what's flying at any one time, giving lots of data and also flight tracks. Note I've decided to change the code such that user and passcode values have to be provided on the calling command line. If these are not provided it will exit, ie the values are no longer held in settings.py. This change will appear in my next commit probably later today.