pub struct SimulationService { /* private fields */ }Expand description
Simulation service for managing Godot simulations
§Examples
ⓘ
use mecha10_cli::services::SimulationService;
use std::path::Path;
let service = SimulationService::new();
// Validate Godot installation
service.validate_godot()?;
// Generate simulation
service.generate(
Path::new("mecha10.json"),
Path::new("simulation/godot"),
5, // max environments
0 // min score
)?;
// Run simulation
service.run(
"rover-robot",
"warehouse",
false // not headless
)?;Implementations§
Source§impl SimulationService
impl SimulationService
Sourcepub fn with_base_path(base_path: impl Into<PathBuf>) -> Self
pub fn with_base_path(base_path: impl Into<PathBuf>) -> Self
Create a simulation service with custom base path
§Arguments
base_path- Base directory for simulation output
Sourcepub fn validate_godot(&self) -> Result<GodotInfo>
pub fn validate_godot(&self) -> Result<GodotInfo>
Validate Godot installation
Checks if Godot 4.x is installed and accessible.
§Errors
Returns an error if Godot is not found or version is incorrect.
Sourcepub fn generate(
&self,
config_path: &Path,
output_path: &Path,
max_envs: usize,
min_score: i32,
) -> Result<GenerationResult>
pub fn generate( &self, config_path: &Path, output_path: &Path, max_envs: usize, min_score: i32, ) -> Result<GenerationResult>
Generate simulation scenes from project configuration
§Arguments
config_path- Path to mecha10.jsonoutput_path- Output directory for simulation filesmax_envs- Maximum number of environments to generatemin_score- Minimum compatibility score (0-100)
Sourcepub fn generate_robot(
&self,
config_path: &Path,
output_path: &Path,
) -> Result<()>
pub fn generate_robot( &self, config_path: &Path, output_path: &Path, ) -> Result<()>
Generate only the robot scene
§Arguments
config_path- Path to mecha10.jsonoutput_path- Output path for robot.tscn
Sourcepub fn list_environments(
&self,
config_path: &Path,
verbose: bool,
) -> Result<Vec<EnvironmentInfo>>
pub fn list_environments( &self, config_path: &Path, verbose: bool, ) -> Result<Vec<EnvironmentInfo>>
List available environments
§Arguments
config_path- Path to mecha10.jsonverbose- Show detailed information
Sourcepub fn validate_config(&self, config_path: &Path) -> Result<ValidationResult>
pub fn validate_config(&self, config_path: &Path) -> Result<ValidationResult>
Sourcepub fn run(&self, robot_name: &str, env_id: &str, headless: bool) -> Result<()>
pub fn run(&self, robot_name: &str, env_id: &str, headless: bool) -> Result<()>
Run a simulation in Godot
§Arguments
robot_name- Name of the robotenv_id- Environment IDheadless- Run without UI
Sourcepub fn resolve_model_path(&self, model_ref: &str) -> Result<PathBuf>
pub fn resolve_model_path(&self, model_ref: &str) -> Result<PathBuf>
Resolve a model path from package namespace or plain name
Supports multiple formats:
- Package namespace: “@mecha10/simulation-models/rover”
- Plain name: “rover”
Resolution order:
- Framework (monorepo): packages/simulation/models/{name}/
- Project-local: simulation/models/{name}/
§Arguments
model_ref- Model reference (package namespace or plain name)
§Returns
Absolute path to the model directory, or error if not found
Sourcepub fn resolve_environment_path(&self, env_ref: &str) -> Result<PathBuf>
pub fn resolve_environment_path(&self, env_ref: &str) -> Result<PathBuf>
Resolve an environment path from package namespace or plain name
Supports multiple formats:
- Package namespace: “@mecha10/simulation-environments/basic_arena”
- Plain name: “basic_arena”
Resolution order:
- Project-local: simulation/environments/{name}/ (project customizations take precedence)
- Framework (monorepo): packages/simulation/environments/{name}/
§Arguments
env_ref- Environment reference (package namespace or plain name)
§Returns
Absolute path to the environment directory, or error if not found
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SimulationService
impl RefUnwindSafe for SimulationService
impl Send for SimulationService
impl Sync for SimulationService
impl Unpin for SimulationService
impl UnwindSafe for SimulationService
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more