Skip to main content

MAVProxy

  • 2015-11-07 04:35:28 +0000

    Installing MAVProxy on Mac ./
    Installing MAVProxy on Mac

    Install latest version of python

    brew install python

    Install opencv

    brew tap homebrew/science
    brew install opencv

    You need to link cv2.so to cv.so in order for python to use opencv.

    ln -s /usr/local/lib/python2.7/site-packages/cv2.so /usr/local/lib/python2.7/site-packages/cv.so

    http://stackoverflow.com/questions/19155603/can-opencv-be-installed-in-python-virtualenv-on-mac-mountain-lion

    Also link libjpeg so that mavproxy can find it.

    ln -s /usr/local/Cellar/jpeg/8d/lib/libjpeg.8.dylib /usr/local/lib/libjpeg.8.dylib

    Install wxPython

    Download and install cocoa version from http://www.wxpython.org/download.php Or use pip to install

    Install pip packages

    pip install pyinstaller 
    pip install matplotlib 
    pip install pyreadline 
    pip install pyserial 
    pip install pymavlink
    pip install numpy
    pip install pyparsing
    pip install pillow
    or
    brew intsall Pillow

    lxml needs extra flags, so start bash and set it before compiling and installing native extensions. ref: http://lxml.de/installation.html

    ARCHFLAGS="-arch i386 -arch x86_64" CFLAGS=-I/usr/local/include/lzma STATIC_DEPS=true pip install lxml

    *NOTE: Above doesn’t seem to be working! easy_install lxml doesn’t work either. It’s only needed for xml parsing used by param help in mavproxy prompt, so ignore for now.

    Fix and install pymavlink

    git clone https://github.com/mavlink/mavlink.git
    cd mavlink/pymavlink

    Fix the build script

    vim setup.py

    if platform.system() == 'Darwin':
        os.environ["ARCHFLAGS"] = "-arch i386 -arch x86_64"

    build mavnative.o

    python setup.py build
    python setup.py intsall
    lipo -info /usr/local/lib/python2.7/site-packages/mavnative.so
    # Above command should return:
    # Architectures in the fat file: /usr/local/lib/python2.7/site-packages/mavnative.so are: i386 x86_64

    Install MAVProxy

    pip install mavproxy
    rehash

    Run MAVProxy

    Auto detect when there’s only one APM

    mavproxy.py

    OR

    mavproxy.py --master=127.0.0.1:14550

    OR

    mavproxy.py --master=/dev/tty.usbmodem1

    To get the param help working, download the following file into ~/.mavproxy/ and rename it as ~/.mavproxy/ArduCopter.xml

    http://autotest.diydrones.com/Parameters/ArduCopter/apm.pdef.xml

    Example commands

    motortest 1 0 50 10

    Will issue the following command

    MAV_CMD_DO_MOTOR_TEST:
        // param1 : motor sequence number (a number from 1 to max number of motors on the vehicle)
        // param2 : throttle type (0=throttle percentage, 1=PWM, 2=pilot throttle channel pass-through. See MOTOR_TEST_THROTTLE_TYPE enum)
        // param3 : throttle (range depends upon param2)
        // param4 : timeout (in seconds)

    Calibration

    accelcal
    calpress
    compassmot
    level
    ground
    
    # the following is not working...
    module load rcsetup
    rccal start
    rccal stop

    Loading extra modules

    module load <module name>

    List of modules

    https://github.com/Dronecode/MAVProxy/tree/master/MAVProxy/modules

    Building from source and modifying

    pip intall setuptools
    curl https://bootstrap.pypa.io/ez_setup.py -o - | python
    
    # Don't do this, use --prefix= option instead
    # http://stackoverflow.com/questions/4495120/combine-user-with-prefix-error-with-setup-py-install
    #vim ~/.pydistutils.cfg
    #[install]
    #prefix=
    
    git clone https://github.com/Dronecode/MAVProxy.git
    
    ## After modifying python source files, run the following to install MAVProxy and test.
    python setup.py build install --user --prefix=

    Reference:

    %> %> %>