Main Categories
    Filters
    Preferences
    Search

    VMX HAL Library (C++, Java, C#, Python)

    On the Raspberry Pi, the vmx-hal package provides direct access on a Raspberry Pi to all VMX-pi capabilities from C++, Java, C# and Python.

    Reference Guide and API Documentation

    The VMX HAL Library Reference Guide provides an overview for software developers.

    Enabling Communication Interfaces

    The VMX HAL Libraries on the Raspberry Pi communicate with the VMX via an internal SPI bus. For this communication to work, the SPI interface must be enabled with the Raspberry Pi’s raspi-config tool. Additionally, the I2C and Serial interfaces must also be enabled in order to communicate via the VMX I2C and Serial ports.

    To invoke Raspi-config, select Preferences->Raspberry Pi Configuration from the Raspberry Pi system menu.

    Note that the Raspberry Pi Configuration Dialog is different depending upon the version of Raspbian being used.

    Raspbian Buster Configuration

    Click on the “Interfaces” tab and ensure that:

    • SSH, VNC, SPI, I2C and Serial are enabled
    • Serial Console is disabled

    Press OK to save the settings at which point a Raspberry Pi reboot will be required in order for the changes to take effect.

    Raspbian Stretch Configuration

    Click on the “Interfaces” tab and ensure that SSH, SPI, I2C and Serial are enabled. Press OK to save the settings at which point a Raspberry Pi reboot will be required in order for the changes to take effect.

    Finally, you will need to manually disable the serial console on Raspbian Stretch, as follows:

    1. Stop serial-getty from referencing /dev/ttyS0:
    1
    2
    $ sudo systemctl stop serial–[email protected]
    $ sudo systemctl disable serial–[email protected]

    You also need to remove the console from the cmdline.txt. If you edit this with:

    1
    $ sudo nano /boot/cmdline.txt

    you will see something like:

    1
    dwc_otg.lpm_enable=0 console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 elevator=deadline fsck.repair=yes root wait

    remove the line: console=serial0,115200 and save and reboot for changes to take effect.

    Installing VMX HAL on a Raspberry Pi

    The VMX HAL is included within the VMX Robotics Toolkit image. 

    Installed VMX HAL Libraries

    As further described in the VMX HAL Reference Guide, the VMX HAL installer places libraries, include files (for C++) and examples onto the Raspberry PI, including:

    /usr/local/lib/vmx: VMX HAL C,++, Java, Python and C# Libraries

    /usr/local/include/vmxpi: VMX HAL C++ Header Files

    Examples

    A number of HAL example programs are installed, and can be found at /usr/local/src/vmxpi in the following sub-directories:

    • hal_cpp_examples
    • hal_java_examples
    • hal_python_examples
    • hal_csharp_examples