예제 #1
0
    def swarm(self,uav_name, blockListDict):
	#separation=rules.separation("iris_1",self.blockListDict)
	#cohesion=rules.cohesion("iris_1",self.blockListDict)
	self.vres[0]=rules.flocking(uav_name, blockListDict)[0] #+ self.x_off
	self.vres[1]=rules.flocking(uav_name, blockListDict)[1] #+ self.y_off
	#self.vres[2]=self.q1.set_v_2D_alt_lya(self.vres[0:1],-1)[2]
	#rules.find_neighbours_in_radius(uav_name,blockListDict,2)
	return self.vres
예제 #2
0
 def swarm(self, uav_name, blockListDict):
     #separation=rules.separation("iris_1",self.blockListDict)
     #cohesion=rules.cohesion("iris_1",self.blockListDict)
     self.vres[0] = rules.flocking(uav_name,
                                   blockListDict)[0]  #+ self.x_off
     self.vres[1] = 0.4 * rules.flocking(uav_name,
                                         blockListDict)[1]  #+ self.y_off
     self.vres[2] = self.q1.set_v_2D_alt_lya(self.vres[0:1], -1)[2]
     return self.vres
예제 #3
0
q1.yaw_d = -np.pi
q2.yaw_d = -np.pi
q3.yaw_d = -np.pi

q4.yaw_d = -np.pi
q5.yaw_d = -np.pi
q6.yaw_d = -np.pi
radius = 50

for drone in quad_list:
    drone.group.syncronize(drone, quad_list, radius)

for t in time:

    for current in quad_list:
        rules.flocking(current, 100)
        current.step(dt)

    if it % frames == 0:
        axis3d.cla()

        ani.draw3d(axis3d, q1.xyz, q1.Rot_bn(), quadcolor[0])
        ani.draw3d(axis3d, q2.xyz, q2.Rot_bn(), quadcolor[0])
        ani.draw3d(axis3d, q3.xyz, q3.Rot_bn(), quadcolor[0])

        ani.draw3d(axis3d, q4.xyz, q4.Rot_bn(), quadcolor[0])
        ani.draw3d(axis3d, q5.xyz, q5.Rot_bn(), quadcolor[0])
        ani.draw3d(axis3d, q6.xyz, q6.Rot_bn(), quadcolor[0])

        axis3d.set_xlim(-15, 15)
        axis3d.set_ylim(-15, 15)
예제 #4
0
 def swarm(self, uav_name, blockListDict):
     #separation=rules.separation("iris_1",self.blockListDict)
     #cohesion=rules.cohesion("iris_1",self.blockListDict)
     self.vres[0] = rules.flocking(uav_name, blockListDict)[0] + self.x_off
     self.vres[1] = rules.flocking(uav_name, blockListDict)[1] + self.y_off
     return self.vres
예제 #5
0
        print packets[p], "percentage of packet loss"
        q1.xyz = xyz1_0
        q2.xyz = xyz2_0
        q3.xyz = xyz3_0

        q4.xyz = xyz4_0
        q5.xyz = xyz5_0
        q6.xyz = xyz6_0
        count = 0
        for t in time:
            radius = 25
            completed = True
            for current in quad_list:
                #if t > 120:
                #     print "spreading..........................................."
                rules.flocking(current, packets[p])
                #else:
                #	rules.flocking(current,packets[p])
                position = current.xyz
                for other in quad_list:
                    if current.tag != other.tag:
                        neighbour = other.xyz
                        distance = math.sqrt(
                            pow((position[0] - neighbour[0]), 2) +
                            pow((position[1] - neighbour[1]), 2))
                        #print distance
                        if distance <= radius:
                            completed = False

            if completed == True:
                count = count + 1
예제 #6
0
q3.yaw_d = -np.pi

q4.yaw_d = -np.pi
q5.yaw_d = -np.pi
q6.yaw_d = -np.pi
radius = 50

for drone in quad_list:
    drone.group.syncronize(drone, quad_list, radius)

for t in time:

    for d in quad_list:
        d.group.syncronize(d, quad_list, radius)
        d.step(dt)
        rules.flocking(d, 100)
        if t > 120:
            for d in quad_list:
                d.group.syncronize(d, quad_list, radius)
                rules.spread(d, 100)

    if it % frames == 0:
        axis3d.cla()

        ani.draw3d(axis3d, q1.xyz, q1.Rot_bn(), quadcolor[0])
        ani.draw3d(axis3d, q2.xyz, q2.Rot_bn(), quadcolor[0])
        ani.draw3d(axis3d, q3.xyz, q3.Rot_bn(), quadcolor[0])

        ani.draw3d(axis3d, q4.xyz, q4.Rot_bn(), quadcolor[0])
        ani.draw3d(axis3d, q5.xyz, q5.Rot_bn(), quadcolor[0])
        ani.draw3d(axis3d, q6.xyz, q6.Rot_bn(), quadcolor[0])