#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TemplateType {
Basic,
Rover,
Arm,
Humanoid,
}
impl TemplateType {
pub fn as_str(&self) -> &'static str {
match self {
Self::Basic => "basic",
Self::Rover => "rover",
Self::Arm => "arm",
Self::Humanoid => "humanoid",
}
}
pub fn from_str(s: &str) -> Option<Self> {
match s.to_lowercase().as_str() {
"basic" => Some(Self::Basic),
"rover" => Some(Self::Rover),
"arm" => Some(Self::Arm),
"humanoid" => Some(Self::Humanoid),
_ => None,
}
}
pub fn display_name(&self) -> &'static str {
match self {
Self::Basic => "Basic",
Self::Rover => "Rover",
Self::Arm => "Robotic Arm",
Self::Humanoid => "Humanoid",
}
}
pub fn description(&self) -> &'static str {
match self {
Self::Basic => "Minimal robot project with pub/sub messaging",
Self::Rover => "Mobile robot with differential drive and sensors",
Self::Arm => "Manipulator robot with joint control",
Self::Humanoid => "Bipedal robot with full-body control",
}
}
}
#[allow(dead_code)] #[derive(Debug, Clone)]
pub struct NodeSelection {
pub id: String,
pub selected: bool,
}
#[allow(dead_code)] impl NodeSelection {
pub fn new(id: impl Into<String>, selected: bool) -> Self {
Self {
id: id.into(),
selected,
}
}
}
#[allow(dead_code)] #[derive(Debug, Clone)]
pub struct ProjectConfig {
pub name: String,
pub template: TemplateType,
pub nodes: Vec<String>,
pub dev_mode: bool,
pub skip_sim: bool,
}
#[allow(dead_code)] impl ProjectConfig {
pub fn new(name: impl Into<String>, template: TemplateType) -> Self {
Self {
name: name.into(),
template,
nodes: Vec::new(),
dev_mode: false,
skip_sim: false,
}
}
pub fn with_node(mut self, node_id: impl Into<String>) -> Self {
self.nodes.push(node_id.into());
self
}
pub fn with_nodes(mut self, nodes: Vec<String>) -> Self {
self.nodes = nodes;
self
}
pub fn with_dev_mode(mut self, enabled: bool) -> Self {
self.dev_mode = enabled;
self
}
pub fn with_skip_sim(mut self, skip: bool) -> Self {
self.skip_sim = skip;
self
}
}