how can i get this to loop like a void loop in c++ arduino ?
at the end of this code figure of 8 it stops .but id like it to loop it there something simple i can add or does python not do that?
how can i loop this code forever https://github.com/bitcraze/crazyflie-l ... nceSync.py
regards batman in disguiese
merci les mec ciao
simple question python code
Re: simple question python code
I would say it is pretty sime in python but you need the indentation to be correct. I've added a loop to run the figure 8 five times below:
Remember though that the flow deck positioning isn't absolute which means the errors will build op and it will slowly drift away from its initial path.
Code: Select all
if __name__ == '__main__':
# Initialize the low-level drivers (don't list the debug drivers)
cflib.crtp.init_drivers(enable_debug_driver=False)
with SyncCrazyflie(URI) as scf:
cf = scf.cf
cf.param.set_value('kalman.resetEstimation', '1')
time.sleep(0.1)
cf.param.set_value('kalman.resetEstimation', '0')
time.sleep(2)
for y in range(10):
cf.commander.send_hover_setpoint(0, 0, 0, y / 25)
time.sleep(0.1)
for figure8loop in range (5):
for _ in range(20):
cf.commander.send_hover_setpoint(0, 0, 0, 0.4)
time.sleep(0.1)
for _ in range(50):
cf.commander.send_hover_setpoint(0.5, 0, 36 * 2, 0.4)
time.sleep(0.1)
for _ in range(50):
cf.commander.send_hover_setpoint(0.5, 0, -36 * 2, 0.4)
time.sleep(0.1)
for _ in range(20):
cf.commander.send_hover_setpoint(0, 0, 0, 0.4)
time.sleep(0.1)
for y in range(10):
cf.commander.send_hover_setpoint(0, 0, 0, (10 - y) / 25)
time.sleep(0.1)
cf.commander.send_stop_setpoint()
-
- Beginner
- Posts: 20
- Joined: Thu Oct 26, 2017 3:24 pm
Re: simple question python code
ok and one last question haha...
as questions just seem to make more questions...
i have also seen that you were able to up the speed it runs the figure of eight how did you do this?
making the delay smaller or larger thrust more pitch yaw?
if i make a sequence how do i make it quicker?imagine i am using the example/flowsequency.py how to make it go faster than it does out of the box?
thanks man
as questions just seem to make more questions...
i have also seen that you were able to up the speed it runs the figure of eight how did you do this?
making the delay smaller or larger thrust more pitch yaw?
if i make a sequence how do i make it quicker?imagine i am using the example/flowsequency.py how to make it go faster than it does out of the box?
thanks man
Re: simple question python code
Kristoffer just pushed a simplified API . Have a look in this example.
Re: simple question python code
I just want to compliment the new Motion Commander. I just ran my first tests, using the Flow deck, and it's a treat to do fairly complicated flightpaths with very few lines. My only notice is that the takeoff velocity seems a bit on the low side, as I've been drifting alot taking off. Changed it to 0.4 and that seems to help. Could just be random though.
-
- Bitcraze
- Posts: 630
- Joined: Tue Jun 30, 2015 7:47 am
Re: simple question python code
Thanks! I'm happy you liked it!I just want to compliment the new Motion Commander