Skip to main content

symbios_robot/
lib.rs

1//! # symbios-robot
2//!
3//! Engine-agnostic robot interpretation layer for [Symbios](https://crates.io/crates/symbios) L-Systems.
4//!
5//! This crate translates an L-System symbol sequence into a [`blueprint::RobotBlueprint`] —
6//! a complete description of a robot's topology (rigid bodies, joints, sensors) that decouples
7//! the *Genotype* (L-System string) from the *Phenotype* (physics simulation).
8//!
9//! ## Quick start
10//!
11//! ```rust,ignore
12//! use symbios::{SymbiosState, SymbolTable};
13//! use symbios_robot::{RobotConfig, RobotInterpreter};
14//!
15//! let mut interner = SymbolTable::new();
16//! interner.intern("B").unwrap();
17//!
18//! let mut interpreter = RobotInterpreter::new(RobotConfig::default());
19//! interpreter.populate_standard_symbols(&interner);
20//!
21//! let mut state = SymbiosState::new();
22//! let b_id = interner.resolve_id("B").unwrap();
23//! state.push(b_id, 0.0, &[1.0, 0.1, 0.1]).unwrap();
24//!
25//! let blueprint = interpreter.build_blueprint(&state);
26//! assert_eq!(blueprint.modules.len(), 1);
27//! ```
28//!
29//! ## Modules
30//!
31//! - [`blueprint`] — Engine-agnostic data: [`blueprint::RobotBlueprint`],
32//!   [`blueprint::RobotModule`], [`blueprint::ShapePrimitive`],
33//!   [`blueprint::JointDefinition`], [`blueprint::JointType`] /
34//!   [`blueprint::JointTypeKind`], [`blueprint::AxisLimit`],
35//!   [`blueprint::EndEffector`] (addressed by [`blueprint::EndEffectorId`]),
36//!   [`blueprint::SensorMount`] / [`blueprint::SensorType`], and the
37//!   [`blueprint::ModuleId`] / [`blueprint::MaterialId`] aliases.
38//! - [`interpreter`] — [`interpreter::RobotInterpreter`] (with
39//!   [`interpreter::RobotInterpreter::set_op`],
40//!   [`interpreter::RobotInterpreter::with_map`], and
41//!   [`interpreter::RobotInterpreter::populate_standard_symbols`]) plus
42//!   [`interpreter::RobotConfig`].
43//! - [`turtle`] — [`turtle::RobotTurtleState`], [`turtle::RobotOp`], and
44//!   [`turtle::ActiveJointConfig`] (the per-step state the interpreter
45//!   threads through the symbol stream).
46//!
47//! All public items in these modules are re-exported at the crate root.
48
49pub mod blueprint;
50pub mod interpreter;
51pub mod turtle;
52
53pub use blueprint::*;
54pub use interpreter::*;
55pub use turtle::*;