Page 1 of 1

Deck connection Python_script

Posted: Thu Feb 03, 2022 1:29 pm
by RubICS
Hello Everyone,

I must admit that I am still quite a beginner. I was doing the Step_By_Step-Guide, given here: https://www.bitcraze.io/documentation/r ... commander/, and a problem has occurred. I don't understand why my deck, which I use, is not found. Can somebody help me out?

According to the client: I'm using the Deck: bcDWM1000.
Deck.png
Deck.png (11.47 KiB) Viewed 14948 times
What i did now is. I just changed the name of my Deck in the given script from the Step_By_Step-Guide:
Skript.PNG
And unfortunately my deck still can not be found. And i really need some advice, please.

Re: Deck connection Python_script

Posted: Thu Feb 03, 2022 7:09 pm
by jonasdn
Hi RubICS!

Let's see if we can figure this out! It seems like the code change you did should work, it should at least find the deck one thinks.

What is the output when you run that script? And what is the output if you run the basicparam.py example script?

Thanks
Jonas

Re: Deck connection Python_script

Posted: Tue Feb 08, 2022 11:44 am
by RubICS
First of all thank you very much jonasdn for replying.

The output when i run the script is: "no deck is detected" as it is written in the function.

And the Output of the basicparam.py example is this:


Part1.PNG
Part2.PNG
part3.PNG
Bild4.PNG
pART4.PNG
pART4.PNG (13.47 KiB) Viewed 14908 times
As I can see, my deck (bcDWM1000) is also found in that.

Thanks,

RubICS

Re: Deck connection Python_script

Posted: Wed Feb 09, 2022 5:05 am
by jonasdn
Thank you!

Could you give me the complete code of the script that is not working?

Jonas

Re: Deck connection Python_script

Posted: Thu Feb 10, 2022 1:01 pm
by RubICS
Yeah for sure! Thanks for you patience.

Code.PNG
The output is "Deck is NOT attached!"

Thank you very much.

RubICS

Re: Deck connection Python_script

Posted: Fri Feb 11, 2022 8:49 am
by jonasdn
Hi!

Could you post the entire script? Perhaps on pastebin.com ?

Re: Deck connection Python_script

Posted: Tue Feb 15, 2022 10:45 am
by RubICS
Hello Jonasdn,

i hope i did everything right. If so my code can be found here here: https://pastebin.com/SegtpYjL.

Thank you very much.

Re: Deck connection Python_script

Posted: Tue Feb 15, 2022 12:28 pm
by jonasdn
Thank you!

Am I right in understanding you do not get either of the:
print('Deck is attached!')
print('Deck is NOT attached!')

Outputs?

Could you try the following script? I modified it to ask for a parameter update.

Code: Select all

import logging
import sys
import time
from threading import Event

import cflib.crtp
from cflib.crazyflie import Crazyflie
from cflib.crazyflie.syncCrazyflie import SyncCrazyflie
from cflib.positioning.motion_commander import MotionCommander
from cflib.utils import uri_helper

URI = uri_helper.uri_from_env(default='radio://0/80/2M/E7E7E7E7E7')

DEFAULT_HEIGHT = 0.5

deck_attached_event = Event()

logging.basicConfig(level=logging.ERROR)

def take_off_simple(scf):
    with MotionCommander(scf, default_height=DEFAULT_HEIGHT) as mc:
        time.sleep(3)
        mc.stop()


def param_deck_flow(_, value_str):
    value = int(value_str)
    print(value)
    if value:
        deck_attached_event.set()
        print('Deck is attached!')
    else:
        print('Deck is NOT attached!')
        
 
if __name__ == '__main__':
    cflib.crtp.init_drivers()

    with SyncCrazyflie(URI, cf=Crazyflie(rw_cache='./cache')) as scf:

        scf.cf.param.add_update_callback(group='deck', name='bcDWM1000',cb=param_deck_flow)
        scf.cf.param.request_param_update('deck.bcDWM1000')


        if not deck_attached_event.wait(timeout=5):
           print('No flow deck detected!')
           sys.exit(1)

        #take_off_simple(scf)



Re: Deck connection Python_script

Posted: Fri Feb 18, 2022 11:13 am
by RubICS
Hello jonasdn,

i dont know what you did :D :D , but now my deck is going to be detected. Thank you soooooo much :D
The Output is:
1
Deck is attached!
:D :D

yours,

RubIcs