Exemplo n.º 1
0
  def getMocapTraj(self, filename ):
    '''
    Looks up a csv filename for mocap trajectory and if successful, returns times, 
    and 4x4 transforms in world frame.
    @ Params -> filename : CSV File with Mocap Data
    @ Returns -> paths : list of 4x4 transforms found in traj file
                 times : vector of times corresponding to readings
                 
    '''
    paths, times = datafiles.read_frame_trajectory_file(filename)
    transforms = [np.identity(4) for i in paths]
    for i in xrange(0, len(transforms)):
      self.write_frame_record_to_transform(paths[i], transforms[i])

    return (transforms, times)
Exemplo n.º 2
0
import dfab
import dfab.mocap.datafiles as datafiles

# if debugging without Rhino, import the trivial emulation module
if no_rhino:
    import dfab.debug.rhinoscriptsyntax as rs
else:
    import rhinoscriptsyntax as rs

# Look for the data file in the sample data folder.
# N.B. this assumes that the dfab and dfab-data packages are installed in the same folder!
# This is reaching outside the dfab package proper.
filename = os.path.join( dfab.dfab_package_path(), "../dfab-data/motion_capture_example/2014-01-17-Wall-Sweep-with-Robot.traj" )

# load the trajectory data
path, timestamps = datafiles.read_frame_trajectory_file( filename )

# Create a list of Rhino 'plane' objects to return as a path.
planes = []

# Each Rhino 'plane' is constructed from an origin and two basis vectors using
# PlaneFromFrame. Syntax of the PlaneFromFrame operator:
# rs.PlaneFromFrame (origin, x_axis, y_axis)

for f in path:
    origin = f[0]
    xaxis  = f[1]
    yaxis  = f[2]
    planes.append( rs.PlaneFromFrame( origin, xaxis, yaxis ))

# Return the list in a global variable exposed in the Grasshopper interface.