Simple test not printing data.

40 views
Skip to first unread message

chloe hewitt

unread,
Aug 13, 2018, 11:46:14 AM8/13/18
to swiftnav-discuss
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) .

Im using Python 2.7 on Windows , using Spyder. 

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. 

jsam...@pobox.com

unread,
Aug 13, 2018, 12:00:42 PM8/13/18
to swiftnav-discuss, chloe hewitt
Chloe,

You may want to verify the baud rate is correct. I think the original Piksi (v2?) used 1000000. The newer Piksi multi uses a default of 115200. When you run the console, check to see what baud rate it is connecting with (from the initial screen when you start it).

Jeff Sampson 


--
You received this message because you are subscribed to the Google Groups "swiftnav-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swiftnav-discu...@googlegroups.com.
To post to this group, send email to swiftnav...@googlegroups.com.
Visit this group at https://groups.google.com/group/swiftnav-discuss.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages