Skip to content

AgPi: Agents on Raspberry Pi

Tushar Semwal edited this page Oct 14, 2017 · 21 revisions

AgPi - An interface for Tartarus and Raspberry Pi

Getting Started

WiringPi is a C library which provides APIs to access the GPIO pins and other peripherals of Raspberry Pi. Thanks to the efforts of Midhul Verma and Nikhil Teja Alamanda, a WiringPi-Prolog wrapper was created as a part AgPi project. Through this wrapper, Tartarus agents can access the different peripherals of a Raspberry Pi. WiringPi-Prolog wrapper is hosted here.

Installing and loading the WiringPi-Prolog interface

  1. Install the latest version of Raspbian on Raspberry Pi. The OS can be downloaded from the following link .
  2. Install swi-prolog on the system (as root user) using the command:
    % sudo apt-get install swi-prolog
  3. Download/Copy the WiringPi-Prolog tar file (provided here) onto the Raspberry pi.
  4. Unzip the WiringPi-Prolog zip file using the command:
    $ unzip <file_name>
  5. Check the swi-prolog installation directory. Generally the location is ‘/usr/lib/swi-prolog’. To check otherwise use the following commands:
    $ swipl
    ?- file_search_path(swi, X). //returns installation directory.
  6. Copy the wipi folder from the unzipped folder(step 4) to the folder returned in step 5.
  7. Get out of superuser if still in it.
  8. Go to your working directory( the folder where you will be working with your project files).
  9. Copy the ‘platform_pi.pl’(provided here) file in this directory.
  10. Now start prolog with sudo permission(very important):
    $ sudo swipl
  11. Consult the platform_pi.pl using:
    ?- consult('platform_pi.pl').
    This will load all of the Tartarus predicates.
  12. Execute the command:
    ?- start_peripherals.
    This will start the Peripheral Interface. Make sure no errors occur during this step.
  13. Now the peripheral interface is ready, and you can use WiringPi Prolog predicates to control the GPIO pins.
Clone this wiki locally