def _generate_env_properties(self): env_props = bpymorse.get_properties(self.env._bpy_object) longitude = env_props.get('longitude') geod_latitude = env_props.get('latitude') altitude = env_props.get('altitude') if 'angle_against_north' in env_props: angle = env_props.get('angle_against_north') - pi / 2 else: angle = 0.0 try: self.coord_conv = CoordinateConverter(geod_latitude, longitude, altitude, angle) except: self.coord_conv = CoordinateConverter(geod_latitude, longitude, altitude) geoc = self.coord_conv.ecef_to_geocentric( self.coord_conv.ltp_to_ecef( self.coord_conv.blender_to_ltp(numpy.matrix([0.0, 0.0, 0.0])))) geoc[0, 0] = degrees(geoc[0, 0]) geoc[0, 1] = degrees(geoc[0, 1]) geoc[0, 2] -= self.coord_conv.A self.properties['env'] = { 'longitude': geoc[0, 0], 'latitude': geoc[0, 1], 'altitude': geoc[0, 2] }
def unparent_wheels(self): """ Make the wheels orphans, but keep the transformation applied to the parent robot """ # Force Blender to update the transformation matrices of objects bpymorse.get_context_scene().update() wheels = [child for child in self._bpy_object.children if \ "wheel" in child.name.lower()] wnames = ['None'] * 5 keys = [ 'WheelFLName', 'WheelFRName', 'WheelRLName', 'WheelRRName', 'CasterWheelName' ] properties = bpymorse.get_properties(self._bpy_object) for i in range(5): key = keys[i] expected_wheel = properties.get(key, None) if expected_wheel: for wheel in wheels: if wheel.name.startswith(expected_wheel): wnames[i] = wheel.name self.properties(WheelFLName=wnames[0], WheelFRName=wnames[1], WheelRLName=wnames[2], WheelRRName=wnames[3], CasterWheelName=wnames[4]) for wheel in wheels: # Make a copy of the current transformation matrix transformation = wheel.matrix_world.copy() wheel.parent = None wheel.matrix_world = transformation
def unparent_wheels(self): """ Make the wheels orphans, but keep the transformation applied to the parent robot """ # Force Blender to update the transformation matrices of objects bpymorse.get_context_scene().update() wheels = [child for child in self._bpy_object.children if "wheel" in child.name.lower()] wnames = ["None"] * 5 keys = ["WheelFLName", "WheelFRName", "WheelRLName", "WheelRRName", "CasterWheelName"] properties = bpymorse.get_properties(self._bpy_object) for i in range(5): key = keys[i] expected_wheel = properties.get(key, None) if expected_wheel: for wheel in wheels: if wheel.name.startswith(expected_wheel): wnames[i] = wheel.name self.properties( WheelFLName=wnames[0], WheelFRName=wnames[1], WheelRLName=wnames[2], WheelRRName=wnames[3], CasterWheelName=wnames[4], ) for wheel in wheels: # Make a copy of the current transformation matrix transformation = wheel.matrix_world.copy() wheel.parent = None wheel.matrix_world = transformation
def unparent_wheels(self): """ Make the wheels orphans, but keep the transformation applied to the parent robot """ # Force Blender to update the transformation matrices of objects bpymorse.get_context_scene().update() keys = ['WheelFLName', 'WheelFRName', 'WheelRLName', 'WheelRRName', 'CasterWheelName'] properties = bpymorse.get_properties(self._bpy_object) for key in keys: expected_wheel = properties.get(key, None) if expected_wheel: wheel = self.get_child(expected_wheel) if wheel: # Make a copy of the current transformation matrix transformation = wheel.matrix_world.copy() wheel.parent = None wheel.matrix_world = transformation else: logger.error('Wheel %s is required but not found' % expected_wheel)
def unparent_wheels(self): """ Make the wheels orphans, but keep the transformation applied to the parent robot """ # Force Blender to update the transformation matrices of objects bpymorse.get_context_scene().update() keys = [ 'WheelFLName', 'WheelFRName', 'WheelRLName', 'WheelRRName', 'CasterWheelName' ] properties = bpymorse.get_properties(self._bpy_object) for key in keys: expected_wheel = properties.get(key, None) if expected_wheel: wheel = self.get_child(expected_wheel) if wheel: # Make a copy of the current transformation matrix transformation = wheel.matrix_world.copy() wheel.parent = None wheel.matrix_world = transformation else: logger.error('Wheel %s is required but not found' % expected_wheel)