Esempio n. 1
0
 def __init__(self, com_port='COM5', baudrate=115200):
     self.com_port = com_port
     self.baudrate = baudrate
     try:
         self.imu = EzAsyncData.connect(self.com_port, self.baudrate)
     except:
         print('Communication with IMU failed')
         return
Esempio n. 2
0
 def change_baudrate(self, baudrate):
     '''
     change baudrate of imu
     '''
     self.baudrate = baudrate
     self.imu.sensor.change_baudrate(self.baudrate)
     self.imu.sensor.disconnect()
     try:
         self.imu = EzAsyncData.connect(self.com_port, self.baudrate)
     except:
         print('Tried to change IMU baudrate to', self.baudrate,
               '...could not reconnect to IMU')
         return
Esempio n. 3
0
## To use the acceleration measured to   #####
## find the distance for the VN sensor   #####
#############################################
from vnpy import EzAsyncData
#from influxdb import InfluxDBClient
import datetime
import v2.py

from time import sleep

# Connect to Database
#client = InfluxDBClient('localhost', 8086, 'root', 'root', 'example')
#client.create_database('example')

# Connect to VectorNav
ez = EzAsyncData.connect('/dev/ttyUSB0', 115200)

# Run until the script is terminated
while True:
    json_points = []
    before = datetime.datetime.now()

    #while (datetime.datetime.now() - before).total_seconds() < 1:
    # Get the next batch of data
    cd = ez.next_data()
    time = datetime.datetime.utcnow()

    ####to call acceleration from v2
    if cd.has_acceleration:
        json_points.append({
            "measurement": "acceleration",
Esempio n. 4
0
    print('Step mode pan axis: ', ptu.read('wp '))
    print('Step mode tilt axis: ', ptu.read('wt '))
    print('')

    #Set PTU to microstep mode
    ptu.set_microstep()

    #    Example 1) Point PTU at sun
    #               Need ephemeris data to point at sun
    ep = ephem.Observer()
    #Set latitude, longitude and altitude to Blacksburg, VA
    ptu.lat, ptu.lon, ptu.alt = '37.205144', '-80.417560', 634
    ptu.utc_off = 4  #Set UTC time offset of EST

    #Connect to IMU to get offset from magnetic North
    imu = EzAsyncData.connect('COM7', 115200)

    ptu.ephem_point(ep, imu=imu, target='sun')
    input('Press any key when PTU is pointed at the sun')
#
#
#    #Track the sun for approximately 10 seconds using ephemeris data
#    cnt=0
#    track_time = 10
#
#    #Make sure ptu is pointed at sun to start
#    ptu.ephem_point(ep,target='sun')
#    input('Press any key when PTU is pointed at the sun')
#
#    #Begin tracking loop
#    while cnt < track_time: