Giter Site home page Giter Site logo

arp-hoist-assignment's Introduction

ARP-Hoist-Assignment

Yassin Farah 4801788

Description

This first Advanced and Robot Programming (ARP) assignment consists in creating a simulation of a port hoist using C programming language. The hoist is controlled by a command window in which there are 6 clickable buttons:

  • Vx+ and Vx- to increment and decrement the speed along the horizontal axis
  • Vz+ and Vz- to increment and decrement the speed along the vertical axis
  • two STP buttons to set the velocity along the two axis to zero

plot

The position of the hoist is graphically shown on a inspection window in which there are 2 clickable buttons:

  • S (stop) to immediately stop the hoist
  • R (reset) to move the hoist back to the initial position, ignoring inputs coming from the command window

plot

Folders content

The repository is organized as follows:

  • the src folder contains the source code for all the processes
  • the include folder contains all the data structures and methods used within the ncurses framework to build the two GUIs

After compiling the program other two directories will be created:

  • the bin folder contains all the executable files
  • the log folder will contain all the log files of the processes after the program will be executed

Processes

The program is composed of 6 processes:

  • command_console.c creates a window where you can send commands to the two motors, using a ncurses GUI
  • mx.c is the process related to the motor that makes the hoist move in the horizontal axis and it listens for commands sent by the command window, computes the new x component of the position and, eventually, sends it to the world.c process
  • mz.c does the same thing as mx.c but it is related to the motor that makes the hoist move in the vertical axis
  • world.c gets the position from the two motors processes and applies a 0.5% random error to the measurement, to better simulate what happens in the real case scenarios, and send the position to the inspection_console.c process
  • inspection_console.c gets the position from the world.c process and displays the hoist on a window, using ncurses GUI. Furthermore, there are the stop and reset buttons, that, in case they're pressed, send a signal to the motors to respectevely stop or go back to the (0,0) position
  • master.c is the first process to be executed and it takes care of launching all the other processes and monitor them as a watchdog. In case one of them terminates unexpectedly or none are doing anything (motors not moving, no commands sent, no signals sent...), the master process will kill all the processes and terminate.

Requirements

The program requires the installation of the konsole program and of the ncurses library. To install the konsole program, simply open a terminal and type the following command:

$ sudo apt-get install konsole

To install the ncurses library, type the following command:

$ sudo apt-get install libncurses-dev

Compiling and running the code

Two shell scripts have been provided to compile and run the code. To compile the code simply open a terminal from inside the directory and type the following command:

$ bash compile.sh

To run the code type the following command:

$ bash run.sh

Log files

During the execution of the program, the processes will write information (new motors speed, new position, signals sent...) on their log file, located in the log directory. In case of an error, more information on what happened will be available in the log file.

arp-hoist-assignment's People

Contributors

yassinfrh avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.