Fixed command frequency
Posted: Fri May 02, 2014 10:40 pm
Hello again,
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:
It would be also great to have a way to check if a packet is sent or when it is sent and also if the copter received the packet and when it did so I can time the latency and all that stuff. Anyways any help is appreciated, thanks in advance.
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))