Hi, im a uni student working on a summer project. I need to be able to take data straight from the piksi (without using the console) .
I copied/installed the swift-nav libsbp package from github , edited the default so it reads from my USB port , but when i run it it doesnt print the data . Heres the code from simple.py:
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 8 09:42:31 2018
@author: Simon Rush
"""
from sbp.client.drivers.pyserial_driver import PySerialDriver
from sbp.client.handler import Handler
from sbp.client.framer import Framer
from sbp.client.loggers.json_logger import JSONLogger
from sbp.navigation import SBP_MSG_BASELINE_NED, MsgBaselineNED
import argparse
def main():
parser = argparse.ArgumentParser(
description="Swift Navigation SBP Example.")
parser.add_argument(
"-p",
"--port",
default=['COM3'],
nargs=1,
help="specify the serial port to use.")
args = parser.parse_args()
print ("im here!")
# Open a connection to Piksi using the default baud rate (i1Mbaud)
with PySerialDriver(args.port[0], baud=1000000) as driver:
with Handler(Framer(driver.read, None, verbose=True)) as source:
try:
print("before try")
for msg, metadata in source.filter(SBP_MSG_BASELINE_NED): #heres the problem
print("msg =", msg)
# Print out the N, E, D coordinates of the baseline
print ("%.4f,%.4f,%.4f") % (msg.n * 1e-3, msg.e * 1e-3,
msg.d * 1e-3)
print("done")
exit
except KeyboardInterrupt:
pass
if __name__ == "__main__":
main()
ive noticed (using print commands) that it appears to cut out around the for msg line , but it compiles just fine (no errors come up) . its like there's no print line inside that loop at all.
Im a newbie and would really appreciate some advice , since i need this ASAP to take data for my uni research. Thankyou in advance.