Skip to content

isacg5/first_assignmentARP

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ARP-Hoist-Assignment

First Advanced and Robot Programming (ARP) assignment. This assignment works with the ncurses library and konsole, so it is necessary to have them installed. Thre are provided two folders, one called src that include the c files for each process and other called include that contain the header of each c file. Once the program will be executed there will appear two more folders: bin, that will contain the executables and log, that will contain five log files (one per proccess) with the timestamp and the modifications.

This assignment consists on the simulation of a hoist mechanism, that can be controlled with the velocities for the worker. The hoist has two degrees of freedom: the x axis and the z axis. The worker can also intervene by pressing a reset button, that will make the mechanism go back to the initial position, or press and emergency stop button, that will stop the mechanism, regardless of the state the mechanism is in. If the system is stopped for more than one minute, the program will finish.

konsole installation

To install the ncurses library, simply open a terminal and type the following command:

sudo apt-get install konsole

ncurses installation

To install the ncurses library, simply open a terminal and type the following command:

sudo apt-get install libncurses-dev

Compiling and running the code

The assignment provides a shell script that compiles and executes the code. Please, notice that for the first time, once the repository has been clone, is necesary to give permissions:

chmod +x script.sh

Once the permission have been done, the assignment is executed by typing:

./script.sh

After compiling,the user will be able to see two screens, the inspection window and the command window.

How the assignment works

The assignment is divided into 6 processes: master, command, m1, m2, world and inspection:

  • Master process: This process is the main process. It created all the remaining five processes, and keeps checking if there has been any modification in the log files. If there has been no modifciation for the last 60 seconds, the master kills all the processes, himself, and finishes the program.
  • Command process: This process read from the input of the user. The user has six buttons to control de velocity of the vertical axis (z) and the horizontal axis (x). Notice that the velocity range for both axis goes from -2 to 2.
  • M1 process: This process contains the information of motor1, that is the one corresponding to x axis. In this process is calculated the position given the velocity, with 30 hertz of frequency.
  • M2 process: This process contains the information of motor2, that is the one corresponding to z axis. In this process is calculated the position given the velocity, with 30 hertz of frequency.
  • World process: This process joint the information of both motors, and add an error of +-5%, as if it would be a real mechanish.
  • Inspection process: This process receives the value of the world process and updates the inspection window to be able to see the movement of the mechanims. It also has two buttons that work through signals: reset and stop, that are sent to command and motors processed. The reset signal, once pressed, make the mechanismm go backwards with a velocity of -1 until arrive to (0,0) position. The stop button simulates an emergency button that stops all the mechanism.

Here is presented a brief scheme of how the assignment is working: SCHEME

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages