maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Applications (https://talk.maemo.org/forumdisplay.php?f=41)
-   -   [M5+M6] [Announce] gpscon gps position cli shell console (https://talk.maemo.org/showthread.php?t=96176)

Halftux 2015-11-18 23:34

[Announce] gpscon gps position cli shell console
 
1 Attachment(s)
Gpscon is a command line tool to acquire the gps position with the qtmobility/qtlocation api.

In addition it has the ability to write a log file and to save a gpx file.

Code:

gpscon v0.0.11 by halftux

Options:
--------
  [--help] help output
  [runs=integer] max update runs before quit
  [dumps=integer] ignoring first runs
  [limit=integer] accuracy vert/hori < limit 1x and quit
  [posm=string]Position method: nonesat / all / onlysat
  [interval=integer] update interval in s
  [log=string] txt/gpx/log2gpx
  [tout=integer] timeout to exit in s
  [--del] deleting log files
  [--sat] with satellite output
  [--fout] full position output
  [--date] date output
  [--time] time output
  [--newtrack] mark in log file
  [--lknv] output lastknownposition (qdebug)
  [--script] use the option for scripts (no user input)

Without runs or limit option the app is in endless loop.
With user input:
You can exit with: x+[enter].
You can mark a newtrack with: t+[enter].
You can mark a new track segment with: s+[enter]



gpscon
without parameter gpscon will be in endless loop and print to stdout: Latitude; Longitude; Altitude
The application exits with:x+[enter]
t+[enter]: will mark a new track in the logfile.

[--fout]
will enhance the output with additional values: Direction; Ground Speed; Vertical Speed;
Horizontal Acc;Vertical Acc

[--sat]
with this option also the satellite status will be requested and printed out
"Using x of x satellites"

[posm=string]
this will select the positioning method. Default is all.
string=all |AllPositioningMethods
string=onlysat |SatellitePositioningMethods
string=nonesat |NonSatellitePositioningMethods

[interval=integer]
This property holds the requested interval in milliseconds between each update.
If the update interval is not set (or is set to 0) the source will provide updates as often as necessary.
If the update interval is set, the source will provide updates at an interval as close to the requested interval as possible. If the requested interval is less than the minimumUpdateInterval(), the minimum interval is used instead.

[runs=integer]
sets the amount on how many (shown) requests are made before exit

[dumps=integer]
sets the amount on how many first requests get dumped

[limit=integer]
sets the limit of the needed horizontal/vertical accuracy value before print out.
There will be only one print out and after this the app is closing

[log=string]
writing to a log file
string=txt |write/append gpscon.log to user dir
string=gpx |write/append gpscon.log to user dir after last run or exit, the log file will be converted and written to gpscon.gpx in user dir
string=log2gpx |convert log to gpx and exit.

[tout=integer]
sets the timeout for aquire a gps position in seconds.

[--del]
If log file exists it will be removed

[--date]
adds date to output

[--time]
adds time to output

[--newtrack]
will mark in the log file a new track. When converting to gpx old log file data and new data will be visible as separate track.

[--lknv]
This should output the last known value once at first (debug). If runs=1 it will only print the last known value out and quit.

[--script]
Will deactivate the user input which causes trouble with cron or python scripts. This option is recommended when using gpscon with scripts.

[--help]
prints help


Available for
:
Sailfish
Harmattan
Fremantle


Attached is the old source code in alpha stage, I commented out not tested code. It works same like the version before, it has only more options.
New source in fremantle extra-devel repo.

For sailfish create makefile by add this argument to qmake
Code:

qmake "CONFIG+=sailfish"

juiceme 2015-11-21 21:29

Re: [Announce] gpscon gps position cli shell console
 
Thanks, seem to work well in SFOS.

Some changes were needed to get it to compile though; I had to add " QT += positioning location" to the project file and comment out "using namespace QtMobility;" in gpspos.h

This is pretty neat as now I can run it from cron every half an hour or so and push the position to my server. Just perfect in case I lose my device or it gets stolen.

Halftux 2015-11-21 22:10

Re: [Announce] gpscon gps position cli shell console
 
1 Attachment(s)
Quote:

Originally Posted by juiceme (Post 1489118)
Thanks, seem to work well in SFOS.

Some changes were needed to get it to compile though; I had to add " QT += positioning location" to the project file and comment out "using namespace QtMobility;" in gpspos.h

Thats good thx for trying. For compile my source you need to add a parameter to qmake "CONFIG+=sailfish". See picture below "create steps" or build steps in german Erstellungsschritte.


Quote:

Originally Posted by juiceme (Post 1489118)
This is pretty neat as now I can run it from cron every half an hour or so and push the position to my server. Just perfect in case I lose my device or it gets stolen.

Thats perfect, but I hope for you that such a case will never happen.
Have fun.

Halftux 2015-11-22 15:57

Re: [Announce] gpscon gps position cli shell console
 
Version for fremantle is available now.

Added log file option. When option is set to txt it will create a log file in /$userdir/gpscon.log
When the option is set gpx it will create a gpx file from the log file.
Only values with an altitude gets saved in gpx.

When you interrupt the application with control+c no gpx file will be created instead use x+enter

You will find the sources in fremantle extra repo.

int_ua 2015-12-20 07:04

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by Halftux (Post 1489194)
When you interrupt the application with control+c no gpx file will be created instead use x+enter

Does that mean that when my N900 reboots (as it can do several times per day now) I will lose the track?

pichlo 2015-12-20 09:25

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by int_ua (Post 1492212)
Does that mean that when my N900 reboots (as it can do several times per day now) I will lose the track?

It's better not to let it run all the time anyway. That's what cron is for.

Halftux 2015-12-20 09:47

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by int_ua (Post 1492212)
Does that mean that when my N900 reboots (as it can do several times per day now) I will lose the track?

All data gets saved in the log file, also when you use ctrl+c.
The gpx file will only get created when the application will exit normally.
The gpx file gets created from the log file. So when your N900 suddenly reboots you can start gpscon again with gpx option and run=1 and you will have all data in the gpx file. This will work until you delete the log file.

Halftux 2015-12-26 15:26

Re: [Announce] gpscon gps position cli shell console
 
With the new version 0.0.7 you can convert a log file to a gpx as follow:

Code:

/opt/gpscon/bin/gpscon log=log2gpx
gpx multi track support:
Now you can also mark new tracks in the log file. If you have an old recorded track in the log file and you would like to record another into the log file, you could start as follow:
Code:

/opt/gpscon/bin/gpscon log=gpx --newtrack
or
/opt/gpscon/bin/gpscon log=txt --newtrack

If you would like to mark a new track during recording you need to press t+[enter].

handaxe 2015-12-28 16:30

Re: [Announce] gpscon gps position cli shell console
 
Hi Halftux,

good job this. One of those programs that has utility beyond use of the n900 as a primary phone and more as a pocket computer.

Do you have a roadmap for future features, if any and however vague at the mo'?

Halftux 2015-12-30 14:29

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by handaxe (Post 1492818)
Hi Halftux,

good job this. One of those programs that has utility beyond use of the n900 as a primary phone and more as a pocket computer.

Do you have a roadmap for future features, if any and however vague at the mo'?

Thank you for the feedback. At the moment nothing is planned for future releases. Some ideas or wishes?

handaxe 2016-01-02 23:49

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by Halftux (Post 1492957)
Thank you for the feedback. At the moment nothing is planned for future releases. Some ideas or wishes?

Ok, this likely is out of scale BUT, the n900 is a great GPS device but it lacks an implementation of GPSd, or a nmea (some such) output daemon.

CNT (Columbus Navigation Toolkit) provides such but 1) it has a GUI and does a whole lot more (resource hungry but very stylish) and 2) is unstable.

I submit that the above is broadly consistent with gpscon current mission. Easy to write huh, as a non-coding, ageing smart-***, I know :-)

Halftux 2016-01-05 12:09

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by handaxe (Post 1493376)
Ok, this likely is out of scale BUT, the n900 is a great GPS device but it lacks an implementation of GPSd, or a nmea (some such) output daemon.

This is a different approach and would be nice to have. However my application is more an example for a qt console application which uses the qt location api and thus it is limited by the api.

pichlo 2016-02-26 15:35

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by juiceme (Post 1489118)
This is pretty neat as now I can run it from cron every half an hour or so and push the position to my server. Just perfect in case I lose my device or it gets stolen.

If I may ask you, how did you do it?

The reason I ask... I have the following script running every 3 minutes from cron:
Code:

#!/bin/sh

STR=`gpscon runs=1`

LAT=`echo $STR | cut -d " " -f 2 | cut -d ";" -f 1`
LON=`echo $STR | cut -d " " -f 4 | cut -d ";" -f 1`
ALT=`echo $STR | cut -d " " -f 6`

STR={\"name\":\"`hostname`\",\"time\":`date +%s`,\"lon\":$LON,\"lat\":$LAT
if [ $ALT != "nan" ]; then
  STR=$STR,\"alt\":$ALT
fi
STR=$STR}

curl -H "Content-Type: application/json" -X POST -d $STR \
  http://<myserver>/gpscon/json.php -k

But I am getting some strange results. Basically, I have about 30 hours of exactly the same data (with only the time stamp updating), even though I drove about 50km, spent the night and drove 50km back again.

I then experimented with gpscon a bit more and found that it always returns the same previous value if run only once. Only when run two or more times, it starts updating the value.

Unfortunately,
Code:

gpscon runs=x
results in spawning a new instance every time my cron job kicks in and the previous instance never terminates if x is any value other than 1. That means that after 30 minutes I have 10 instances of gpscon running and no data uploaded because my script never passed that line. If I use x=1, the script runs normally but the value is never updated.

What am I doing wrong?

pichlo 2016-02-26 18:25

Re: [Announce] gpscon gps position cli shell console
 
In addition to the above, I get strange results like:
Code:

[nemo@Dinghy ~]$ gpscon
Latitude: 51.6126; Longitude: -0.730567; Altitude: nan
Latitude: 51.6126; Longitude: -0.730567; Altitude: nan
Latitude: 51.6126; Longitude: -0.730567; Altitude: nan
Latitude: 51.6126; Longitude: -0.730564; Altitude: nan
^C
[nemo@Dinghy ~]$ gpscon runs=1
Latitude: 51.6126; Longitude: -0.730567; Altitude: nan
[nemo@Dinghy ~]$

How can I explain the last run (with runs=1)? Why is it different than the last line of the previous run?
I would expect...
  1. The coordinates are updated. But then each run should print updated values. This is not the case, the values stay the same with runs=1 when I move.
  2. The coordinates are not updated. But then the values should match the last line of the previous run.

Moreover... I open two terminal windows, one with gpscon running permanently (I see the values changing in the last digit). In the other, I run gpscon runs=1 manually from time to time. I expect the manual run reflect the current values from the window with gpscon running permanently, but it is always the same.

What is going on?
(Experiments run on Sailfish if that makes a difference.)

pichlo 2016-02-26 19:46

Re: [Announce] gpscon gps position cli shell console
 
Even better:
Code:

[nemo@Dinghy ~]$ gpscon
Latitude: 51.6126; Longitude: -0.730567; Altitude: nan
Latitude: 51.6844; Longitude: -1.26139; Altitude: nan
Latitude: 51.6844; Longitude: -1.26139; Altitude: nan
Latitude: 51.6844; Longitude: -1.26139; Altitude: nan
^C
[nemo@Dinghy ~]$ gpscon runs=1
Latitude: 51.6126; Longitude: -0.730567; Altitude: nan
[nemo@Dinghy ~]$

WTF???

However,
Code:

[nemo@Dinghy ~]$ gpscon runs=3
Latitude: 51.6126; Longitude: -0.730567; Altitude: nan
Latitude: 51.6844; Longitude: -1.26139; Altitude: nan
Latitude: 51.6844; Longitude: -1.26139; Altitude: nan
[nemo@Dinghy ~]$ gpscon runs=1
Latitude: 51.6844; Longitude: -1.26139; Altitude: nan
[nemo@Dinghy ~]$

So clearly, the last known value gets updated only when
  1. gpscon has completed at least two runs and
  2. gpscon terminated on its own, without ^C

The remaining £100 question is, why does gpscon runs=3 not terminate when run from a script triggered by cron when it quite happily terminates when the same script is run manually from the command line.

Halftux 2016-02-26 20:14

Re: [Announce] gpscon gps position cli shell console
 
@ pichlo, sorry I do not have sailfish :(. But I will look into your posts and see if I can help you.

One thing is the position api can get different positions. So after some time you should get exact values when your gps signal is fixed.

First I would set position method option to "posm=onlysat".

Code:

Satellite-based positioning methods such as GPS.
A good approach would be to use the [limit=integer] option.
Set it to 80 and this would lead to one print out with a fixed gps position.

pichlo 2016-02-26 20:48

Re: [Announce] gpscon gps position cli shell console
 
Hmm. Something is fishy here. I tried gpscon limit=80 and it never terminated (not in 5 minutes anyway). Neither did limit=10.

Halftux 2016-02-26 20:53

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by pichlo (Post 1499947)
Hmm. Something is fishy here. I tried gpscon limit=80 and it never terminated (not in 5 minutes anyway). Neither did limit=10.

I dont know maybe on sailfish it has different values for a fixed signal or you have a very bad view to the satellites.

gpscon posm=onlysat --fout --sat

Let it run and see how the values are changing. What is the minimum value for your accuarcy?

Halftux 2016-02-26 21:25

Re: [Announce] gpscon gps position cli shell console
 
@pichlo By the way the altitude is nan this means the position doesn't come from the gps.


Quote:

Originally Posted by pichlo
1. That means that after 30 minutes I have 10 instances of gpscon running and no data uploaded because my script never passed that line. If I use x=1, the script runs normally but the value is never updated.

About the instances I don't know I will try to run your script on the N900 with alarmed, no clue why it couldn't terminate.

Is it worth to try in another script after some timout.
Code:

kill -SIGTERM $(pidof gpscon)
Don't know if you are able to read the output.

It could be that the value will not change because it is a last known value (it shouldn't take it), or the value comes from a not very accurate positioning method. However the N900 and the N950 act different because of different qtmobility. Maybe Jolla also act different.

P.S.: Maybe the first value is the lastknown value could be a bug in the last version, I will look into the source code.

pichlo 2016-02-26 22:45

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by Halftux (Post 1499948)
Let it run and see how the values are changing. What is the minimum value for your accuarcy?

Oh, I get it now! The "limit" is on accuracy, not time! Silly me :o

I ran it indoors but on the upper floor of a typical 2-story English house with thin wooden floors and ceilings. No concrete. It started off with 0 out of 19 satellites used, accuracy something like 67. Then I put it in the window while tucking the kids in the bed. I do not know long it took as I was busy but now, after 3894 runs, it says 5 out of 20 sats used, accuracy 4.

Quote:

Originally Posted by Halftux (Post 1499954)
@pichlo By the way the altitude is nan this means the position doesn't come from the gps.

That makes sense. But it turns upside down my understanding of how the positioning in Sailfish works. I never turn it off and I was assuming that it would stay locked. Apparently not.

BTW the altitude was a number sometimes ;)

Halftux 2016-02-26 23:32

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by pichlo (Post 1499905)
results in spawning a new instance every time my cron job kicks in and the previous instance never terminates if x is any value other than 1. That means that after 30 minutes I have 10 instances of gpscon running and no data uploaded because my script never passed that line. If I use x=1, the script runs normally but the value is never updated.

What am I doing wrong?

It could be your script or the argument parser of gpscon which causes the weird behavior when used with script/cron.

I think some how the default variable value will be used and this means last known value and endless loop.

If it is not your script (I still need to try) I could change the default values (options and variable) for gpscon or better writing a own argument parser which will work with this situation.

Never tried cron-scripts with gpscon now it is time to do so.:)

Quote:

Originally Posted by pichlo (Post 1499905)
That makes sense. But it turns upside down my understanding of how the positioning in Sailfish works. I never turn it off and I was assuming that it would stay locked. Apparently not.

I think turning on means it could be used. Only when someone makes a request about your position it will get locked and this will be fast when you have all near satellite positions. It could be if the gps uses 3-4 satellites the signal is locked already.
To safe power is priority number one.

Halftux 2016-02-27 14:14

Re: [Announce] gpscon gps position cli shell console
 
@pichlo Thank you very much for reporting this issue.
I found the bug, it is the console reader in gpscon which was causing the cron problem.

You can stick to the gpscon-0.0.4-1.armv7hl.rpm version to solve the problem or wait for a new version.

The latest version on openrepos gpscon-0.0.8-1.armv7hl.rpm will not fix the problem it was a test version about the argument parser, but the next version will correct the console reader for sure.

Halftux 2016-02-27 21:50

Re: [Announce] gpscon gps position cli shell console
 
Important update to gpscon!

For using gpscon in cron, python or any script it is recommended to use the additional otpion "--script" otherwise it could hang.
This feature is there since version 0.0.8. Type gpscon --help to check version.

All other version between 0.0.4 and 0.0.8 have a bug which cause the application hang when used with scripts and if there is no stdin.

For now this is the easiest and safest solution. I will see if it could be detected and automatically switched.

pichlo 2016-02-28 19:46

Re: [Announce] gpscon gps position cli shell console
 
Hey Halftux, thanks a million for looking into this and sorry for the late feedback. Weekends are the busiest time. During the week I can (sometimes) steal some time from my employer but stealing it from the family is a bit more difficult ;)

Unfortunately, neither a downgrade to 0.0.4 nor an upgrade to 0.0.8 and adding the --script option has made any difference. The script still freezes when launched from cron. After a while, ps shows a number of instances of my script and gpscon runs=3 running. Killing them all makes the stuck scripts move forward all at once. Having read the above post about no stdin, I also tried adding a redirection from a file (gpscon runs=3 < somefile, with or without --script) but that has not made any difference either. The only thing that does not freeze is runs=1, but that produces wrong coordinates as described earlier.

So I am thinking about changing the paradigm completely and repeating my question from a few posts back. @juiceme, how did you do it?

Halftux 2016-02-29 11:53

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by pichlo (Post 1500090)
Hey Halftux, thanks a million for looking into this and sorry for the late feedback. Weekends are the busiest time. During the week I can (sometimes) steal some time from my employer but stealing it from the family is a bit more difficult ;)

No problem I can understand.

Quote:

Originally Posted by pichlo (Post 1500090)
Unfortunately, neither a downgrade to 0.0.4 nor an upgrade to 0.0.8 and adding the --script option has made any difference. The script still freezes when launched from cron.

Please start your script in cron like this: "sh gps.sh".
This could solve your issue.

Halftux 2016-02-29 15:10

Re: [Announce] gpscon gps position cli shell console
 
I have recognized when using gpscon run=1 posm=onlysat --script
will run for ever until satellites are in view. I will add in the future a timeout for this case (run=1 posm=onlysat).
When the timeout is reached it closes the app or will fall back to an other positioning method which is not so exact. I will see.

pichlo 2016-02-29 15:29

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by Halftux (Post 1500136)
Please start your script in cron like this: "sh gps.sh".
This could solve your issue.

Why did I not think of that myself? :o:o

Sadly, no :(
Code:

[nemo@Dinghy ~]$ ps ax | grep gps
  457 ?        Ss    0:00 /bin/sh ./gpsconupload
  458 ?        S      0:00 /bin/sh ./gpsconupload
  459 ?        S      0:00 gpscon --script runs=3
 1221 ?        Ss    0:00 /bin/sh ./gpsconupload
 1222 ?        S      0:00 /bin/sh ./gpsconupload
 1224 ?        S      0:00 gpscon --script runs=3
 1306 pts/0    S+    0:00 grep gps
[nemo@Dinghy ~]$

I have no idea where the double entries (pid 457/458 and 1221/1222) come from.

For a reference, I have made only a minimal change to the script.
Adding --script and replacing curl with echo:
Code:

#!/bin/sh

STR=`gpscon --script runs=3 | tail -n 1`

LAT=`echo $STR | cut -d " " -f 2 | cut -d ";" -f 1`
LON=`echo $STR | cut -d " " -f 4 | cut -d ";" -f 1`
ALT=`echo $STR | cut -d " " -f 6`

STR={\"gid\":\"`hostname`\",\"time\":`date +%s`,\"lon\":$LON,\"lat\":$LAT
if [ $ALT != "nan" ]; then
  STR=$STR,\"alt\":$ALT
fi
STR=$STR}

echo $STR >> ~/gpsconlog.txt

I have also tried splitting it in two files. The file evoked by cron has only the following:
Code:

#!/bin/sh

sh ./gpsconupload.do

That did not help either:
Code:

[nemo@Dinghy ~]$ ps ax | grep gps
 3871 ?        Ss    0:00 sh ./gpsconupload
 3872 ?        S      0:00 sh ./gpsconupload.do
 3873 ?        S      0:00 sh ./gpsconupload.do
 3874 ?        S      0:00 gpscon --script runs=3
 4076 ?        Ss    0:00 sh ./gpsconupload
 4077 ?        S      0:00 sh ./gpsconupload.do
 4078 ?        S      0:00 sh ./gpsconupload.do
 4079 ?        S      0:00 gpscon --script runs=3
 4088 pts/0    S+    0:00 grep gps
[nemo@Dinghy ~]$

Note again the double entries. They cannot be explained by a bug in or a misconfiguration of cron since cron launches only sh ./gpsconupload, which in turn runs the .do file. Any idea what's going on here?

Halftux 2016-02-29 18:46

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by pichlo (Post 1500161)

I have no idea where the double entries (pid 457/458 and 1221/1222) come from.

Any idea what's going on here?

No sorry I don't know:( Could be the shell from cron:confused:
Here a link to start with another shell. What shell does sailfish use?

Quote:

Cron has several enviromental variables configured in /etc/crontab, specifically SHELL and PATH. The default value for SHELL is /bin/sh. So unless this is changed or otherwise specified in a script, cron will execute commands using sh.

Here is my scenario with N900.

In alarmed I write as command:
Code:

sh /opt/gps.sh
gps.sh
Code:

#!/bin/sh

gpscon runs=3 --script > /home/user/MyDocs/gps2.txt

or
Code:

#!/bin/sh

STR=`gpscon runs=3 --script`

LAT=`echo $STR | cut -d " " -f 2 | cut -d ";" -f 1`
LON=`echo $STR | cut -d " " -f 4 | cut -d ";" -f 1`
ALT=`echo $STR | cut -d " " -f 6`

STR={\"name\":\"`hostname`\",\"time\":`date +%s`,\"lon\":$LON,\"lat\":$LAT
echo $STR > /home/user/MyDocs/gps2.log

running without a problem with alarmed. If you not put sh infront it will not work.

Code:

14554 user      2084 S    /bin/ash -c sh /opt/gps.sh
14555 user      2084 S    sh /opt/gps.sh
14556 user    27632 S    gpscon runs=3 --script
14560 user      2088 S    grep gps

Now comes the funny thing doesn't matter with or without cron.
When in the location settings the location supl. server is deactivated or when using posm=onlysat is set, there will be no output unless you have enough satellites in view.

Halftux 2016-03-02 10:22

Re: [Announce] gpscon gps position cli shell console
 
Maybe it has nothing to do with cron. I am working now on a debug version and try to avoid a qt event loop. It could be that there is spawning another instance?
I had with another application going from qt4 to qt5 problems with event loops. Stay tuned.

pichlo 2016-03-02 10:28

Re: [Announce] gpscon gps position cli shell console
 
Good point, I will try launching another Qt app from cron and see what happens.

The curious bit is that it runs normally with runs=1, only gives incorrect results.
What is the difference between runs=1 and runs=3 that may cause the hang?

Halftux 2016-03-02 11:13

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by pichlo (Post 1500376)
The curious bit is that it runs normally with runs=1, only gives incorrect results.

Does runs=1 posm=onlysat gives a result or does it hang? Try outside at least for 5min.

Quote:

Originally Posted by pichlo (Post 1500376)
What is the difference between runs=1 and runs=3 that may cause the hang?

The difference not happening in my code it is the location api.
I starting source->startupdates() and when it is set to positioning method all, the first value will be taken not from the gps.

But now comes something which I do not understand there will be no further emited signal which calling the output slot. This happens for example when no new update could be aquired. Result is the application hangs and will never call quit. However when not set posm=onlysat it should fall back to a different position method but there comes no signal to call my slot.
I would like to try source->requestupdate(timeout) to get at least a timeout.

So I could reproduce your problem and could get rid of it by calling the script with sh. But the N900 uses ash instead of sh which could produce the problem. I think on sailfish it is sh already.

So over all I don't know what is happening. Problem could be:
- qt version behave different 2 instance maybe 2 event loops which can't catch all events from signal
- cron problem (btw which user/rights runs cron task?), shell problem

pichlo 2016-03-02 12:27

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by Halftux (Post 1500383)
Does runs=1 posm=onlysat gives a result or does it hang? Try outside at least for 5min.

This is weird.
runs=1 posm=onlysat from the command line returns immediately, with the last (incorrect) result.
runs=10 posm=onlysat just hangs. Definitely for more than 20 minutes anyway. Admittedly I only tried indoors, with the phone in the window. Too cold outside to stand there with a phone in an outstretched hand for 5 minutes :D It is also rather cloudy, so the GPS signal may not be that brilliant. The best I got with --fout --sat was 0 out of 3 satellites. The last time I tried it at home (the same way, phone in the window) I got a fix in just a few minutes.

That runs=1 posm=onlysat returning immediately tells me that you are probably right about the API differences. I think the time has cometh for me to dig up the sources, build it myself and start debugging ;)

Halftux 2016-09-30 08:27

Re: [Announce] gpscon gps position cli shell console
 
After my first try with Sailfish and vixie-cron it looks like that the api is not talking to the gps.
So I can get the value from run number one which is definitely some last known value. There will be no further runs because the update signal from the api will not be send because the gps is not active.
You can see it because there is no icon blinking in sfos for active gps.
So far I have no clue to fix or to debug this problem. For sure it is not my app it is maybe the console environment, cron or the api.

Halftux 2016-09-30 08:51

Re: [Announce] gpscon gps position cli shell console
 
So here the environment from cron shell. Definitely different.

Quote:

SHELL=/bin/sh
PATH=/usr/bin:/bin
_=/usr/bin/env
PWD=/home/nemo
SHLVL=2
LOGNAME=nemo
So how to get the environment profil get to run in the cron shell?

Halftux 2016-09-30 10:02

Re: [Announce] gpscon gps position cli shell console
 
ok fixed it with by adding to the script:

Code:

source /home/nemo/.bash_profile
Now it should run in cron. So it was all about the environment.

Halftux 2016-11-27 18:19

Re: [Announce] gpscon gps position cli shell console
 
New version 0.0.9 will be out soon.

There you have a new option [tout=integer] for setting a timeout to aquire a gps position when you are in "onlysat" mode. When not setting a timeout the application could wait forever to get enough satellites.
The timeout is in seconds, when this time is reached the application exits.

For sailfish the onlysat mode will now dismiss the first value which was known to be a last known satellite value. So this example command should give you now the current position, if enough satellites are visible. (could be same for harmattan I need to check)

Code:

gpscon runs=1 posm=onlysat
SFOS out now others will follow next days.

Halftux 2016-12-01 10:33

Re: [Announce] gpscon gps position cli shell console
 
New version 0.0.10 will be out soon.

Added track segment and track name to gpx export.
With s+[enter] you can mark the end of a segment in the log file.

Some gpx viewer and editors need a starting and ending segment to properly open the gpx file. So now when a new track starts or ends a segment will be automatically opened and closed.

Halftux 2017-09-28 08:40

Re: [Announce] gpscon gps position cli shell console
 
Found some link about gpstracker with gpscon, this example is for sailfish.

Online JGPSTracker
systemctl

Maybe this could be interesting for somebody.

epninety 2017-10-12 23:49

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by Halftux (Post 1519486)
For sailfish the onlysat mode will now dismiss the first value which was known to be a last known satellite value. So this example command should give you now the current position, if enough satellites are visible. (could be same for harmattan I need to check)

Code:

gpscon runs=1 posm=onlysat

Just revisiting my scripts that use gpscon when moving them over to the X. I noticed that if I enter...

Code:

/usr/bin/gpscon tout=60 runs=1 posm=onlysat
It does NOT seem to dump the first useless position fix. Went back to my JollaC and I get the same behaviour there, In each case it returns a stale fix. (Using V0.0.10)

The C returns in about 15 seconds, the X returns almost straight away. Both return a stale fix which is never updated using this command form. (If I use runs=2 I get updated fix on the second pass)

Even with this issue, many thanks for a great tool!

Halftux 2017-10-13 22:48

Re: [Announce] gpscon gps position cli shell console
 
Quote:

Originally Posted by epninety (Post 1536623)

It does NOT seem to dump the first useless position fix. Went back to my JollaC and I get the same behaviour there, In each case it returns a stale fix. (Using V0.0.10)

The C returns in about 15 seconds, the X returns almost straight away. Both return a stale fix which is never updated using this command form. (If I use runs=2 I get updated fix on the second pass)

I don't know what is going on with sailfish positioning method.
For sure it behave different. It depends maybe also on the settings, or if you have a sim card or not, more last know values (from different methods), maybe different sailfish versions, wifi hmm what ever.:confused:
Soon I will release a version where you can define how many positioning events you want to dump.

But I will also suggest you to try out the limit option.
This option specifies an accuracy threshold. It will have the first output with a better accuracy than the limit.
With the right tuned limit you could be sure to get a satellite position.

To determine a good limit I recommend to make some experience with --fout and maybe also with --sat. There you could see the accuracy and the correlation with satellites.

With 6 satellites out of 25 I had an accuracy of 3 with the jolla c.


Quote:

Originally Posted by epninety (Post 1536623)
Even with this issue, many thanks for a great tool!

Nice that you like it and thx for the feedback. I am glad that it is for some more people useful.


All times are GMT. The time now is 09:14.

vBulletin® Version 3.8.8