Crate tudelft_xray_sim

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
Controller for the X-ray planes in the system.
Plane
An X-ray plane. The projection of each plane is either frontal or lateral.

Enums§

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

Traits§

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

Functions§

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