An overview of this program function.
Go to Introduction
How install and run this program in Linux.
Go to Installation and Execution
Legend of the buttons present in the two windows.
Go to Legend of Buttons
A rapid description of how the program works.
Go to How it works
The goal of this assignment is to test and deploy an interactive simulator of hoist with 2 degrees of freedom, in which two different consoles allow the user to activate the hoist.
In the octagonal box there are two motors mx and mz, which displace the hoist along the two
respective axes. (Motions along axes have their bounds, from 0 to max_x along the x axis and from 0 to max_z along the z axis).
From the user side there are two consoles (konsole windows), which contain the GUIs, one of these is the Inspection Console, that has a red button STOP (which purpose is to immediately stop all the movements along x and z axes) and an orange button RESET (which purpose is to reset all, dragging the hoist to the initial position), while the other one is the Command Console which contains the keys, clickable by the user, with different aims.
This two consoles allow to simulate a real system.
Command Console:
- Vx++ -> X axis increase
- Vx-- -> X axis decrease
- STP (between Vx-- and Vx++) -> X axis stop
- Vz++ -> Z axis increase
- Vz-- -> Z axis decrease
- STP (between Vz-- and Vz++) -> Z axis stop
Inspection Console:
- S (red button): emergency stop, the joist stops immediately until a command from the first console arrives
- R (orange button): reset, the joint stops, both axes go to a zero position and wait for commands (NB: it can be preempted by the S button)
1.Open the terminal
2.Download the repository:
git clone https://github.com/MickyMori/ARP_Assignment_1This repository contains:
- This 'README.md' file.
- The
srcfolder, which contains the source code for the Command console, Inspection console, Motor_x, Motor_z, World and Master processes. - The
includefolder contains all the data structures and methods used within the ncurses framework to build the two GUIs. Unless you want to expand the graphical capabilities of the UIs (which requires understanding how ncurses works), you can ignore the content of this folder, as it already provides you with all the necessary functionalities. - The
compiler.shandrun.shfiles.
3.Compile the source files:
bash compiler.shOnce this command has been run, logFiles and bin folders will be created.
4.Execute the program:
bash run.shIf you want to read a specific log file of a process:
Go in the log files directory:
cd logFilesCommand console log file:
cat command.logInspection console log file:
cat inspection.logMaster log file:
cat master.logMotor x log file:
cat motor_x.logMotor z log file:
cat motor_z.logWorld log file:
cat world.logThere are 5 processes:
-
Command Console: reads the commands clicked in the window from the user; To see these commands click here.
-
Inspection Console: receives from motor x and motor z the hoist position and show it on the specific interface, it also contains the
stopbutton and theresetbutton; To see these buttons click here. -
Motor X: receives commands, simulates the motion along x axis and sends the real time position to the World process.
-
Motor Z: receives commands, simulates the motion along z axis and sends the real time position to the World process.
-
World: add the errors to the positions received by Motor X and Motor Z and sends this recalculated position to the Inspection Console.
-
Master: his main function is to start all the processes and it contains a
Watchdogfunction that checks all the processes periodically and kills all of them in case they are all idle.