def initialize(self): name = poster_name(self.component_name, self.kwargs) # if we want to use a static DepthCamera as a Velodyne # then num_rotation = 1 will prevent buffering. num_rotation = 1 if 'rotation' in dir(self.component_instance): num_rotation += int(2 * pi / self.component_instance.rotation) logger.info("num_rotation %d" % num_rotation) self.obj = Velodyne(name, self.component_instance.image_width, self.component_instance.image_height, num_rotation)
def initialize(self): name = poster_name(self.component_name, self.kwargs) self.camera_order = [] """ Prepare the data for a viam poster """ self.cameras = [] self.pos_cam = [] # Get the names of the data for the cameras try: # Stereo unit case for camera_name in self.component_instance.camera_list: camera_instance = blenderapi.persistantstorage().componentDict[camera_name] self.add_camera(camera_name, camera_instance) except AttributeError: # Video camera case self.add_camera(self.component_name, self.component_instance) if len(self.camera_order) == 1: self.obj = Viam(name, 'mono_bank', 0, self.cameras) # This is the case for a stereo camera if len(self.camera_order) == 2: baseline = math.sqrt( math.pow(self.pos_cam[0][0] - self.pos_cam[1][0], 2) + math.pow(self.pos_cam[0][1] - self.pos_cam[1][1], 2) + math.pow(self.pos_cam[0][2] - self.pos_cam[1][2], 2)) # viam expects first the left camera, then the right camera # Check the y difference between the two cameras if (self.pos_cam[0][1] < self.pos_cam[1][1]): self.cameras.reverse() self.camera_order.reverse() # Create the actual poster self.obj = Viam(name, 'stereo_bank', baseline, self.cameras) if len(self.camera_order) > 2: logger.error("ViamPoster called with more than 2 cameras")
def initialize(self): name = poster_name(self.component_name, self.kwargs) self.camera_order = [] """ Prepare the data for a viam poster """ self.cameras = [] self.pos_cam = [] # Get the names of the data for the cameras try: # Stereo unit case for camera_name in self.component_instance.camera_list: camera_instance = blenderapi.persistantstorage( ).componentDict[camera_name] self.add_camera(camera_name, camera_instance) except AttributeError: # Video camera case self.add_camera(self.component_name, self.component_instance) if len(self.camera_order) == 1: self.obj = Viam(name, 'mono_bank', 0, self.cameras) # This is the case for a stereo camera if len(self.camera_order) == 2: baseline = math.sqrt( math.pow(self.pos_cam[0][0] - self.pos_cam[1][0], 2) + math.pow(self.pos_cam[0][1] - self.pos_cam[1][1], 2) + math.pow(self.pos_cam[0][2] - self.pos_cam[1][2], 2)) # viam expects first the left camera, then the right camera # Check the y difference between the two cameras if (self.pos_cam[0][1] < self.pos_cam[1][1]): self.cameras.reverse() self.camera_order.reverse() # Create the actual poster self.obj = Viam(name, 'stereo_bank', baseline, self.cameras) if len(self.camera_order) > 2: logger.error("ViamPoster called with more than 2 cameras")
def initialize(self): name = poster_name(self.component_name, self.kwargs) self.obj = Stereopixel(name, self.component_instance.image_width, self.component_instance.image_height)
def initialize(self): name = poster_name(self.component_name, self.kwargs) num_rotation = int(2 * pi / self.component_instance.rotation) + 1 logger.info("num_rotation %d" % num_rotation) self.obj = Velodyne(name, self.component_instance.image_width, self.component_instance.image_height, num_rotation)