×
INDI Library v1.8.1 Released (09 Sep 2019)

Monthly maintenance release INDI v1.8.1

[ indi_gpsd ] Time is not pulled from gpsd?

4 months 3 weeks ago
ecloud
Junior Boarder
Junior Boarder
Posts: 35
More
Topic Author
[ indi_gpsd ] Time is not pulled from gpsd? #39431
I have not setup ntpd yet. So my system time is not synchronized.
The UTC time in indi client seems to be system time, but not gpsd time.
Is it a bug?
Attachments:

Please Log in or Create an account to join the conversation.

4 months 2 weeks ago
petarm
Expert Boarder
Expert Boarder
Posts: 111
Karma: 1
More
[ indi_gpsd ] Time is not pulled from gpsd? #39483
Why not just write a python script which populates GPS time after boot. Then when you start kstars, the time is correct.

Lots of trial and error, mainly error, but in hindsight, it was easy!!!
Takahashi FC100DF, Skywatcher HEQ5 Pro via Wifi, QHY-163C, Canon 550D, DIY Moonlite focuser, ZWO ASI 224MC on Orion 50mm guider, VNC to Asus Tinker Board in hot spot mode running Ubuntu Mate and KStars/Ekos

Please Log in or Create an account to join the conversation.

4 months 2 weeks ago
Ihoujin
Platinum Boarder
Platinum Boarder
Posts: 658
Karma: 3
More
[ indi_gpsd ] Time is not pulled from gpsd? #39532
gpstime.py
A Python script I use for force the system clock to update.
import os
import sys
import time
from gps import *

print 'Attempting to access GPS time...'

try:
	gpsd = gps(mode=WATCH_ENABLE)
except:
	print 'No GPS connection present. TIME NOT SET.'
	sys.exit()

while True:
	gpsd.next()
	if gpsd.utc != None and gpsd.utc != '':
		gpstime = gpsd.utc[0:4] + gpsd.utc[5:7] + gpsd.utc[8:10] + ' ' + gpsd.utc[11:19]
		print 'Setting system time to GPS time...'
		os.system('sudo date -u --set="%s"' % gpstime)
		print 'System time set.'
		sys.exit()
	time.sleep(1)

INDI/KStars on Raspberry Pi 3B+
Lubuntu 16.04
Skywatcher HEQ5 Pro Mount
Canon 600D Camera
Orion SSAG @280mm Guide Scope
PHD2
Adafruit Motor Hat shield
Adafruit GPS Module
Generic Bluetooth Joystick.
Startech 7 port powered USB Hub.

Please Log in or Create an account to join the conversation.

4 months 2 weeks ago
ecloud
Junior Boarder
Junior Boarder
Posts: 35
More
Topic Author
[ indi_gpsd ] Time is not pulled from gpsd? #39548
Hi, this is not about 'How to get datetime from gpsd'.
This is to concern which time should be displayed on the panel of indi_gpsd.
Does this work as design or be a bug?
And which time will kstars use?
The system time is shown on the panel will make confusion.

Please Log in or Create an account to join the conversation.

4 months 2 weeks ago
petarm
Expert Boarder
Expert Boarder
Posts: 111
Karma: 1
More
[ indi_gpsd ] Time is not pulled from gpsd? #39609
As ihoujin and i have said, a simple script will also do the job. I don't know if it is a bug, that is a question for the developers.

I had similar issues as you and fixed it with the script.

Check out this thread

www.indilib.org/forum/general/2730-how-t...ver-work-for-me.html

it may help.

Lots of trial and error, mainly error, but in hindsight, it was easy!!!
Takahashi FC100DF, Skywatcher HEQ5 Pro via Wifi, QHY-163C, Canon 550D, DIY Moonlite focuser, ZWO ASI 224MC on Orion 50mm guider, VNC to Asus Tinker Board in hot spot mode running Ubuntu Mate and KStars/Ekos

Please Log in or Create an account to join the conversation.

4 months 2 weeks ago 4 months 2 weeks ago by Ihoujin.
Ihoujin
Platinum Boarder
Platinum Boarder
Posts: 658
Karma: 3
More
[ indi_gpsd ] Time is not pulled from gpsd? #39625

Kaczorek wrote:

petarm wrote: Hi Kaczorek, yep i did all that, gpsmon in a terminal tells me the gps adapter is connect and working and acquiring gps data. But when i then run gpsd in kstars/ekos, it was not populating UTC, it was using the time from the asus tinker board.


It's a feature not a bug ;-)
GPSD driver gets time from the system not from gps directly. The reason is noted in the comments in the source code:
// Update time regardless having gps fix.
// We are using system time assuming the system is synced with the gps
// by gpsd using chronyd or ntpd.


It looks to me like you need to complete the configuration of NTPD to use the GPS time, then the driver should sync up.

INDI/KStars on Raspberry Pi 3B+
Lubuntu 16.04
Skywatcher HEQ5 Pro Mount
Canon 600D Camera
Orion SSAG @280mm Guide Scope
PHD2
Adafruit Motor Hat shield
Adafruit GPS Module
Generic Bluetooth Joystick.
Startech 7 port powered USB Hub.

Please Log in or Create an account to join the conversation.

3 months 2 weeks ago 3 months 2 weeks ago by ecloud.
ecloud
Junior Boarder
Junior Boarder
Posts: 35
More
Topic Author
[ indi_gpsd ] Time is not pulled from gpsd? #40677
As @IHOUJIN described, it very easy to get the GPS time. So why the indi_gpsd does not get it?
To run the ntpd/chrony will cause a problem under indi.
The gpsd is default to run as plug&play mode, that mean it will scan all the serial ports (ttyUSB0 and other ttyXXX). And to setup chrony to sync datetime needs "-n" option of gpsd, which makes gpsd to lock all the serial ports all the time.
So the mount model will report "the device is used by other program" on /dev/ttyUSB0
To fix it we need to turn the plug&play off (USBAUTO=false) and input the device name for gpsd, /dev/ttyACM0 for example.
This is so boring.
BTW, I didn't find any info like above in the document. I wonder if there is anyone really has tried USB gps device with indi.

People need to write a script / or to change many settings to make the gps work for indi. Is it the true design of this function?
Why not get and update the datetime by inde_gpsd?
The following user(s) said Thank You Herrhausen

Please Log in or Create an account to join the conversation.

3 months 2 weeks ago
knro
Administrator
Administrator
Posts: 7280
Karma: 51
[ indi_gpsd ] Time is not pulled from gpsd? #40702
I actually just checked the code for the indi-gpsd and was surprised to find that it uses system time... in there a comment that assumes gpsd is synched with ntpd or chronyd but I don't think a driver should make this assumption. I will make it use the GPS actual time and maybe add a switch to toggle this behavior so that the existing use case would be perserved via config switch.

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
The following user(s) said Thank You Herrhausen, DrawsACircle

Please Log in or Create an account to join the conversation.

3 months 2 weeks ago
knro
Administrator
Administrator
Posts: 7280
Karma: 51
[ indi_gpsd ] Time is not pulled from gpsd? #40704
Ok fix pushed.

Jasem Mutlaq
Support INDI & Ekos; Get StellarMate Astrophotography Gadget.
How to Submit Logs when you have problems?
Add your observatory info
The following user(s) said Thank You Herrhausen, Ihoujin

Please Log in or Create an account to join the conversation.

Time to create page: 0.398 seconds