首页 > 解决方案 > 绘制 GPS 坐标

问题描述

我的问题是将 gps 坐标实时绘制到空白画布上,并保持最新的绘图居中。目标是在拖拉机中使用 StrawberryPi 和监视器,以保持覆盖地面的视野。不需要地图,只需一张空白画布。我已经可以使用 GPSPoller 线程和 gpsd 显示实时经纬度数据。我对如何绘制点并保持它们居中感到困惑。

class GpsPoller(threading.Thread):
  def __init__(self):
    threading.Thread.__init__(self)
    global gpsd #bring it in scope
    gpsd = gps(mode=WATCH_ENABLE) #starting the stream of info
    self.current_value = None
    self.running = True #setting the thread running to true

  def run(self):
    global gpsd
    while gpsp.running:
      gpsd.next() #this will continue to loop and grab EACH set of gpsd info to clear the buffer

if __name__ == '__main__':
  gpsp = GpsPoller() # create the thread
  try:
    gpsp.start() # start it up
    while True:


  os.system('clear')

  print
  print ' GPS reading'
  print '----------------------------------------'
  print 'latitude    ' , gpsd.fix.latitude
  print 'longitude   ' , gpsd.fix.longitude

  .......... etc

感谢您的反馈。我的问题是确定一种合适的技术,使我能够在“画布”上绘制点并将“画布”保持在最后一点的中心。跟踪将使我能够跟随地面上的路径并确保完全覆盖例如施肥,这在实践中实际上非常棘手。扩展宽度可能是 12 m,我可以用绘制点的大小来模拟。距离和覆盖面积也很容易计算。这是我发现很难知道从哪里开始的视觉指南。任何帮助,将不胜感激

我熟悉 Python 和 tkInter,如果我能找到合适的起点,我非常愿意自己学习

标签: pythonlinux

解决方案


推荐阅读