This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
iteration running too slow
#1
Hello,

I just installed the latest master checkout from gitup of pypilot and noticed the following error

autopilot iteration running too slow 0.09394598200015025
autopilot iteration running too slow 0.09292153699993833
autopilot iteration running too slow 0.09229849999996986
autopilot iteration running too slow 0.09367199999996956
autopilot iteration running too slow 0.09386418500002947
autopilot iteration running too slow 0.0928747589998693
autopilot iteration running too slow 0.09335216699992088
autopilot iteration running too slow 0.09376981500008696
autopilot iteration running too slow 0.09284829600005651

this message continues to scroll really fast. Eventually the system time changes. It goes back -4 hours. I happen to be GMT -4 at the moment. I believe if I leave it long enough it the time changes again to an even older time. Eventually it might resync to actual time but shortly after it will continue to change. I have only noticed this since I updated pypilot .
Reply
#2
Hi, it looks like maybe that error was not the issue. How ever the time change was consistent, it kept updating current time -4 hours. Over time it would go back -8 or even -12 but then occasionally it re-synced to current time. I took an older commit and the problem was gone, hoe ever I was getting a bad key error, I tried inserting from one of your newer commits the fix for that which was in

pypilot/nmea.py
around 565
self.last_values = {'gps.source' : 'none', 'wind.source' : 'none', 'rudder.source': 'none', 'apb.source': 'none', 'water.source': 'none'}

After adding water.source it worked but GPS position was not working, it kept showing my boat near Africa. I then took the latest commit from master and removed this snippet and its working for me

pypilot/sensors.py
line 237
return self.nmea_sentence.value + ',' + self.gethhmmss() + ',A,' \
+ self.getddmmmmmm(lat, 'N', 'S') + ',' + self.getddmmmmmm(lon, 'E', 'W') \
+ ',%.2f,' % speed + '%.2f,' % (track if track > 0 else 360 + track) \
+ self.getddmmyy() + ',,,A'

After removing this return, I get no issues with my time updating. I am probably braking something but at least for now its working for me, which means, pypilot enabled, disabled, steers compass and GPS, and I can even follow route when its enabled with AVNAV.
Reply
#3
Interesting.

Is this is on openplotter ? And I suppose you have a GPS connected over serial ? Using gpsd or not ?

It looks like your system gets the GPS and time from the GPS device -- and this works OK.

But pypilot also generates GPS APRMC messages, and for whatever reason the generated latitude and longitude are 0, which pinpoints you somewhere near Africa...

Pypilot shouldn't be generating these messages if it doesn't have a good source for them.

What says 'pypilot_client | grep gps' ?
Reply
#4
I am running openplotter
GPS is USB serial device
I am running GPSD

Actually with the latest master branch, the GPS location is ok, its the time that keeps changing. It was only a few commits before latest that caused the weird GPS relocation. As I stated with the return statement removed, system time is not being updated, and my other dependencies for pypilot seem to be working fine.
Reply
#5
Can you post a diff of the changes vs master that fixed the issue?
Reply
#6
diff sensors.py ~/sensors.py.change
237,240d236
< return self.nmea_sentence.value + ',' + self.gethhmmss() + ',A,' \
< + self.getddmmmmmm(lat, 'N', 'S') + ',' + self.getddmmmmmm(lon, 'E', 'W') \
< + ',%.2f,' % speed + '%.2f,' % (track if track > 0 else 360 + track) \
< + self.getddmmyy() + ',,,A'

basically I just removed this part
Reply
#7
Thanks for reporting this. I updated in git (for now) to hopefully give the same behavior until I manage to fully investigate.
Reply
#8
Hi macr023,

I think the weird time was caused by the gethhmmss() method in sensors.py: we are using datetime.datetime.now() -- which returns the local time.

GPS is supposed to return time in UTC.

Can you please just replace that call by: datetime.datetime.utcnow() , and of course put back the lines you removed, and test again.

Please report if the time is handled corectly, and if you still see the slow iteration messages.

Thanks !
Reply
#9
Worked like a charm! Thank you!
Reply
#10
So no more "slow iteration" ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)