On the "Communication with multiple Crazyflies" thread we established the packet send frequency is about 300 Hz. To design a better controller I have to fix this frequency as exact as possible and even 100 - 20 Hz would do. I can't come up with a better idea than timing the send_setpoint function but I am not sure if this is giving me the actual frequency of the signals. If the queue is set to 1 as we previously discussed does it mean that every time I call send_setpoint, it will wait until that packet is sent? If that is the case I can do something simple like this to fix the frequency to 100 Hz:
Code: Select all
def input_loop(self):
print "input loop running"
while (self.done == False):
tick = time.clock()
self.crazyflie.commander.send_setpoint(self.roll, self.pitch, self.yawrate, self.thrust)
time.sleep(0.01 - (time.clock()-tick))