示例#1
0
def leaveDataSet(samples, enviroment,robotHeight, prefSpeed, distPreferences, dataset ):
    
    xMax,xMin,yMax,yMin = enviroment
    careDist,goodDist = distPreferences
    
    for i in range(samples):
        
        z = uniform(1.5,2) #height
        
        endx = uniform(xMin,xMax)
        endy = yMax
        
        dist = uniform(goodDist,careDist)   
                
        startx = uniform(-dist,dist)
        starty = math.sqrt(dist**2 - startx**2)        
        
        path = GeneratePath.pathSpeed([startx,starty,z],[endx,endy,z],prefSpeed)

        trans = GeneratePath.position_transform(path,robotHeight)
        
        dataset.newSequence()
        
        for k in range(len(trans)):
            target = []
            
            if k  < 2:
                target.append(0.25) #smile
            else:
                target.append(-0.5)
            
            target.extend(pupilTracking(trans[k][1], trans[k][2]))
            target.append(0) #eyebrows

            dataset.appendLinked(trans[k],target)
        
    return dataset
示例#2
0
def approachDataSet(samples, enviroment,robotHeight, prefSpeed, distPreferences, dataset ):
    
    xMax,xMin,yMax,yMin = enviroment
    careDist,goodDist = distPreferences
    
    for i in range(samples):
        
        z = uniform(1.5,2) #height
        
        startx = uniform(xMin,xMax)
        starty = yMax
        
        
        endx = 0
        endy = 1       
        
        path = GeneratePath.pathSpeed([startx,starty,z],[endx,endy,z],prefSpeed)

        trans = GeneratePath.position_transform(path,robotHeight)
        
        dataset.newSequence()
        
        for param in trans:
            target = []
            
            if param[0] < careDist:
                target.append(0.25) #smile
            else:
                target.append(0)
            
            target.extend(pupilTracking(param[1], param[2]))
            target.append(0) #eyebrows

            dataset.appendLinked(param,target)
        
    return dataset