Crate tudelft_xray_sim

source ·
Expand description

Simulation library for the modeling assignment in the course ‘Software Systems’ at the TU Delft.

The expected way to interact with this library is to implement the PedalMapper and ActionLogic traits and then use either run_single_plane_sim or run_double_plane_sim from your main function. A GUI will appear with a checkbox for each pedal, and a display for each of the available planes.

Depending on the implementation of the two traits mentioned above, pressing each pedal will modify the state of the planes. All interaction is logged, as well as any potential warnings or errors caused by improper commands.

Here is the absolute minimum you have to do to get the simulation to run:

use tudelft_xray_sim::*;

fn main() {
    run_single_plane_sim(Logic);
}

struct Logic;

impl PedalMapper for Logic {
    type Pedals = ThreePedals;
    fn on_press(&self, pedal: Self::Pedals) -> Option<Request> { None }
    fn on_release(&self, pedal: Self::Pedals) -> Option<Request> { None }
}

impl ActionLogic<false> for Logic {
    fn handle_request(&mut self, request: Request, controller: &mut Controller<false>) {}
}

Logging is done with log, so any logger which supports it will work. For example you can use simple_logger to print everything to the standard output (default configuration).

fn main() {
    simple_logger::init().unwrap();
    // ...
}

Structs

Controller for the X-ray planes in the system.
An X-ray plane. The projection of each plane is either frontal or lateral.

Enums

X-ray dose setting.
The mode of the X-ray plane.
Projection of plane or X-ray.
Request sent from PedalMapper to ActionLogic.
Enum to represent the 6 pedals in a two-plane system.
Enum to represent the 3 pedals present in a one-plane system.

Traits

Resolve requests into X-ray controller actions.
A mapping from pedal actions to requests.

Functions

Run a double-plane simulation with six pedals.
Run a single-plane simulation with three pedals.