pub struct SeshRuntime {Show 14 fields
pub gpio_bank: HashMap<u32, VirtualPin>,
pub odometry: RobotOdometry,
pub ros_topics: HashMap<String, VecDeque<RosMessage>>,
pub scope_stack: Vec<HashMap<String, Value>>,
pub robot_pin_map: HashMap<String, u32>,
pub functions: HashMap<String, FnDecl>,
pub pid_controllers: HashMap<String, PidState>,
pub state_machines: HashMap<String, String>,
pub callsite_counters: HashMap<String, usize>,
pub current_task_name: String,
pub control_flow: ControlFlow,
pub start_time: Instant,
pub logs: Vec<String>,
pub watchdog_ok: bool,
}Expand description
The Sesh Virtual Robotics Hardware Simulator and Runtime Engine
Fields§
§gpio_bank: HashMap<u32, VirtualPin>§odometry: RobotOdometry§ros_topics: HashMap<String, VecDeque<RosMessage>>§scope_stack: Vec<HashMap<String, Value>>§robot_pin_map: HashMap<String, u32>§functions: HashMap<String, FnDecl>§pid_controllers: HashMap<String, PidState>§state_machines: HashMap<String, String>§callsite_counters: HashMap<String, usize>§current_task_name: String§control_flow: ControlFlow§start_time: Instant§logs: Vec<String>§watchdog_ok: boolImplementations§
Source§impl SeshRuntime
impl SeshRuntime
pub fn new() -> Self
pub fn log_event(&mut self, msg: String)
pub fn push_scope(&mut self)
pub fn pop_scope(&mut self)
pub fn define_var(&mut self, name: &str, val: Value)
pub fn assign_var(&mut self, name: &str, val: Value) -> bool
pub fn lookup_var(&self, name: &str) -> Value
pub fn gpio_set_mode(&mut self, pin: u32, mode: PinMode)
pub fn gpio_write(&mut self, pin: u32, level: bool)
pub fn gpio_read(&self, pin: u32) -> bool
pub fn pwm_write(&mut self, pin: u32, duty: u32)
pub fn ultrasonic_read(&mut self, _trig_pin: u32, _echo_pin: u32) -> f64
pub fn ros_publish(&mut self, topic: &str, payload: &str)
pub fn update_kinematics(&mut self)
Sourcepub fn run_scheduler_simulation(
&mut self,
program: &Program,
total_cycles: usize,
) -> Result<(), String>
pub fn run_scheduler_simulation( &mut self, program: &Program, total_cycles: usize, ) -> Result<(), String>
Run a multi-cycle real-time scheduler simulation over all tasks in priority order
pub fn render_sim_dashboard(&self) -> String
pub fn register_program(&mut self, program: &Program)
pub fn execute_program(&mut self, program: &Program) -> Result<Value, String>
Sourcepub fn run_simulation(
&mut self,
program: &Program,
cycles: usize,
) -> Result<Value, String>
pub fn run_simulation( &mut self, program: &Program, cycles: usize, ) -> Result<Value, String>
Run a multi-cycle real-time simulation over all tasks in priority order
pub fn execute_block(&mut self, block: &Block) -> Result<Value, String>
pub fn execute_stmt(&mut self, stmt: &Stmt) -> Result<Value, String>
pub fn eval_expr(&mut self, expr: &Expr) -> Result<Value, String>
pub fn to_json_state(&self) -> String
Trait Implementations§
Auto Trait Implementations§
impl Freeze for SeshRuntime
impl RefUnwindSafe for SeshRuntime
impl Send for SeshRuntime
impl Sync for SeshRuntime
impl Unpin for SeshRuntime
impl UnsafeUnpin for SeshRuntime
impl UnwindSafe for SeshRuntime
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more