Skip to main content

sim_components/
lib.rs

1//! Components: belt span, friction contact, gearbox, rotary joint, motor, drive, profile generator, encoder. Know no machine.
2
3/// (language code, translation file contents) for everything the components name.
4pub static I18N: &[(&str, &str)] = &[
5    ("en", include_str!("../i18n/en.ftl")),
6    ("de", include_str!("../i18n/de.ftl")),
7    ("en", include_str!("../i18n/import.en.ftl")),
8    ("de", include_str!("../i18n/import.de.ftl")),
9];
10
11pub mod accuracy;
12pub mod analysis;
13pub mod base;
14pub mod beam;
15pub mod cam;
16pub mod catalog;
17pub mod chain;
18pub mod charts;
19pub mod collision;
20pub mod control;
21pub mod conveyor;
22pub mod dataset;
23pub mod drive;
24pub mod fault;
25pub mod gripper;
26pub mod identify;
27pub mod import;
28pub mod induction;
29pub mod joint;
30pub mod mech;
31pub mod motor_fit;
32pub mod parameters;
33pub mod path;
34pub mod pneumatic;
35pub mod profile;
36pub mod program;
37pub mod report;
38pub mod rigid;
39pub mod search;
40pub mod sensitivity;
41pub mod shaper;
42pub mod shapes;
43pub mod sim;
44pub mod stepper;
45pub mod stop;
46pub mod trace;
47pub mod transmission;
48pub mod tune;
49
50pub use control::{Command, CommandError, Controller, LimitViolation, StopCategory, check_limits};
51pub use drive::DriveMode;
52pub use sim::{Contact, Sim, Snapshot, config_hint, load_config, schema, set_config, set_config_text};
53
54/// Refuses each of `effects` (`effects.<name>`) switched on in `cfg` (`error-effect-not-modelled`): switches a machine's
55/// config has with the others of its crate but that this machine does not model, so that one turned on is not silently
56/// without effect.
57pub fn refuse_unmodelled(cfg: &sim_core::Config, effects: &[&str]) -> Result<(), sim_core::ConfigError> {
58    match effects.iter().find(|e| cfg.bool(&format!("effects.{e}")) == Ok(true)) {
59        Some(e) => Err(sim_core::ConfigError::Part("error-effect-not-modelled", format!("effects.{e}"))),
60        None => Ok(()),
61    }
62}