[SOLVED] How to run cfclient from source?

Post here to get support
Post Reply
mablem8
Beginner
Posts: 3
Joined: Fri Apr 17, 2015 1:57 am

[SOLVED] How to run cfclient from source?

Post by mablem8 »

My Crazyflie 2.0 has been flying great with the cfclient in the crazyflie-clients-python/bin folder. I have also been able to run basiclog.py and ramp.py from the crazyflie-clients-python/examples folder. I'm going to be doing some control and navigation development, so I'm delving into the Python code. I've done plenty of programming with Python, but the package/module model is new to me. Here's what I've tried so far:

Code: Select all

crazyflie-clients-python/lib/cfclient username$ python
>>> import cfclient
>>> cfclient.main()
INFO:cfclient:Disabling STL printouts
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cfclient.py", line 121, in main
    from ui.main import MainUI
  File "ui/__init__.py", line 36, in <module>
    from cfclient.ui.pluginhelper import PluginHelper
ImportError: No module named ui.pluginhelper
>>> quit()
I cloned crazyflie-clients-python from the current GitHub repo and /lib/cfclient/ui/pluginhelper.py exists.

Next, I tried the following:

Code: Select all

crazyflie-clients-python/lib username$ python
>>> import cfclient
>>> cfclient.main()
INFO:cfclient.cfclient:Disabling STL printouts
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "cfclient/cfclient.py", line 121, in main
    from ui.main import MainUI
  File "cfclient/ui/main.py", line 44, in <module>
    from dialogs.connectiondialogue import ConnectDialogue
  File "cfclient/ui/dialogs/connectiondialogue.py", line 44, in <module>
    '/cfclient/ui/dialogs/connectiondialogue.ui'))
  File "/usr/local/lib/python2.7/site-packages/PyQt4/uic/__init__.py", line 210, in loadUiType
    winfo = compiler.UICompiler().compileUi(uifile, code_string, from_imports, resource_suffix)
  File "/usr/local/lib/python2.7/site-packages/PyQt4/uic/Compiler/compiler.py", line 139, in compileUi
    w = self.parse(input_stream, resource_suffix)
  File "/usr/local/lib/python2.7/site-packages/PyQt4/uic/uiparser.py", line 984, in parse
    document = parse(filename)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 1182, in parse
    tree.parse(source, parser)
  File "/usr/local/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py", line 647, in parse
    source = open(source, "rb")
IOError: [Errno 2] No such file or directory: '/cfclient/ui/dialogs/connectiondialogue.ui'
>>> quit()
I cloned crazyflie-clients-python from the current GitHub repo and /lib/cfclient/ui/dialogs/connectiondialogue.ui DOES exist.

After those tries, I edited crazyflie-clients-python/lib/cfclient/cfclient.py by appending the following code to the end of the file:

Code: Select all

if __name__ == '__main__':
    main()
and tried the following:

Code: Select all

crazyflie-clients-python/lib username$ python cfclient/cfclient.py
INFO:__main__:Disabling STL printouts
Traceback (most recent call last):
  File "cfclient/cfclient.py", line 140, in <module>
    main()
  File "cfclient/cfclient.py", line 121, in main
    from ui.main import MainUI
  File "/Users/bdenbyANT/Documents/afit-local/2015-03-spring-06/eeng-699/crazyflie-clients-python/lib/cfclient/ui/__init__.py", line 36, in <module>
    from cfclient.ui.pluginhelper import PluginHelper
ImportError: No module named ui.pluginhelper
As stated previously, I cloned crazyflie-clients-python from the current GitHub repo and /lib/cfclient/ui/pluginhelper.py exists. No changes to the repo had been made up to when I appended the above code. I'm using OS X Yosemite, but I've also been flying from Ubuntu 14.04. I used the VM a little but abandoned it because I couldn't pass my PS4 controller from the OS X host to the VM guest.

Any help running cfclient from source would be greatly appreciated.
Last edited by mablem8 on Sat Apr 18, 2015 6:35 am, edited 1 time in total.
mablem8
Beginner
Posts: 3
Joined: Fri Apr 17, 2015 1:57 am

Re: How to run cfclient from source?

Post by mablem8 »

Solved: the cfclient file in crazyflie-clients-python/bin is not a binary file; it is a Python script.

Viewing with the nano text editor:

Code: Select all

crazyflie-clients-python/bin username$ nano cfclient
The file defines a couple functions and concludes with the following:

Code: Select all

if __name__ == '__main__':
    init_paths()
    import cfclient
    cfclient.main()
Post Reply