def scheme_2_(self, vec): ''' 方案1 采用单独使用 油箱2 的方式 计算投影在偏差向量的长度 个人觉得还是不要对圆心质心求偏移向量了 还是对真实情况减去1kg 然后再加上1kg 还原 :param vec: 偏差向量 list :return: 一个标量 带符号的书 ''' cur_weight_point, central, weight = self.renew_centroid() if self.oildrums[1].add_one_second(0.01) < 0: return False, 0 # 重新计算重心 cur_weight_point_, central_, weight_ = self.renew_centroid() # 根据两次计算得到 飞行器 质心偏移向量 self.oildrums[1].consume_one_second(0.01) # 还原质量 v = [ cur_weight_point_.getX() - cur_weight_point.getX(), cur_weight_point_.getY() - cur_weight_point.getY(), cur_weight_point_.getZ() - cur_weight_point.getZ() ] theta = cal_included_angle(v, vec) # 投影 标量已经带上正负 projection = math.sqrt( math.pow(v[0], 2) + math.pow(v[1], 2) + math.pow(v[2], 2)) * math.cos(math.radians(theta)) return True, projection
def scheme_4_for_four(self, vec, theta): ''' 方案2 单独使用油箱4 计算投影在偏差向量的长度 :param vec:偏差向量 list :return: ''' cur_weight_point, central, weight = self.renew_centroid_for_four(theta) if self.oildrums[3].consume_one_second(0.01) < 0: return False, 0 # 重新计算重心 cur_weight_point_, central_, weight_ = self.renew_centroid_for_four( theta) # 根据两次计算得到 飞行器 质心偏移向量 self.oildrums[3].add_one_second(0.01) # 还原质量 v = [ cur_weight_point_.getX() - cur_weight_point.getX(), cur_weight_point_.getY() - cur_weight_point.getY(), cur_weight_point_.getZ() - cur_weight_point.getZ() ] theta_ = cal_included_angle(v, vec) # 投影 标量已经带上正负 projection = math.sqrt( math.pow(v[0], 2) + math.pow(v[1], 2) + math.pow(v[2], 2)) * math.cos(math.radians(theta_)) return True, projection
def scheme_6_for_four(self, vec, theta): ''' 不能独立的方案 使用油箱6 供给给油箱5 产生的向量 :return: ''' cur_weight_point, central, weight = self.renew_centroid_for_four(theta) if self.oildrums[5].consume_one_second(0.01) < 0: return False, 0 # 重新计算重心 cur_weight_point_, central_, weight_ = self.renew_centroid_for_four( theta) # 根据两次计算得到 飞行器 质心偏移向量 self.oildrums[5].add_one_second(0.01) # 还原质量 v = [ cur_weight_point_.getX() - cur_weight_point.getX(), cur_weight_point_.getY() - cur_weight_point.getY(), cur_weight_point_.getZ() - cur_weight_point.getZ() ] theta_ = cal_included_angle(v, vec) # 投影 标量已经带上正负 projection = math.sqrt( math.pow(v[0], 2) + math.pow(v[1], 2) + math.pow(v[2], 2)) * math.cos(math.radians(theta_)) # ------ 对于油桶5的影响 if self.oildrums[4].add_one_second(0.01) < 0: return False, 0 # 重新计算重心 cur_weight_point_, central_, weight_ = self.renew_centroid_for_four( theta) # 根据两次计算得到 飞行器 质心偏移向量 self.oildrums[4].consume_one_second(0.01) # 还原质量 vv = [ cur_weight_point_.getX() - cur_weight_point.getX(), cur_weight_point_.getY() - cur_weight_point.getY(), cur_weight_point_.getZ() - cur_weight_point.getZ() ] theta_ = cal_included_angle(vv, vec) # 投影 标量已经带上正负 projection_ = math.sqrt( math.pow(vv[0], 2) + math.pow(vv[1], 2) + math.pow(vv[2], 2)) * math.cos(math.radians(theta_)) projection = projection + projection_ return True, projection