Commits

Anonymous committed 3d6e709 Merge

merged unstable to usable

  • Participants
  • Parent commits 87bb690, 211ba49
  • Branches usable

Comments (0)

Files changed (2)

File fview_SphereTrax_usable/fview_SphereTrax.py

 
         # Basic optic flow data
         self.timestamp_last = 0.0
+        self.jab_last_timestamp = 0.0
         self.line_list = []
         self.dpix_list = []
         self.lag_buf = LagList(1)
         center_draw_pt = []
         center_draw_lineseg = []
 
+        if self.jab_last_timestamp > timestamp:
+            print "**out-of-order frame timestamp %.4f (last %.4f) @ %.4f"%(timestamp, self.jab_last_timestamp, time.time())
+        elif self.jab_last_timestamp != 0.0 and abs( timestamp - self.jab_last_timestamp ) > 0.1:
+            print "**large timestamp change from %.4f to %.4f @ %.4f"%(self.jab_last_timestamp, timestamp, time.time())
+        elif self.jab_last_timestamp != 0.0:
+            pass#print "--ok timestamp change from %.4f to %.4f @ %.4f"%(self.jab_last_timestamp, timestamp, time.time())
+        self.jab_last_timestamp = timestamp
+
         if not self.lag_buf.is_ready() or not optic_flow_enable:
             # Buffer is not ready or optic flow is not enabled
             self.of_pix_curr = []
             self.line_list = []
         else:
 
-
 #other option, leave optic flow alone and just do edge tracking along side
             if self.sphere_pos_last is None:
                 self.sphere_pos_last = sphere_pos
 #                print "time", t_start, "of_pix", self.of_pix, "wind", wnd
                 #pull out images from current and previous frames, moved this out from the optic flow for loop
 
-                # WBD - random pulse 2nd attempt
-                # ------------------------------------
-                if self.timestamp_modeler is not None:
+                # get timestamp from modeler -- WBD code added 3/17/12 JAB
+                # https://bitbucket.org/iorodeo/strokelitude/src/5795cb4d917d/strokelitude/strokelitude/strokelitude.py
+                if self.timestamp_modeler.rand_pulse_flag == True:
                     frame_offset = self.timestamp_modeler.get_frame_offset(cam_id)
-                    pulse_width = self.timestamp_modeler.get_width_from_framecnt(framenumber-frame_offset)
+                    pulse_framenumber, pulse_width = self.timestamp_modeler.rand_pulse_data
+                    pulse_framenumber = pulse_framenumber + frame_offset
+                    self.timestamp_modeler.rand_pulse_flag = False
                 else:
-                    pulse_width = 0
-
+                    pulse_framenumber, pulse_width = -1,-1
+                    
                 im_curr = buf
                 im_prev, timestamp_prev = self.lag_buf.val()
                 dt = timestamp - timestamp_prev
                 self.timestamp_last = timestamp
                 #Record sphere_pos_curr for guess in next optic flow calc
                 self.sphere_pos_last = sphere_pos_curr
+            # if timestamp outside of poll interval
         draw_points = [(m+m_off,n+n_off) for (m,n) in self.of_pix_curr] 
         draw_linesegs = self.line_list # already corrected
 
 import os.path
 from setuptools import setup
-version = '0.1.6'
+version = '0.1.7'
 
 setup(name='fview_SphereTrax_usable',
       description='fview plugin to track angular velocity of a sphere',