Skip to main content

SeshRuntime

Struct SeshRuntime 

Source
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: bool

Implementations§

Source§

impl SeshRuntime

Source

pub fn new() -> Self

Source

pub fn log_event(&mut self, msg: String)

Source

pub fn push_scope(&mut self)

Source

pub fn pop_scope(&mut self)

Source

pub fn define_var(&mut self, name: &str, val: Value)

Source

pub fn assign_var(&mut self, name: &str, val: Value) -> bool

Source

pub fn lookup_var(&self, name: &str) -> Value

Source

pub fn gpio_set_mode(&mut self, pin: u32, mode: PinMode)

Source

pub fn gpio_write(&mut self, pin: u32, level: bool)

Source

pub fn gpio_read(&self, pin: u32) -> bool

Source

pub fn pwm_write(&mut self, pin: u32, duty: u32)

Source

pub fn ultrasonic_read(&mut self, _trig_pin: u32, _echo_pin: u32) -> f64

Source

pub fn ros_publish(&mut self, topic: &str, payload: &str)

Source

pub fn update_kinematics(&mut self)

Source

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

Source

pub fn render_sim_dashboard(&self) -> String

Source

pub fn register_program(&mut self, program: &Program)

Source

pub fn execute_program(&mut self, program: &Program) -> Result<Value, String>

Source

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

Source

pub fn execute_block(&mut self, block: &Block) -> Result<Value, String>

Source

pub fn execute_stmt(&mut self, stmt: &Stmt) -> Result<Value, String>

Source

pub fn eval_expr(&mut self, expr: &Expr) -> Result<Value, String>

Source

pub fn to_json_state(&self) -> String

Trait Implementations§

Source§

impl Default for SeshRuntime

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.