Page 1 of 1

[SOLVED] GpsTab Not Working in latest cfclient-Python

Posted: Wed May 25, 2016 5:05 am
by jackemoore
Hi,

I'm encountering a GpsTab display of data problem when using crazyflie-clients-python branch develop 2016.05.12 with crazyflie-lib-python branch master 2016.04.27 using python 3.4 in windows 10. An error appears as “ attributeError: “int' object has no attribute 'setText' “ and points to a line of code in GpsTab.py which is “ self._long.setText(“{:.6f}”.format(long)) “. GpsTab.py is attempting to write longitude data into the tab display and after this error all subsequent output to the tab is bypassed.. The property attribute in GpsTab.ui for "_long" is “readonly”, but this has worked previously in earlier versions of pc cfclient.

An earlier release of crazyflie-clients-python 2016.02.17 worked successfully and does not exhibit this failure. My integration of gtgps.c into positionHold Mode within the new restructured stabilizer code is at a near stand still until the above problem is resolved. Any insight and/or recommendations would be greatly appreciated.

Best regrads,
Jack

Re: [SOLVED] GpsTab Not Working in latest cfclient-Python

Posted: Thu May 26, 2016 3:31 pm
by jackemoore
Hi,

Apparently in one of the commits, between 2016.02.17 and 2016.05.12 for the Github crazyflie-clients-python branch develop, code was modified in GpsTab.py with the intent of only updating the tab data display fields when latitude or longitude change values. By removing this intended improvement, the problem of the GpsTab not working in the latest version of cfclient-python vanishes. Without further study, I'm not familiar enough with the offending problem code to be able to offer a correction and retain the intended benefit.

Best regards,
Jack

Re: [SOLVED] GpsTab Not Working in latest cfclient-Python

Posted: Fri May 27, 2016 7:48 am
by arnaud
Hi,

Nice that you found the bug!
The problem we where trying to solve is that updating the GPS tab freezes the full UI on Linux. So the intent was to update the position only when necessary. This is the issue: https://github.com/bitcraze/crazyflie-c ... issues/248

Best,
/Arnaud

Re: [SOLVED] GpsTab Not Working in latest cfclient-Python

Posted: Fri May 27, 2016 11:23 am
by jackemoore
Hi,

After removing the offending code that updates the position only when necessary, I'm seeing the same problem that updating the GPS tab freezes sporadically the full ui on Windows 10. So, I agree that making the offending code bug free is very important.

Best regards,
Jack

Re: [SOLVED] GpsTab Not Working in latest cfclient-Python

Posted: Fri May 27, 2016 2:18 pm
by jackemoore
Hi,

A snippet of the offending code in GpsTab.py is as follows:

def __init__(self, tabWidget, helper, *args):
….self._lat = 0
….self._long = 0
def _log_data_received(self, timestamp, data, logconf):
….long = float(data["gps.lon"]) / 10000000.0
….lat = float(data["gps.lat"]) / 10000000.0
….if self._lat != lat or self._long != long:
….....self._long.setText("{:.6f}".format(long))
….....self._lat.setText("{:.6f}".format(lat))
….....self._lat = lat
….....self._long = long

The bug goes away by using the following example:

def __init__(self, tabWidget, helper, *args):
….self._gpslat = 0
….self._gpslong = 0
def _log_data_received(self, timestamp, data, logconf):
….long = float(data["gps.lon"]) / 10000000.0
….lat = float(data["gps.lat"]) / 10000000.0
….if self._gpslat != lat or self._gpslong != long:
….....self._long.setText("{:.6f}".format(long))
….....self._lat.setText("{:.6f}".format(lat))
….....self._gpslat = lat
….....self._gpslong = long

Removing _long and _lat from the if statement solves the problem.

Best regards,
Jack