Example #1
0
def mapping_process(camera, conn: Pipe):

    optimizer = LocalBA()

    keyframes = []
    mappoints = []
    measurements = []

    stopped = False
    while not stopped:

        # we need two things, keyframe poses and measurements
        # the measurements have mappoints, keyframe id and projected position

        new_keyframes = []
        new_mappoints = []
        new_measurements = []
        while not conn.empty()
            new_data = conn.recv()
            if type(new_data) is PipeKeyFrame:
                new_keyframes.append(new_data)
            elif type(new_data) is PipeMapPoint:
                new_mappoints.append(new_data)
            elif type(new_data) is PipeMeasurement:
                new_measurements.append(new_data)

        for kf in new_keyframes:
            optimizer.add_keyframe(kf.id, kf.pose, camera, fixed=True)
        
        for mp in new_mappoints:
            optimizer.add_mappoint(mp.id, mp.position)
 def receive_command_data(self, pipe: multiprocessing.Pipe) -> any:
     if not pipe.empty():
         return pipe.get()
     else:
         return None