Editing Motion Commander

Discussions and questions about the Crazyflie Nano Quadcopter
zachterrell57
Beginner
Posts: 6
Joined: Mon Oct 14, 2019 5:02 am

Editing Motion Commander

Post by zachterrell57 » Mon Oct 14, 2019 1:50 pm

Is it possible to edit the motion_commander.py file? While trying to run the test python script, the crazyflie fails to take off properly. I think this is due to the lack of thrust in the takeoff sequence. When I go to edit the MotionCommander class, the changes are not reflected in my flight script because the import of the MotionCommander module is not updated. Is this the right way of handling this problem?



arnaud
Bitcraze
Posts: 2136
Joined: Tue Feb 06, 2007 12:36 pm

Re: Editing Motion Commander

Post by arnaud » Mon Oct 14, 2019 2:46 pm

You are likely using a system install of the lib and not your local lib. To use your local lib you need to install it in edit mode with "pip3 install -e .". The following commands should do it:

Code: Select all

python3 -m pip uninstall cflib
python3 -m pip uninstall cflib   # to make sure it was not also installed system-wide

cd crazyflie-lib-python
python3 -m pip install -e .

zachterrell57
Beginner
Posts: 6
Joined: Mon Oct 14, 2019 5:02 am

Re: Editing Motion Commander

Post by zachterrell57 » Mon Oct 14, 2019 2:54 pm

Arnaud,

Thank you for the reply. I ran the commands in the terminal but it responds with "-e option requires 1 argument". Is there something that I have to put after the -e in order to make it run?

arnaud
Bitcraze
Posts: 2136
Joined: Tue Feb 06, 2007 12:36 pm

Re: Editing Motion Commander

Post by arnaud » Mon Oct 14, 2019 3:01 pm

Yes, a dot for the current folder.

zachterrell57
Beginner
Posts: 6
Joined: Mon Oct 14, 2019 5:02 am

Re: Editing Motion Commander

Post by zachterrell57 » Mon Oct 14, 2019 3:06 pm

Arnaud,

Brilliant, that installed correctly. However, when I run the test python script provided on the wiki the crazyflie still does not generate enough thrust to take off. Seeing as I can run it get it to take off with my phone, I don't believe this is a motor or hardware issue. Do you have any suggestions for this?

arnaud
Bitcraze
Posts: 2136
Joined: Tue Feb 06, 2007 12:36 pm

Re: Editing Motion Commander

Post by arnaud » Mon Oct 14, 2019 6:21 pm

This script is designed to be used with some kind of positioning system like with the flow deck. Do you have a flow deck or other positioning mean installed on your Crazyflie?

A good way to debug would be to fly with the client in assist hover mode, this will essencially control the Crazyflie the same way as motion_commander.

zachterrell57
Beginner
Posts: 6
Joined: Mon Oct 14, 2019 5:02 am

Re: Editing Motion Commander

Post by zachterrell57 » Mon Oct 14, 2019 6:36 pm

Yes I do have the flow deck. Will the changes in the client be reflected when used just with my python scripts? Thank you for working with me.

arnaud
Bitcraze
Posts: 2136
Joined: Tue Feb 06, 2007 12:36 pm

Re: Editing Motion Commander

Post by arnaud » Tue Oct 15, 2019 7:57 am

Nothing will be saved by the client. However with the client you can control the drone manually an get some understanding of what could be happening. If hover mode works in the client for example, it will rule-out motors problems. One thing I would look at in the client is the actual height measurement in the flight control tab, it should be accurate for the hover mode to work at all.

zachterrell57
Beginner
Posts: 6
Joined: Mon Oct 14, 2019 5:02 am

Re: Editing Motion Commander

Post by zachterrell57 » Tue Oct 15, 2019 6:16 pm

Arnaud,

I think I am beginning to understand the problem. While the flow deck is installed, the crazyflie is not detecting it. I noticed this by looking at the console. Do you know of any ways to solve this?

tobias
Bitcraze
Posts: 1911
Joined: Mon Jan 28, 2013 7:17 pm
Location: Sweden

Re: Editing Motion Commander

Post by tobias » Mon Oct 21, 2019 1:52 pm

There could be multiple things but start by checking that it is mounted in the correct way (direction). If it is mounted correctly it could be a connection problem but as only two pin is needed to identity the deck, GND and (marked OW) that is not as likely.

Post Reply