Error on global localization samples with 4.1.1

I am trying to get the samples on global localization working but I am getting some errors:
on live.py for example I get

  File "/usr/local/zed/samples/global localization/live/python/gnss_reader/gpsd_reader.py", line 109, in getNextGNSSValue
    for satellite in gpsd_data['satellites']:
KeyError: 'satellites'

I solved this by adding a control for the key satellite existing.

On the recording I get a different error.


File “/usr/local/zed/samples/global localization/recording/python/exporter/gnss_saver.py”, line 43, in addGNSSData
data.set_content(convert_gnss_data_2_json(gnss_data))
AttributeError: ‘pyzed.sl.SVOData’ object has no attribute ‘set_content’

I saw in the python api docs that the function should be set_string_content but I can’t find how I should use this function.
Are the sample still bugged or am I missing smth? is there specific a version of PyOpenGl I should have? (mine is 3.1.5)

Hello,

You saw well in the doc and this function should actually be set_string_content.
Since this is a json, you must convert it to a string before passing it to the function something that would look like this:

json_content = convert_gnss_data_2_json(gnss_data)
data.set_string_content(json.dumps(json_content))

I’ll update this sample so that it’s fixed for everyone.

Actually, there was a few other issues after this one. You should use the latest updated pushed on github on the master branch, I just updated it.