1 stable release
1.0.0 | Jan 11, 2023 |
---|
#4 in #xray
29KB
393 lines
tudelft-xray-sim
Simulation library for the modeling assignment in the course 'Software Systems' at the TU Delft.
See the course website and documentation for more information.
lib.rs
:
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();
// ...
}
Dependencies
~7–19MB
~278K SLoC