Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delay does not work #2

Open
MarkSau opened this issue Nov 23, 2020 · 5 comments
Open

Delay does not work #2

MarkSau opened this issue Nov 23, 2020 · 5 comments

Comments

@MarkSau
Copy link

MarkSau commented Nov 23, 2020

Seems that the script has a problem with the delyed sent.

after start the script sends the data to the traccar server, but afterwards it only shows me the data on the console and never more on the server.

my config.yml file:

<?xml version="1.0"?> <ScannerSettings> <ScannerIDNumber>xxxxxxxxxxxxxxx</ScannerIDNumber> <GT06ClientSettings> <Hostname>xaz.xyz.domain.net</Hostname> <Port>5023</Port> <UpdateDelay>30</UpdateDelay> </GT06ClientSettings> <GPSSettings> <Port>/dev/ttyACM1</Port> <Baud>4800</Baud> </GPSSettings> </ScannerSettings>
Output on console:

pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Namespace(config='config.xml', gps_baud=None, gps_port=None, id=None, maps_url=None, server_address=None, server_port=None, update_delay=None)
Scanning . . .
{}
Scanning . . .
{'latitude': nnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.098, 'altitude': 177.1, 'altitudeUnits': 'M', 'time': '19:27:47', 'timestamp': '192747.00', 'satellitesInView': '12'}
Scanning . . .
{'latitude': nnnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.069, 'altitude': 175.8, 'altitudeUnits': 'M', 'time': '19:28:48', 'timestamp': '192848.00', 'satellitesInView': '11'}
Scanning . . .
{'latitude': nnnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.061, 'altitude': 175.0, 'altitudeUnits': 'M', 'time': '19:29:48', 'timestamp': '192948.00', 'satellitesInView': '11'}

nnnnnnnnnnnnnn=mask latitude/longitude

@lmandres
Copy link
Owner

@MarkSau . I think that the connection is timing out after 60 seconds. Do you know if you registered the ScannerIDNumber with Traccar so that it knows which device to update? Do you have Traccar server logs that you can send from the logs directory under the traccar directory?

@MarkSau
Copy link
Author

MarkSau commented Nov 24, 2020

@lmandres directly after start of the script Traccar shows me that the device is online. But i can't see the next push after 30 sec in the logs of traccar, only the inital one. btw. Tracecar shows me the device still as online (green)
Update: Now after 10 min. the connection state switched to unknown.

@MarkSau
Copy link
Author

MarkSau commented Nov 24, 2020

@lmandres it looks like that the script does not send data in the configured timespan. your script has a time.sleep. as my understanding the script should "sleep" for the time e.g. 30 sec and reactivate afterwards.
But TOP shows me that the python process is running all the time without any pause. i assume that it is running in a loop or something like that and not able to send future data.

@MarkSau
Copy link
Author

MarkSau commented Nov 24, 2020

next finding: I started the script with opt pdb for debugging.

it looks like that the script is looping in the runScannerClient module

/opt/GT06/GT06ScannerClient/runClient.py(70)()
-> scanner.runScannerClient()
(Pdb) n
Scanning . . .
{'latitude': nnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.098, 'altitude': 177.1, 'altitudeUnits': 'M', 'time': '19:27:47', 'timestamp': '192747.00', 'satellitesInView': '12'}
Scanning . . .
{'latitude': nnnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.069, 'altitude': 175.8, 'altitudeUnits': 'M', 'time': '19:28:48', 'timestamp': '192848.00', 'satellitesInView': '11'}
Scanning . . .
{'latitude': nnnnnnnnnnnnnn, 'latitudeDir': 'N', 'longitude': nnnnnnnnnnnnnn, 'longitudeDir': 'E', 'groundSpeedKnots': 0.061, 'altitude': 175.0, 'altitudeUnits': 'M', 'time': '19:29:48', 'timestamp': '192948.00', 'satellitesInView': '11'}

fo me its shows that this part will not leave and is looping.

@lmandres
Copy link
Owner

lmandres commented Nov 24, 2020

@MarkSau , so the relevant line in the code is as follows:

https://github.com/lmandres/GT06ScannerClient/blob/master/GT06ScannerClient.py#L222

The sleep just does a 1 second pause so that the script isn't continuously running. The actual wait is calculated from the current time minus the previous time, and if that wait is longer then the script is supposed to continue. I did this because I do a request for a map if the map server is available in my personal script.

I have a feeling that some request is timing out due to the 60 second interval involved. The network delay time is set as follows:

https://github.com/lmandres/GT06ScannerClient/blob/master/gt06Client.py#L16

and is consumed here:

https://github.com/lmandres/GT06ScannerClient/blob/master/gt06Client.py#L44

EDIT: Added information about the map server.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants