Software In The Loop

Run real FC code against our test data


In [21]:
from psas_packet import io
import numpy

with io.BinFile('./logfiles/logfile-000') as fclog:
    adis_time = []
    accel = []
    roll_rate = []
    fin_time = []
    fin_angle = []
    for fourcc, data in fclog.read():
        if fourcc == 'ADIS':
            adis_time.append(data['timestamp'])
            roll_rate.append(data['Gyro_X']*360)
            accel.append(data['Acc_X'])
        elif fourcc == 'ROLL':
            fin_time.append(data['timestamp'])
            fin_angle.append(data['Angle'])
        elif fourcc != 'SEQN':
            print fourcc, data


# Time in seconds
fin_time = numpy.array(fin_time)
adis_time = numpy.array(adis_time)
adis_time -= adis_time[0]
adis_time = adis_time / 1e9
fin_time -= fin_time[0]
fin_time = fin_time / 1e9


Skipped unknown header: MESG

MESG {'timestamp': 2765483312}

Skipped unknown header: h

h {'timestamp': 90500535943170}
boundary?

In [22]:
%matplotlib inline
import utils
from matplotlib import rcParams
rcParams.update({'font.size': 14})

fig = utils.Plot(r"Fin Angle", "Time [$s$]", r"$\alpha$ [${}^0$]")
fig.plot(fin_time, fin_angle)
fig.ylim([-15, 15])
fig.show()



In [23]:
fig = utils.Plot(r"Roll Rate", "Time [$s$]", r"Roll Rate [${}^0/s$]")
fig.plot(adis_time, roll_rate)
fig.ylim([-400, 400])
fig.show()