First of all thank you very much for the multilink branch. I am working on the same project with cookednoodle and I just had the chance to implement the multilink. I am able to send commands to multiple crazyflies with both a single radio and multiple radios. However I think I am having some latency issues because my original controller that was set up for a single copter is not working properly with the new code.
Story time: Previously I built up on some example code fetched from somewhere in the forums. It has the server and client setup where the server opens the link to the quad and listens to the client. The client gets the position data from the vicon motion tracking system, filters and estimates stuff and produces a control input, sends it to the server which in turn is sends it to the crazyflie.
The server input loop looks like this:
Code: Select all
def input_loop(self):
while True:
data, peer_addr = self.socket.recvfrom(4096)
if self.peer_addr != peer_addr:
print "Connected to %s:%d" % peer_addr
self.peer_addr = peer_addr
self.last_peer_time = time.time()
try:
input = json.loads(data)
except ValueError:
input = {}
okay = False
if 'point' in input:
okay = True
point = input['point']
try:
tick = time.clock()
self.crazyflie.commander.send_setpoint(
point['roll'],
point['pitch'],
point['yaw'],
point['thrust']
)
tock = time.clock()
print 1/(tock-tick)
except:
self.send_data({'debug': 'error processing point data'})
if 'ping' in input:
okay = True
self.send_data({'pong': input['ping']})
if not okay:
self.send_data({'debug': 'no recognised commands'})
self.crazyflie.commander.send_setpoint(0, 0, 0, 0)
time.sleep(0.1)
self.crazyflie.close_link()
Code: Select all
def input_loop(self):
print "input loop running"
while (self.done == False):
self.crazyflie.commander.send_setpoint(self.roll, self.pitch, self.yawrate, self.thrust)
Using the old server I was able to fly one quad in closed loop successfully and give step inputs to the other using 2 radios. I tried the same thing using only one radio and the resulting crash was painful to watch. It seems we became attached to these little guys.
Sorry for the long post, any help is appreciated and thanks again for the implementation.