USC-ACTLab / crazyswarm

A Large Quadcopter Swarm
MIT License
319 stars 316 forks source link

Cannot give cmdVel command to all agent... #787

Open cwsung opened 7 months ago

cwsung commented 7 months ago

lately I tried to use cmdVel to move three cfs to adopt cmdVel in my own formation control code. So, I write down the example script to give cmdVel to three cfs like below, but when I run this script only third cf which is "allcfs.crazyflies[2]" is move and other cfs are not react at all.. can anybody give me some advice of this problem? thk u!!

-> test script :

from pycrazyswarm import *

swarm = Crazyswarm() timeHelper = swarm.timeHelper allcfs = swarm.allcfs step = 0

for cf in allcfs.crazyflies: cf.cmdVel(0,0,0,0) timeHelper.sleep(1)

for cf in allcfs.crazyflies: cf.cmdVel(0,0,0,0) timeHelper.sleep(1)

for cf in allcfs.crazyflies: cf.cmdVel(0,0,0,0) timeHelper.sleep(1)

start = timeHelper.time() while 0.0 <= timeHelper.time() - start <= 2.0: for cf in allcfs.crazyflies: cf.cmdVel(0.0, 0.0, 0.0, 39400) timeHelper.sleep(1)

print(timeHelper.time()-start)

while 2.0 <= timeHelper.time()- start <= 6.0: for cf in allcfs.crazyflies: cf.cmdVel(-1,0.0,0.0,39000) timeHelper.sleep(1)

print(timeHelper.time()-start)