LinuxCNC-on-RPi

How to get LinuxCNC running on a RPi

View the Project on GitHub scottalford75/LinuxCNC-on-RPi

VTK for QtPyVCP on Raspberry Pi

QtPyVCP utilises VTK to provide GCode back plot functionality. Unfortunately there is no pip package for VTK and the normal installation of QtPyVCP fails. Below is the procedure using the development installation instructions with some adjustmentsto to use a specifically compiled version of VTK 7.1.1 with Qt5 and Python 2 wrapping. The key to being able to build VTK with OpenGL “legacy” is to install libopengl-dev and configure with VTK_RENDERING_BACKEND:STRING=OpenGL not OpenGL2 which tries to use later versions of OpenGL that are currently not supported on the RPi.

STEP 1: Download and install

Download and install the VTK deb pacakge.

wget https://github.com/scottalford75/LinuxCNC-on-RPi/blob/master/Pi%20OS/vtk_7.1.1-qt5py2-1_armhf.deb
sudo dpkg -i vtk_7.1.1-qt5py2-1_armhf.deb

STEP 2: Update Python Path

Modify your .bashrc file in your home directory and add the following line. This will add the path to your PYTHONPATH each time xwindows starts.

export PYTHONPATH=/usr/local/lib/python2.7/site-packages:/usr/local/lib/python2.7/site-packages/vtk:$PYTHONPATH
export LD_LIBRARY_PATH=/usr/local/lib:/usr/local/lib/python2.7/site-packages/vtk:$LD_LIBRARY_PATH

STEP 3: Install dependencies

Install dependencies as per the QtPyVCP installation guide.

VTK 7.1.1 also has the following dependencies:

sudo apt-get install libhdf5-dev libnetcdf-cxx-legacy-dev libjsoncpp-dev libgl2ps-dev

STEP 4: Modify the install

In the qtpyvcp source directory, modify the setup.py and comment out the VTK dependency.

    install_requires=[
        'docopt',
        'qtpy',
        'pyudev',
        'psutil',
        'HiYaPyCo',
        'pyopengl',
        #'vtk',
        'pyqtgraph',
        'more-itertools',
    ],

STEP 5: Install QtPyVCP

Install QtPyVCP as per normal development installation instructions.

pip install --editable .

STEP 6: Add simulation configurations

If you want to test with the simulation configurations simply copy the config directory from the ~/qtpyvcp/linuxcnc/configs directory into your ~/linuxcnc/configs directory.