def log_data(self): time.sleep(2.0) # DBG: maybe there's some data in the pipe... sampler=self.dev.parsed_sample_sync() try: while not self.end_sampling: rec=sampler.next() tup = rec['imu_m'] self.mxyz=array_append.array_append(self.mxyz,tup) finally: self.dev.enter_command_mode()
def on_release(event): if fig.canvas.toolbar.mode != '': return if event.xdata and ax.pick_start is not None: new_pnt = array([ax.pick_start[0],event.xdata,ax.pick_start[1],event.ydata]) ax.picked=array_append( ax.picked,new_pnt )
mxyz=zeros([0,3],np.float64) plt_xy=ax_xy.plot( mxyz[:,0], mxyz[:,1], 'r.')[0] plt_xz=ax_xz.plot( mxyz[:,0], mxyz[:,2], 'g.')[0] plt_yz=ax_yz.plot( mxyz[:,1], mxyz[:,2], 'b.')[0] max_val=450 for ax in axs: ax.axis([-max_val,max_val,-max_val,max_val]) sampler=fb.parsed_sample_sync() try: for i in range(1000): rec=sampler.next() tup = rec['imu_m'] mxyz=array_append.array_append(mxyz,tup) plt_xy.set_xdata(mxyz[:,0]) plt_xy.set_ydata(mxyz[:,1]) plt_xz.set_xdata(mxyz[:,0]) plt_xz.set_ydata(mxyz[:,2]) plt_yz.set_xdata(mxyz[:,1]) plt_yz.set_ydata(mxyz[:,2]) print len(mxyz) pause(0.001) except KeyboardInterrupt: fb.enter_command_mode() print fb.send("info") #fb.disconnect()