From 06b955875c53cb7cf960831caa7021948af22342 Mon Sep 17 00:00:00 2001 From: Andy Killorin <37423245+Speedy6451@users.noreply.github.com> Date: Thu, 21 Nov 2024 19:48:43 -0500 Subject: [PATCH] sync working dir --- controller/src/main.rs | 587 ++++----- controller/src/vl53l0.rs | 91 ++ python-controller/MPU6050.py | 158 --- python-controller/VL53L0X.py | 648 ---------- python-controller/main.py | 64 - simcontroller/Cargo.lock | 2158 ---------------------------------- simcontroller/Cargo.toml | 10 - simcontroller/Justfile | 4 - simcontroller/src/camera.rs | 122 -- simcontroller/src/main.rs | 193 --- 10 files changed, 404 insertions(+), 3631 deletions(-) create mode 100644 controller/src/vl53l0.rs delete mode 100644 python-controller/MPU6050.py delete mode 100644 python-controller/VL53L0X.py delete mode 100644 python-controller/main.py delete mode 100644 simcontroller/Cargo.lock delete mode 100644 simcontroller/Cargo.toml delete mode 100644 simcontroller/Justfile delete mode 100644 simcontroller/src/camera.rs delete mode 100644 simcontroller/src/main.rs diff --git a/controller/src/main.rs b/controller/src/main.rs index 0e1f578..be6251a 100644 --- a/controller/src/main.rs +++ b/controller/src/main.rs @@ -15,6 +15,8 @@ use core::str::from_utf8; use bt_hci::cmd::info; use cyw43_pio::PioSpi; use embassy_rp::i2c::{Async, I2c}; +use embassy_rp::pwm::{self, Pwm}; +use fixed::FixedU16; use log::*; //use embassy_rp::i2c::InterruptHandler; use embassy_executor::Spawner; @@ -71,6 +73,16 @@ async fn main(spawner: Spawner) { let driver = Driver::new(p.USB, Irqs); spawner.spawn(logger_task(driver)).unwrap(); + let mut flipper = Output::new(p.PIN_22, Level::Low); + + let mut c: pwm::Config = Default::default(); + c.divider = 255.into(); + c.top = 8715; + c.compare_b = 7210; + c.compare_a = 2240; + let mut pwm = Pwm::new_output_ab(p.PWM_SLICE1, p.PIN_18, p.PIN_19, c.clone()); + flipper.set_high(); + let sda = p.PIN_26; let scl = p.PIN_27; let config = embassy_rp::i2c::Config::default(); @@ -128,291 +140,302 @@ async fn main(spawner: Spawner) { //embassy_time::Timer::after_millis(7000).await; - async fn write_to_device<'a, T,const N: usize>(bus: &mut embassy_rp::i2c::I2c<'a, T,Async>, addr: u16, data: [[u8;2];N]) - where T: embassy_rp::i2c::Instance { - for transaction in data { - let _ = bus.write_async(addr, transaction).await; - } - } - - async fn write_flag<'a, T>(bus: &mut embassy_rp::i2c::I2c<'a, T,Async>, addr: u16, reg: u8, bit: u8, value: bool) - where T: embassy_rp::i2c::Instance { - let mut initial: [u8;1] = [0]; - let _ = bus.write_read_async(addr, [reg], &mut initial).await; - let mask = 1 << bit; - if value { - initial[0] |= mask; - } else { - initial[0] &= !mask; - } - let _ = bus.write_async(addr, [reg, initial[0]]).await; - } - - let id = 0x29; - Timer::after_millis(50).await; // sensor boot - write_to_device(&mut bus, id, [ - [0x88, 0x00], - [0x80, 0x01], - [0xFF, 0x01], - [0x00, 0x00], - ]).await; - let mut stop: [u8;1] = [0]; - let _ = bus.write_read_async(id, [0x91], &mut stop); - write_to_device(&mut bus, id, [ - [0x00, 0x01], - [0xFF, 0x00], - [0x80, 0x00], - ]).await; - - // disable SIGNAL_RATE_MSRC (bit 1) and SIGNAL_RATE_PRE_RANGE (bit 4) limit checks - write_flag(&mut bus, id, 0x60, 1, true).await; - write_flag(&mut bus, id, 0x60, 4, true).await; - - let mega_counts_per_second = 0.25; - let mega_counts_per_second: u16 = (mega_counts_per_second * (1<<7) as f64) as u16; - let _ = bus.write_async(id, [FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT as u8, - (mega_counts_per_second >> 8) as u8, - (mega_counts_per_second & 255) as u8 - ]).await; - - // get spad info - let _ = bus.write_async(id, [SYSTEM_SEQUENCE_CONFIG as u8, 0xFF]).await; - - write_to_device(&mut bus, id , [ - [0x80, 0x01], - [0xff, 0x01], - [0x00, 0x00], - [0xff, 0x06], - ]).await; - write_flag(&mut bus, id, 0x83, 3, true).await; - write_to_device(&mut bus, id , [ - [0xff, 0x07], - [0x81, 0x01], - [0x80, 0x01], - [0x94, 0x6b], - [0x83, 0x00], - ]).await; - debug!("starting spad wait"); - loop { - let mut wait: [u8;1] = [0]; - let _ = bus.write_read_async(id, [0x83], &mut wait).await; - if wait[0] != 0 { - break; - } - Timer::after_micros(5).await; - } - debug!("ended spad wait"); - - let _ = bus.write_async(id, [0x83, 0x01]).await; - - let mut value: [u8;1] = [0]; - let _ = bus.write_read_async(id, [0x92], &mut value).await; - write_to_device(&mut bus, id, [ - [0x81, 0x00], - [0xff, 0x06], - ]).await; - write_flag(&mut bus, id, 0x83, 3, false).await; - write_to_device(&mut bus, id, [ - [0xff, 0x01], - [0x00, 0x01], - [0xff, 0x00], - [0x80, 0x00], - ]).await; - let count = value[0] & 0x7f; - let is_aperture = value[0] & 0b10000000; - let is_aperture = is_aperture != 0; - // TODO: vl53l0x.py post line 200 - - let mut spad_map: [u8;6]=[0;6]; - let _ = bus.write_read_async(id, [GLOBAL_CONFIG_SPAD_ENABLES_REF_0 as u8], &mut spad_map); - - write_to_device(&mut bus, id, [ - [0xff, 0x01], - [DYNAMIC_SPAD_REF_EN_START_OFFSET as u8, 0x00], - [DYNAMIC_SPAD_NUM_REQUESTED_REF_SPAD as u8, 0x2c], - [0xff, 0x00], - [DYNAMIC_SPAD_REF_EN_START_OFFSET as u8, 0xb4], - ]).await; - - let mut spads_enabled = 0; - for i in 0..48 { - if i < 12 && is_aperture || spads_enabled >= count { - spad_map[i/8] &= !(1<< (i>>2)); - } else if (spad_map[i/8] & (1<< (i>>2))) != 0 { - spads_enabled += 1; - } - } - - let mut spad_write: [u8;7] = [0;7]; - spad_write[0] = GLOBAL_CONFIG_SPAD_ENABLES_REF_0 as u8; - spad_write[1..].clone_from_slice(&spad_map); - let _ = bus.write_async(id, spad_write).await; - - - write_to_device(&mut bus, id, [ - [0xFF, 0x01], - [0x00, 0x00], - [0xFF, 0x00], - [0x09, 0x00], - [0x10, 0x00], - [0x11, 0x00], - [0x24, 0x01], - [0x25, 0xFF], - [0x75, 0x00], - [0xFF, 0x01], - [0x4E, 0x2C], - [0x48, 0x00], - [0x30, 0x20], - [0xFF, 0x00], - [0x30, 0x09], - [0x54, 0x00], - [0x31, 0x04], - [0x32, 0x03], - [0x40, 0x83], - [0x46, 0x25], - [0x60, 0x00], - [0x27, 0x00], - [0x50, 0x06], - [0x51, 0x00], - [0x52, 0x96], - [0x56, 0x08], - [0x57, 0x30], - [0x61, 0x00], - [0x62, 0x00], - [0x64, 0x00], - [0x65, 0x00], - [0x66, 0xA0], - [0xFF, 0x01], - [0x22, 0x32], - [0x47, 0x14], - [0x49, 0xFF], - [0x4A, 0x00], - [0xFF, 0x00], - [0x7A, 0x0A], - [0x7B, 0x00], - [0x78, 0x21], - [0xFF, 0x01], - [0x23, 0x34], - [0x42, 0x00], - [0x44, 0xFF], - [0x45, 0x26], - [0x46, 0x05], - [0x40, 0x40], - [0x0E, 0x06], - [0x20, 0x1A], - [0x43, 0x40], - [0xFF, 0x00], - [0x34, 0x03], - [0x35, 0x44], - [0xFF, 0x01], - [0x31, 0x04], - [0x4B, 0x09], - [0x4C, 0x05], - [0x4D, 0x04], - [0xFF, 0x00], - [0x44, 0x00], - [0x45, 0x20], - [0x47, 0x08], - [0x48, 0x28], - [0x67, 0x00], - [0x70, 0x04], - [0x71, 0x01], - [0x72, 0xFE], - [0x76, 0x00], - [0x77, 0x00], - [0xFF, 0x01], - [0x0D, 0x01], - [0xFF, 0x00], - [0x80, 0x01], - [0x01, 0xF8], - [0xFF, 0x01], - [0x8E, 0x01], - [0x00, 0x01], - [0xFF, 0x00], - [0x80, 0x00], - ]).await; - //write_flag(&mut bus, id, GPIO_HV_MUX_ACTIVE_HIGH as u8, 4, false).await; - //let _ = bus.write_async(id, [SYSTEM_SEQUENCE_CONFIG as u8, 0x01]).await; - //calibrate(&mut bus, id, 0x40).await; - //let _ = bus.write_async(id, [SYSTEM_SEQUENCE_CONFIG as u8, 0x02]).await; - //calibrate(&mut bus, id, 0x00).await; - //let _ = bus.write_async(id, [SYSTEM_SEQUENCE_CONFIG as u8, 0xe8]).await; - - async fn calibrate<'a, T>(bus: &mut embassy_rp::i2c::I2c<'a, T,Async>, addr: u16, data: u8) - where T: embassy_rp::i2c::Instance { - let _ = bus.write_async(addr, [SYSRANGE_START as u8 ,data | 0x01]).await; - debug!("started calib wait"); - loop { - let mut wait: [u8;1] = [0]; - let _ = bus.write_read_async(addr, [0x13], &mut wait).await; - if wait[0] & 0x07 != 0 { - break; - } - Timer::after_micros(5).await; - } - debug!("ended calib wait"); - write_to_device(bus, addr, [ - [SYSTEM_INTERRUPT_CLEAR as u8, 0x01], - [SYSRANGE_START as u8, 0x00], - ]).await; - } - - - //TODO VL53L0X.cpp L 236-280 - - - // start continuous mode - write_to_device(&mut bus, id, [ - [0x80, 0x01], - [0xFF, 0x01], - [0x00, 0x00], - [0x91, stop[0]], - [0x00, 0x01], - [0xFF, 0x00], - [0x80, 0x00], - //[0x04, 0x00], // measurement delay - [0x00, 0x02], // back to back shots - ]).await; - - //let _ = bus.write_async(0x88u16, [0x00]).await; - //let _ = bus.write_async(0x80u16, [0x01]).await; - //let _ = bus.write_async(0xFFu16, [0x01]).await; - //let _ = bus.write_async(0x00u16, [0x00]).await; - //let _ = bus.write_async(0x00u16, [0x01]).await; - //let _ = bus.write_async(0xFFu16, [0x00]).await; - //let _ = bus.write_async(0x80u16, [0x00]).await; - - //loop { - // debug!("starting wait part 1"); - // loop { - // let mut wait: [u8;1] = [0]; - // let _ = bus.write_read_async(id, [SYSRANGE_START as u8], &mut wait).await; - // debug!("{wait:?}"); - // if wait[0] & 0x01 != 0 { - // break; - // } - // Timer::after_micros(5).await; + //async fn write_to_device<'a, T,const N: usize>(bus: &mut embassy_rp::i2c::I2c<'a, T,Async>, addr: u16, data: [[u8;2];N]) + //where T: embassy_rp::i2c::Instance { + // for transaction in data { + // let _ = bus.write_async(addr, transaction).await; // } - // debug!("starting wait part 2"); + //} + + //async fn write_flag<'a, T>(bus: &mut embassy_rp::i2c::I2c<'a, T,Async>, addr: u16, reg: u8, bit: u8, value: bool) + //where T: embassy_rp::i2c::Instance { + // let mut initial: [u8;1] = [0]; + // let _ = bus.write_read_async(addr, [reg], &mut initial).await; + // let mask = 1 << bit; + // if value { + // initial[0] |= mask; + // } else { + // initial[0] &= !mask; + // } + // let _ = bus.write_async(addr, [reg, initial[0]]).await; + //} + + //let id = 0x29; + //Timer::after_millis(50).await; // sensor boot + //write_to_device(&mut bus, id, [ + // [0x88, 0x00], + // [0x80, 0x01], + // [0xFF, 0x01], + // [0x00, 0x00], + //]).await; + //let mut stop: [u8;1] = [0]; + //let _ = bus.write_read_async(id, [0x91], &mut stop); + //write_to_device(&mut bus, id, [ + // [0x00, 0x01], + // [0xFF, 0x00], + // [0x80, 0x00], + //]).await; + // + //// disable SIGNAL_RATE_MSRC (bit 1) and SIGNAL_RATE_PRE_RANGE (bit 4) limit checks + //write_flag(&mut bus, id, 0x60, 1, true).await; + //write_flag(&mut bus, id, 0x60, 4, true).await; + + //let mega_counts_per_second = 0.25; + //let mega_counts_per_second: u16 = (mega_counts_per_second * (1<<7) as f64) as u16; + //let _ = bus.write_async(id, [FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT as u8, + // (mega_counts_per_second >> 8) as u8, + // (mega_counts_per_second & 255) as u8 + //]).await; + + //// get spad info + //let _ = bus.write_async(id, [SYSTEM_SEQUENCE_CONFIG as u8, 0xFF]).await; + + //write_to_device(&mut bus, id , [ + // [0x80, 0x01], + // [0xff, 0x01], + // [0x00, 0x00], + // [0xff, 0x06], + //]).await; + //write_flag(&mut bus, id, 0x83, 3, true).await; + //write_to_device(&mut bus, id , [ + // [0xff, 0x07], + // [0x81, 0x01], + // [0x80, 0x01], + // [0x94, 0x6b], + // [0x83, 0x00], + //]).await; + //debug!("starting spad wait"); + //loop { + // let mut wait: [u8;1] = [0]; + // let _ = bus.write_read_async(id, [0x83], &mut wait).await; + // if wait[0] != 0 { + // break; + // } + // Timer::after_micros(5).await; + //} + //debug!("ended spad wait"); + + //let _ = bus.write_async(id, [0x83, 0x01]).await; + + //let mut value: [u8;1] = [0]; + //let _ = bus.write_read_async(id, [0x92], &mut value).await; + //write_to_device(&mut bus, id, [ + // [0x81, 0x00], + // [0xff, 0x06], + //]).await; + //write_flag(&mut bus, id, 0x83, 3, false).await; + //write_to_device(&mut bus, id, [ + // [0xff, 0x01], + // [0x00, 0x01], + // [0xff, 0x00], + // [0x80, 0x00], + //]).await; + //let count = value[0] & 0x7f; + //let is_aperture = value[0] & 0b10000000; + //let is_aperture = is_aperture != 0; + //// TODO: vl53l0x.py post line 200 + + //let mut spad_map: [u8;6]=[0;6]; + //let _ = bus.write_read_async(id, [GLOBAL_CONFIG_SPAD_ENABLES_REF_0 as u8], &mut spad_map); + + //write_to_device(&mut bus, id, [ + // [0xff, 0x01], + // [DYNAMIC_SPAD_REF_EN_START_OFFSET as u8, 0x00], + // [DYNAMIC_SPAD_NUM_REQUESTED_REF_SPAD as u8, 0x2c], + // [0xff, 0x00], + // [DYNAMIC_SPAD_REF_EN_START_OFFSET as u8, 0xb4], + //]).await; + + //let mut spads_enabled = 0; + //for i in 0..48 { + // if i < 12 && is_aperture || spads_enabled >= count { + // spad_map[i/8] &= !(1<< (i>>2)); + // } else if (spad_map[i/8] & (1<< (i>>2))) != 0 { + // spads_enabled += 1; + // } + //} + + //let mut spad_write: [u8;7] = [0;7]; + //spad_write[0] = GLOBAL_CONFIG_SPAD_ENABLES_REF_0 as u8; + //spad_write[1..].clone_from_slice(&spad_map); + //let _ = bus.write_async(id, spad_write).await; + + // + //write_to_device(&mut bus, id, [ + // [0xFF, 0x01], + // [0x00, 0x00], + // [0xFF, 0x00], + // [0x09, 0x00], + // [0x10, 0x00], + // [0x11, 0x00], + // [0x24, 0x01], + // [0x25, 0xFF], + // [0x75, 0x00], + // [0xFF, 0x01], + // [0x4E, 0x2C], + // [0x48, 0x00], + // [0x30, 0x20], + // [0xFF, 0x00], + // [0x30, 0x09], + // [0x54, 0x00], + // [0x31, 0x04], + // [0x32, 0x03], + // [0x40, 0x83], + // [0x46, 0x25], + // [0x60, 0x00], + // [0x27, 0x00], + // [0x50, 0x06], + // [0x51, 0x00], + // [0x52, 0x96], + // [0x56, 0x08], + // [0x57, 0x30], + // [0x61, 0x00], + // [0x62, 0x00], + // [0x64, 0x00], + // [0x65, 0x00], + // [0x66, 0xA0], + // [0xFF, 0x01], + // [0x22, 0x32], + // [0x47, 0x14], + // [0x49, 0xFF], + // [0x4A, 0x00], + // [0xFF, 0x00], + // [0x7A, 0x0A], + // [0x7B, 0x00], + // [0x78, 0x21], + // [0xFF, 0x01], + // [0x23, 0x34], + // [0x42, 0x00], + // [0x44, 0xFF], + // [0x45, 0x26], + // [0x46, 0x05], + // [0x40, 0x40], + // [0x0E, 0x06], + // [0x20, 0x1A], + // [0x43, 0x40], + // [0xFF, 0x00], + // [0x34, 0x03], + // [0x35, 0x44], + // [0xFF, 0x01], + // [0x31, 0x04], + // [0x4B, 0x09], + // [0x4C, 0x05], + // [0x4D, 0x04], + // [0xFF, 0x00], + // [0x44, 0x00], + // [0x45, 0x20], + // [0x47, 0x08], + // [0x48, 0x28], + // [0x67, 0x00], + // [0x70, 0x04], + // [0x71, 0x01], + // [0x72, 0xFE], + // [0x76, 0x00], + // [0x77, 0x00], + // [0xFF, 0x01], + // [0x0D, 0x01], + // [0xFF, 0x00], + // [0x80, 0x01], + // [0x01, 0xF8], + // [0xFF, 0x01], + // [0x8E, 0x01], + // [0x00, 0x01], + // [0xFF, 0x00], + // [0x80, 0x00], + + // [SYSTEM_INTERRUPT_CONFIG_GPIO as u8, 0x04], + //]).await; + ////write_flag(&mut bus, id, GPIO_HV_MUX_ACTIVE_HIGH as u8, 4, false).await; + ////let _ = bus.write_async(id, [SYSTEM_SEQUENCE_CONFIG as u8, 0x01]).await; + ////calibrate(&mut bus, id, 0x40).await; + ////let _ = bus.write_async(id, [SYSTEM_SEQUENCE_CONFIG as u8, 0x02]).await; + ////calibrate(&mut bus, id, 0x00).await; + ////let _ = bus.write_async(id, [SYSTEM_SEQUENCE_CONFIG as u8, 0xe8]).await; + + //async fn calibrate<'a, T>(bus: &mut embassy_rp::i2c::I2c<'a, T,Async>, addr: u16, data: u8) + //where T: embassy_rp::i2c::Instance { + // let _ = bus.write_async(addr, [SYSRANGE_START as u8 ,data | 0x01]).await; + // debug!("started calib wait"); // loop { // let mut wait: [u8;1] = [0]; - // let _ = bus.write_read_async(id, [RESULT_INTERRUPT_STATUS as u8], &mut wait).await; + // let _ = bus.write_read_async(addr, [0x13], &mut wait).await; // if wait[0] & 0x07 != 0 { // break; // } // Timer::after_micros(5).await; // } - // debug!("ending wait part 2"); - // let mut output: [u8; 2] = [0;2]; - // let _ = bus.write_read_async(id, [0x14], &mut output).await; - // let _ = bus.write_async(id, [0x0B, 0x01]).await; - // info!("{:?}",output); - // Timer::after_millis(20).await; + // debug!("ended calib wait"); + // write_to_device(bus, addr, [ + // [SYSTEM_INTERRUPT_CLEAR as u8, 0x01], + // [SYSRANGE_START as u8, 0x00], + // ]).await; //} + + ////TODO VL53L0X.cpp L 236-280 + + + //// start continuous mode + //write_to_device(&mut bus, id, [ + // [0x80, 0x01], + // [0xFF, 0x01], + // [0x00, 0x00], + // [0x91, stop[0]], + // [0x00, 0x01], + // [0xFF, 0x00], + // [0x80, 0x00], + // //[0x04, 0x00], // measurement delay + // [0x00, 0x02], // back to back shots + //]).await; + + ////let _ = bus.write_async(0x88u16, [0x00]).await; + ////let _ = bus.write_async(0x80u16, [0x01]).await; + ////let _ = bus.write_async(0xFFu16, [0x01]).await; + ////let _ = bus.write_async(0x00u16, [0x00]).await; + ////let _ = bus.write_async(0x00u16, [0x01]).await; + ////let _ = bus.write_async(0xFFu16, [0x00]).await; + ////let _ = bus.write_async(0x80u16, [0x00]).await; + // + ////loop { + //// debug!("starting wait part 1"); + //// loop { + //// let mut wait: [u8;1] = [0]; + //// let _ = bus.write_read_async(id, [SYSRANGE_START as u8], &mut wait).await; + //// debug!("{wait:?}"); + //// if wait[0] & 0x01 != 0 { + //// break; + //// } + //// Timer::after_micros(5).await; + //// } + //// debug!("starting wait part 2"); + //// loop { + //// let mut wait: [u8;1] = [0]; + //// let _ = bus.write_read_async(id, [RESULT_INTERRUPT_STATUS as u8], &mut wait).await; + //// if wait[0] & 0x07 != 0 { + //// break; + //// } + //// Timer::after_micros(5).await; + //// } + //// debug!("ending wait part 2"); + //// let mut output: [u8; 2] = [0;2]; + //// let _ = bus.write_read_async(id, [0x14], &mut output).await; + //// let _ = bus.write_async(id, [0x0B, 0x01]).await; + //// info!("out: {:?}",output); + //// Timer::after_millis(20).await; + ////} + loop { let mut socket = TcpSocket::new(stack, &mut rx_buffer, &mut tx_buffer); - socket.set_timeout(Some(Duration::from_secs(10))); + socket.set_timeout(Some(Duration::from_secs(3))); + + let mut c: pwm::Config = Default::default(); + c.divider = 255.into(); + c.top = 8715; + c.compare_b = 0; + c.compare_a = 0; + pwm.set_config(&c); + + flipper.set_low(); control.gpio_set(0, false).await; info!("Listening on TCP:1234..."); @@ -469,8 +492,24 @@ async fn main(spawner: Spawner) { info!("recd {:#02x}", response[0]); let _ = hex::encode_to_slice(response, &mut buf); n = 4; + }, + 'D' => { + let left: [u8;2] = hex::FromHex::from_hex(segs.next().unwrap()).unwrap(); + let right: [u8;2] = hex::FromHex::from_hex(segs.next().unwrap()).unwrap(); + info!("left {:?}, right {left:?}", right); - + let left = u16::from_be_bytes(left); + c.compare_a = left; + let right = u16::from_be_bytes(right); + c.compare_b = right; + info!("left {:?}, right {left:?}", right); + pwm.set_config(&c); + }, + 'F' => { + flipper.set_high(); + }, + 'L' => { + flipper.set_low(); }, _ => {} diff --git a/controller/src/vl53l0.rs b/controller/src/vl53l0.rs new file mode 100644 index 0000000..2df35a8 --- /dev/null +++ b/controller/src/vl53l0.rs @@ -0,0 +1,91 @@ +use core::ops::Deref; + +#[repr(u8)] +pub enum RegAddr + { + SYSRANGE_START = 0x00, + + SYSTEM_THRESH_HIGH = 0x0C, + SYSTEM_THRESH_LOW = 0x0E, + + SYSTEM_SEQUENCE_CONFIG = 0x01, + SYSTEM_RANGE_CONFIG = 0x09, + SYSTEM_INTERMEASUREMENT_PERIOD = 0x04, + + SYSTEM_INTERRUPT_CONFIG_GPIO = 0x0A, + + GPIO_HV_MUX_ACTIVE_HIGH = 0x84, + + SYSTEM_INTERRUPT_CLEAR = 0x0B, + + RESULT_INTERRUPT_STATUS = 0x13, + RESULT_RANGE_STATUS = 0x14, + + RESULT_CORE_AMBIENT_WINDOW_EVENTS_RTN = 0xBC, + //RESULT_CORE_RANGING_TOTAL_EVENTS_RTN = 0xC0, + RESULT_CORE_AMBIENT_WINDOW_EVENTS_REF = 0xD0, + RESULT_CORE_RANGING_TOTAL_EVENTS_REF = 0xD4, + RESULT_PEAK_SIGNAL_RATE_REF = 0xB6, + + ALGO_PART_TO_PART_RANGE_OFFSET_MM = 0x28, + + I2C_SLAVE_DEVICE_ADDRESS = 0x8A, + + MSRC_CONFIG_CONTROL = 0x60, + + PRE_RANGE_CONFIG_MIN_SNR = 0x27, + PRE_RANGE_CONFIG_VALID_PHASE_LOW = 0x56, + PRE_RANGE_CONFIG_VALID_PHASE_HIGH = 0x57, + PRE_RANGE_MIN_COUNT_RATE_RTN_LIMIT = 0x64, + + FINAL_RANGE_CONFIG_MIN_SNR = 0x67, + FINAL_RANGE_CONFIG_VALID_PHASE_LOW = 0x47, + FINAL_RANGE_CONFIG_VALID_PHASE_HIGH = 0x48, + FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT = 0x44, + + PRE_RANGE_CONFIG_SIGMA_THRESH_HI = 0x61, + PRE_RANGE_CONFIG_SIGMA_THRESH_LO = 0x62, + + PRE_RANGE_CONFIG_VCSEL_PERIOD = 0x50, + PRE_RANGE_CONFIG_TIMEOUT_MACROP_HI = 0x51, + PRE_RANGE_CONFIG_TIMEOUT_MACROP_LO = 0x52, + + SYSTEM_HISTOGRAM_BIN = 0x81, + HISTOGRAM_CONFIG_INITIAL_PHASE_SELECT = 0x33, + HISTOGRAM_CONFIG_READOUT_CTRL = 0x55, + + FINAL_RANGE_CONFIG_VCSEL_PERIOD = 0x70, + FINAL_RANGE_CONFIG_TIMEOUT_MACROP_HI = 0x71, + FINAL_RANGE_CONFIG_TIMEOUT_MACROP_LO = 0x72, + CROSSTALK_COMPENSATION_PEAK_RATE_MCPS = 0x20, + + MSRC_CONFIG_TIMEOUT_MACROP = 0x46, + + SOFT_RESET_GO2_SOFT_RESET_N = 0xBF, + IDENTIFICATION_MODEL_ID = 0xC0, + IDENTIFICATION_REVISION_ID = 0xC2, + + OSC_CALIBRATE_VAL = 0xF8, + + GLOBAL_CONFIG_VCSEL_WIDTH = 0x32, + GLOBAL_CONFIG_SPAD_ENABLES_REF_0 = 0xB0, + GLOBAL_CONFIG_SPAD_ENABLES_REF_1 = 0xB1, + GLOBAL_CONFIG_SPAD_ENABLES_REF_2 = 0xB2, + GLOBAL_CONFIG_SPAD_ENABLES_REF_3 = 0xB3, + GLOBAL_CONFIG_SPAD_ENABLES_REF_4 = 0xB4, + GLOBAL_CONFIG_SPAD_ENABLES_REF_5 = 0xB5, + + //GLOBAL_CONFIG_REF_EN_START_SELECT = 0xB6, + DYNAMIC_SPAD_NUM_REQUESTED_REF_SPAD = 0x4E, + DYNAMIC_SPAD_REF_EN_START_OFFSET = 0x4F, + POWER_MANAGEMENT_GO1_POWER_FORCE = 0x80, + + VHV_CONFIG_PAD_SCL_SDA__EXTSUP_HV = 0x89, + + ALGO_PHASECAL_LIM = 0x30, + //ALGO_PHASECAL_CONFIG_TIMEOUT = 0x30, +} + +struct Vl53l0x { + +} diff --git a/python-controller/MPU6050.py b/python-controller/MPU6050.py deleted file mode 100644 index a0eaa16..0000000 --- a/python-controller/MPU6050.py +++ /dev/null @@ -1,158 +0,0 @@ -""" -A lightweight MicroPython implementation for interfacing with an MPU-6050 via I2C. -Author: Tim Hanewich - https://github.com/TimHanewich -Version: 1.0 -Get updates to this code file here: https://github.com/TimHanewich/MicroPython-Collection/blob/master/MPU6050/MPU6050.py - -License: MIT License -Copyright 2023 Tim Hanewich -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -""" - -import machine - -class MPU6050: - """Class for reading gyro rates and acceleration data from an MPU-6050 module via I2C.""" - - def __init__(self, i2c:machine.I2C, address:int = 0x68): - """ - Creates a new MPU6050 class for reading gyro rates and acceleration data. - :param i2c: A setup I2C module of the machine module. - :param address: The I2C address of the MPU-6050 you are using (0x68 is the default). - """ - self.address = address - self.i2c = i2c - - def wake(self) -> None: - """Wake up the MPU-6050.""" - self.i2c.writeto_mem(self.address, 0x6B, bytes([0x01])) - - def sleep(self) -> None: - """Places MPU-6050 in sleep mode (low power consumption). Stops the internal reading of new data. Any calls to get gyro or accel data while in sleep mode will remain unchanged - the data is not being updated internally within the MPU-6050!""" - self.i2c.writeto_mem(self.address, 0x6B, bytes([0x40])) - - def who_am_i(self) -> int: - """Returns the address of the MPU-6050 (ensure it is working).""" - return self.i2c.readfrom_mem(self.address, 0x75, 1)[0] - - def read_temperature(self) -> float: - """Reads the temperature, in celsius, of the onboard temperature sensor of the MPU-6050.""" - data = self.i2c.readfrom_mem(self.address, 0x41, 2) - raw_temp:float = self._translate_pair(data[0], data[1]) - temp:float = (raw_temp / 340.0) + 36.53 - return temp - - def read_gyro_range(self) -> int: - """Reads the gyroscope range setting.""" - return self._hex_to_index(self.i2c.readfrom_mem(self.address, 0x1B, 1)[0]) - - def write_gyro_range(self, range:int) -> None: - """Sets the gyroscope range setting.""" - self.i2c.writeto_mem(self.address, 0x1B, bytes([self._index_to_hex(range)])) - - def read_gyro_data(self) -> tuple[float, float, float]: - """Read the gyroscope data, in a (x, y, z) tuple.""" - - # set the modified based on the gyro range (need to divide to calculate) - gr:int = self.read_gyro_range() - modifier:float = None - if gr == 0: - modifier = 131.0 - elif gr == 1: - modifier = 65.5 - elif gr == 2: - modifier = 32.8 - elif gr == 3: - modifier = 16.4 - - # read data - data = self.i2c.readfrom_mem(self.address, 0x43, 6) # read 6 bytes (gyro data) - x:float = (self._translate_pair(data[0], data[1])) / modifier - y:float = (self._translate_pair(data[2], data[3])) / modifier - z:float = (self._translate_pair(data[4], data[5])) / modifier - - return (x, y, z) - - def read_accel_range(self) -> int: - """Reads the accelerometer range setting.""" - return self._hex_to_index(self.i2c.readfrom_mem(self.address, 0x1C, 1)[0]) - - def write_accel_range(self, range:int) -> None: - """Sets the gyro accelerometer setting.""" - self.i2c.writeto_mem(self.address, 0x1C, bytes([self._index_to_hex(range)])) - - def read_accel_data(self) -> tuple[float, float, float]: - """Read the accelerometer data, in a (x, y, z) tuple.""" - - # set the modified based on the gyro range (need to divide to calculate) - ar:int = self.read_accel_range() - modifier:float = None - if ar == 0: - modifier = 16384.0 - elif ar == 1: - modifier = 8192.0 - elif ar == 2: - modifier = 4096.0 - elif ar == 3: - modifier = 2048.0 - - # read data - data = self.i2c.readfrom_mem(self.address, 0x3B, 6) # read 6 bytes (accel data) - x:float = (self._translate_pair(data[0], data[1])) / modifier - y:float = (self._translate_pair(data[2], data[3])) / modifier - z:float = (self._translate_pair(data[4], data[5])) / modifier - - return (x, y, z) - - def read_lpf_range(self) -> int: - return self.i2c.readfrom_mem(self.address, 0x1A, 1)[0] - - def write_lpf_range(self, range:int) -> None: - """ - Sets low pass filter range. - :param range: Low pass range setting, 0-6. 0 = minimum filter, 6 = maximum filter. - """ - - # check range - if range < 0 or range > 6: - raise Exception("Range '" + str(range) + "' is not a valid low pass filter setting.") - - self.i2c.writeto_mem(self.address, 0x1A, bytes([range])) - - - #### UTILITY FUNCTIONS BELOW #### - - def _translate_pair(self, high:int, low:int) -> int: - """Converts a byte pair to a usable value. Borrowed from https://github.com/m-rtijn/mpu6050/blob/0626053a5e1182f4951b78b8326691a9223a5f7d/mpu6050/mpu6050.py#L76C39-L76C39.""" - value = (high << 8) + low - if value >= 0x8000: - value = -((65535 - value) + 1) - return value - - def _hex_to_index(self, range:int) -> int: - """Converts a hexadecimal range setting to an integer (index), 0-3. This is used for both the gyroscope and accelerometer ranges.""" - if range== 0x00: - return 0 - elif range == 0x08: - return 1 - elif range == 0x10: - return 2 - elif range == 0x18: - return 3 - else: - raise Exception("Found unknown gyro range setting '" + str(range) + "'") - - def _index_to_hex(self, index:int) -> int: - """Converts an index integer (0-3) to a hexadecimal range setting. This is used for both the gyroscope and accelerometer ranges.""" - if index == 0: - return 0x00 - elif index == 1: - return 0x08 - elif index == 2: - return 0x10 - elif index == 3: - return 0x18 - else: - raise Exception("Range index '" + index + "' invalid. Must be 0-3.") diff --git a/python-controller/VL53L0X.py b/python-controller/VL53L0X.py deleted file mode 100644 index b91eb23..0000000 --- a/python-controller/VL53L0X.py +++ /dev/null @@ -1,648 +0,0 @@ -from micropython import const -import ustruct -import utime -from machine import Timer -import time - -_IO_TIMEOUT = 1000 -_SYSRANGE_START = const(0x00) -_EXTSUP_HV = const(0x89) -_MSRC_CONFIG = const(0x60) -_FINAL_RATE_RTN_LIMIT = const(0x44) -_SYSTEM_SEQUENCE = const(0x01) -_SPAD_REF_START = const(0x4f) -_SPAD_ENABLES = const(0xb0) -_REF_EN_START_SELECT = const(0xb6) -_SPAD_NUM_REQUESTED = const(0x4e) -_INTERRUPT_GPIO = const(0x0a) -_INTERRUPT_CLEAR = const(0x0b) -_GPIO_MUX_ACTIVE_HIGH = const(0x84) -_RESULT_INTERRUPT_STATUS = const(0x13) -_RESULT_RANGE_STATUS = const(0x14) -_OSC_CALIBRATE = const(0xf8) -_MEASURE_PERIOD = const(0x04) - -SYSRANGE_START = 0x00 - -SYSTEM_THRESH_HIGH = 0x0C -SYSTEM_THRESH_LOW = 0x0E - -SYSTEM_SEQUENCE_CONFIG = 0x01 -SYSTEM_RANGE_CONFIG = 0x09 -SYSTEM_INTERMEASUREMENT_PERIOD = 0x04 - -SYSTEM_INTERRUPT_CONFIG_GPIO = 0x0A - -GPIO_HV_MUX_ACTIVE_HIGH = 0x84 - -SYSTEM_INTERRUPT_CLEAR = 0x0B - -RESULT_INTERRUPT_STATUS = 0x13 -RESULT_RANGE_STATUS = 0x14 - -RESULT_CORE_AMBIENT_WINDOW_EVENTS_RTN = 0xBC -RESULT_CORE_RANGING_TOTAL_EVENTS_RTN = 0xC0 -RESULT_CORE_AMBIENT_WINDOW_EVENTS_REF = 0xD0 -RESULT_CORE_RANGING_TOTAL_EVENTS_REF = 0xD4 -RESULT_PEAK_SIGNAL_RATE_REF = 0xB6 - -ALGO_PART_TO_PART_RANGE_OFFSET_MM = 0x28 - -I2C_SLAVE_DEVICE_ADDRESS = 0x8A - -MSRC_CONFIG_CONTROL = 0x60 - -PRE_RANGE_CONFIG_MIN_SNR = 0x27 -PRE_RANGE_CONFIG_VALID_PHASE_LOW = 0x56 -PRE_RANGE_CONFIG_VALID_PHASE_HIGH = 0x57 -PRE_RANGE_MIN_COUNT_RATE_RTN_LIMIT = 0x64 - -FINAL_RANGE_CONFIG_MIN_SNR = 0x67 -FINAL_RANGE_CONFIG_VALID_PHASE_LOW = 0x47 -FINAL_RANGE_CONFIG_VALID_PHASE_HIGH = 0x48 -FINAL_RANGE_CONFIG_MIN_COUNT_RATE_RTN_LIMIT = 0x44 - -PRE_RANGE_CONFIG_SIGMA_THRESH_HI = 0x61 -PRE_RANGE_CONFIG_SIGMA_THRESH_LO = 0x62 - -PRE_RANGE_CONFIG_VCSEL_PERIOD = 0x50 -PRE_RANGE_CONFIG_TIMEOUT_MACROP_HI = 0x51 -PRE_RANGE_CONFIG_TIMEOUT_MACROP_LO = 0x52 - -SYSTEM_HISTOGRAM_BIN = 0x81 -HISTOGRAM_CONFIG_INITIAL_PHASE_SELECT = 0x33 -HISTOGRAM_CONFIG_READOUT_CTRL = 0x55 - -FINAL_RANGE_CONFIG_VCSEL_PERIOD = 0x70 -FINAL_RANGE_CONFIG_TIMEOUT_MACROP_HI = 0x71 -FINAL_RANGE_CONFIG_TIMEOUT_MACROP_LO = 0x72 -CROSSTALK_COMPENSATION_PEAK_RATE_MCPS = 0x20 - -MSRC_CONFIG_TIMEOUT_MACROP = 0x46 - -SOFT_RESET_GO2_SOFT_RESET_N = 0xBF -IDENTIFICATION_MODEL_ID = 0xC0 -IDENTIFICATION_REVISION_ID = 0xC2 - -OSC_CALIBRATE_VAL = 0xF8 - -GLOBAL_CONFIG_VCSEL_WIDTH = 0x32 -GLOBAL_CONFIG_SPAD_ENABLES_REF_0 = 0xB0 -GLOBAL_CONFIG_SPAD_ENABLES_REF_1 = 0xB1 -GLOBAL_CONFIG_SPAD_ENABLES_REF_2 = 0xB2 -GLOBAL_CONFIG_SPAD_ENABLES_REF_3 = 0xB3 -GLOBAL_CONFIG_SPAD_ENABLES_REF_4 = 0xB4 -GLOBAL_CONFIG_SPAD_ENABLES_REF_5 = 0xB5 - -GLOBAL_CONFIG_REF_EN_START_SELECT = 0xB6 -DYNAMIC_SPAD_NUM_REQUESTED_REF_SPAD = 0x4E -DYNAMIC_SPAD_REF_EN_START_OFFSET = 0x4F -POWER_MANAGEMENT_GO1_POWER_FORCE = 0x80 - -VHV_CONFIG_PAD_SCL_SDA__EXTSUP_HV = 0x89 - -ALGO_PHASECAL_LIM = 0x30 -ALGO_PHASECAL_CONFIG_TIMEOUT = 0x30 - - -class TimeoutError(RuntimeError): - pass - - -class VL53L0X: - def __init__(self, i2c, address=0x29): - self.i2c = i2c - self.address = address - self.init() - self._started = False - self.measurement_timing_budget_us = 0 - self.set_measurement_timing_budget(self.measurement_timing_budget_us) - self.enables = {"tcc": 0, - "dss": 0, - "msrc": 0, - "pre_range": 0, - "final_range": 0} - self.timeouts = {"pre_range_vcsel_period_pclks": 0, - "msrc_dss_tcc_mclks": 0, - "msrc_dss_tcc_us": 0, - "pre_range_mclks": 0, - "pre_range_us": 0, - "final_range_vcsel_period_pclks": 0, - "final_range_mclks": 0, - "final_range_us": 0 - } - self.vcsel_period_type = ["VcselPeriodPreRange", "VcselPeriodFinalRange"] - - def _registers(self, register, values=None, struct='B'): - if values is None: - size = ustruct.calcsize(struct) - data = self.i2c.readfrom_mem(self.address, register, size) - values = ustruct.unpack(struct, data) - return values - data = ustruct.pack(struct, *values) - self.i2c.writeto_mem(self.address, register, data) - - def _register(self, register, value=None, struct='B'): - if value is None: - return self._registers(register, struct=struct)[0] - self._registers(register, (value,), struct=struct) - - def _flag(self, register=0x00, bit=0, value=None): - data = self._register(register) - mask = 1 << bit - if value is None: - return bool(data & mask) - elif value: - data |= mask - else: - data &= ~mask - self._register(register, data) - - def _config(self, *config): - for register, value in config: - self._register(register, value) - - def init(self, power2v8=True): - self._flag(_EXTSUP_HV, 0, power2v8) - - # I2C standard mode - self._config( - (0x88, 0x00), - - (0x80, 0x01), - (0xff, 0x01), - (0x00, 0x00), - ) - self._stop_variable = self._register(0x91) - self._config( - (0x00, 0x01), - (0xff, 0x00), - (0x80, 0x00), - ) - - # disable signal_rate_msrc and signal_rate_pre_range limit checks - self._flag(_MSRC_CONFIG, 1, True) - self._flag(_MSRC_CONFIG, 4, True) - - # rate_limit = 0.25 - self._register(_FINAL_RATE_RTN_LIMIT, int(0.1 * (1 << 7)), - struct='>H') - - self._register(_SYSTEM_SEQUENCE, 0xff) - - spad_count, is_aperture = self._spad_info() - spad_map = bytearray(self._registers(_SPAD_ENABLES, struct='6B')) - - # set reference spads - self._config( - (0xff, 0x01), - (_SPAD_REF_START, 0x00), - (_SPAD_NUM_REQUESTED, 0x2c), - (0xff, 0x00), - (_REF_EN_START_SELECT, 0xb4), - ) - - spads_enabled = 0 - for i in range(48): - if i < 12 and is_aperture or spads_enabled >= spad_count: - spad_map[i // 8] &= ~(1 << (i >> 2)) - elif spad_map[i // 8] & (1 << (i >> 2)): - spads_enabled += 1 - - self._registers(_SPAD_ENABLES, spad_map, struct='6B') - - self._config( - (0xff, 0x01), - (0x00, 0x00), - - (0xff, 0x00), - (0x09, 0x00), - (0x10, 0x00), - (0x11, 0x00), - - (0x24, 0x01), - (0x25, 0xFF), - (0x75, 0x00), - - (0xFF, 0x01), - (0x4E, 0x2C), - (0x48, 0x00), - (0x30, 0x20), - - (0xFF, 0x00), - (0x30, 0x09), - (0x54, 0x00), - (0x31, 0x04), - (0x32, 0x03), - (0x40, 0x83), - (0x46, 0x25), - (0x60, 0x00), - (0x27, 0x00), - (0x50, 0x06), - (0x51, 0x00), - (0x52, 0x96), - (0x56, 0x08), - (0x57, 0x30), - (0x61, 0x00), - (0x62, 0x00), - (0x64, 0x00), - (0x65, 0x00), - (0x66, 0xA0), - - (0xFF, 0x01), - (0x22, 0x32), - (0x47, 0x14), - (0x49, 0xFF), - (0x4A, 0x00), - - (0xFF, 0x00), - (0x7A, 0x0A), - (0x7B, 0x00), - (0x78, 0x21), - - (0xFF, 0x01), - (0x23, 0x34), - (0x42, 0x00), - (0x44, 0xFF), - (0x45, 0x26), - (0x46, 0x05), - (0x40, 0x40), - (0x0E, 0x06), - (0x20, 0x1A), - (0x43, 0x40), - - (0xFF, 0x00), - (0x34, 0x03), - (0x35, 0x44), - - (0xFF, 0x01), - (0x31, 0x04), - (0x4B, 0x09), - (0x4C, 0x05), - (0x4D, 0x04), - - (0xFF, 0x00), - (0x44, 0x00), - (0x45, 0x20), - (0x47, 0x08), - (0x48, 0x28), - (0x67, 0x00), - (0x70, 0x04), - (0x71, 0x01), - (0x72, 0xFE), - (0x76, 0x00), - (0x77, 0x00), - - (0xFF, 0x01), - (0x0D, 0x01), - - (0xFF, 0x00), - (0x80, 0x01), - (0x01, 0xF8), - - (0xFF, 0x01), - (0x8E, 0x01), - (0x00, 0x01), - (0xFF, 0x00), - (0x80, 0x00), - ) - - self._register(_INTERRUPT_GPIO, 0x04) - self._flag(_GPIO_MUX_ACTIVE_HIGH, 4, False) - self._register(_INTERRUPT_CLEAR, 0x01) - - # XXX Need to implement this. - # budget = self._timing_budget() - # self._register(_SYSTEM_SEQUENCE, 0xe8) - # self._timing_budget(budget) - - self._register(_SYSTEM_SEQUENCE, 0x01) - self._calibrate(0x40) - self._register(_SYSTEM_SEQUENCE, 0x02) - self._calibrate(0x00) - - self._register(_SYSTEM_SEQUENCE, 0xe8) - - def _spad_info(self): - self._config( - (0x80, 0x01), - (0xff, 0x01), - (0x00, 0x00), - - (0xff, 0x06), - ) - self._flag(0x83, 3, True) - self._config( - (0xff, 0x07), - (0x81, 0x01), - - (0x80, 0x01), - - (0x94, 0x6b), - (0x83, 0x00), - ) - for timeout in range(_IO_TIMEOUT): - if self._register(0x83): - break - utime.sleep_ms(1) - else: - raise TimeoutError() - self._config( - (0x83, 0x01), - ) - value = self._register(0x92) - self._config( - (0x81, 0x00), - (0xff, 0x06), - ) - self._flag(0x83, 3, False) - self._config( - (0xff, 0x01), - (0x00, 0x01), - - (0xff, 0x00), - (0x80, 0x00), - ) - count = value & 0x7f - is_aperture = bool(value & 0b10000000) - return count, is_aperture - - def _calibrate(self, vhv_init_byte): - self._register(_SYSRANGE_START, 0x01 | vhv_init_byte) - for timeout in range(_IO_TIMEOUT): - if self._register(_RESULT_INTERRUPT_STATUS) & 0x07: - break - utime.sleep_ms(1) - else: - raise TimeoutError() - self._register(_INTERRUPT_CLEAR, 0x01) - self._register(_SYSRANGE_START, 0x00) - - def start(self, period=0): - self._config( - (0x80, 0x01), - (0xFF, 0x01), - (0x00, 0x00), - (0x91, self._stop_variable), - (0x00, 0x01), - (0xFF, 0x00), - (0x80, 0x00), - ) - if period: - oscilator = self._register(_OSC_CALIBRATE, struct='>H') - if oscilator: - period *= oscilator - self._register(_MEASURE_PERIOD, period, struct='>H') - self._register(_SYSRANGE_START, 0x04) - else: - self._register(_SYSRANGE_START, 0x02) - self._started = True - - def stop(self): - self._register(_SYSRANGE_START, 0x01) - self._config( - (0xFF, 0x01), - (0x00, 0x00), - (0x91, self._stop_variable), - (0x00, 0x01), - (0xFF, 0x00), - ) - self._started = False - - def read(self): - if not self._started: - self._config( - (0x80, 0x01), - (0xFF, 0x01), - (0x00, 0x00), - (0x91, self._stop_variable), - (0x00, 0x01), - (0xFF, 0x00), - (0x80, 0x00), - (_SYSRANGE_START, 0x01), - ) - for timeout in range(_IO_TIMEOUT): - if not self._register(_SYSRANGE_START) & 0x01: - break - utime.sleep_ms(1) - else: - raise TimeoutError() - for timeout in range(_IO_TIMEOUT): - if self._register(_RESULT_INTERRUPT_STATUS) & 0x07: - break - utime.sleep_ms(1) - else: - raise TimeoutError() - value = self._register(_RESULT_RANGE_STATUS + 10, struct='>H') - self._register(_INTERRUPT_CLEAR, 0x01) - return value - - def set_signal_rate_limit(self, limit_Mcps): - if limit_Mcps < 0 or limit_Mcps > 511.99: - return False - self._register(0x44, limit_Mcps * (1 << 7)) - return True - - def decode_Vcsel_period(self, reg_val): - return (((reg_val) + 1) << 1) - - def encode_Vcsel_period(self, period_pclks): - return (((period_pclks) >> 1) - 1) - - def set_Vcsel_pulse_period(self, type, period_pclks): - vcsel_period_reg = self.encode_Vcsel_period(period_pclks) - - self.get_sequence_step_enables() - self.get_sequence_step_timeouts() - - if type == self.vcsel_period_type[0]: - if period_pclks == 12: - self._register(PRE_RANGE_CONFIG_VALID_PHASE_HIGH, 0x18) - elif period_pclks == 14: - self._register(PRE_RANGE_CONFIG_VALID_PHASE_HIGH, 0x30) - elif period_pclks == 16: - self._register(PRE_RANGE_CONFIG_VALID_PHASE_HIGH, 0x40) - elif period_pclks == 18: - self._register(PRE_RANGE_CONFIG_VALID_PHASE_HIGH, 0x50) - else: - return False - - self._register(PRE_RANGE_CONFIG_VALID_PHASE_LOW, 0x08) - self._register(PRE_RANGE_CONFIG_VCSEL_PERIOD, vcsel_period_reg) - - new_pre_range_timeout_mclks = self.timeout_microseconds_to_Mclks(self.timeouts["pre_range_us"], - period_pclks) - self._register(PRE_RANGE_CONFIG_TIMEOUT_MACROP_HI, self.encode_timeout(new_pre_range_timeout_mclks)) - - new_msrc_timeout_mclks = self.timeout_microseconds_to_Mclks(self.timeouts["msrc_dss_tcc_us"], - period_pclks) - self._register(MSRC_CONFIG_TIMEOUT_MACROP, 255 if new_msrc_timeout_mclks > 256 else (new_msrc_timeout_mclks - 1)) - elif type == self.vcsel_period_type[1]: - if period_pclks == 8: - self._register(FINAL_RANGE_CONFIG_VALID_PHASE_HIGH, 0x10) - self._register(FINAL_RANGE_CONFIG_VALID_PHASE_LOW, 0x08) - self._register(GLOBAL_CONFIG_VCSEL_WIDTH, 0x02) - self._(ALGO_PHASECAL_CONFIG_TIMEOUT, 0x0C) - self._register(0xFF, 0x01) - self._register(ALGO_PHASECAL_LIM, 0x30) - self._register(0xFF, 0x00) - elif period_pclks == 10: - self._register(FINAL_RANGE_CONFIG_VALID_PHASE_HIGH, 0x28) - self._register(FINAL_RANGE_CONFIG_VALID_PHASE_LOW, 0x08) - self._register(GLOBAL_CONFIG_VCSEL_WIDTH, 0x03) - self._register(ALGO_PHASECAL_CONFIG_TIMEOUT, 0x09) - self._register(0xFF, 0x01) - self._register(ALGO_PHASECAL_LIM, 0x20) - self._register(0xFF, 0x00) - elif period_pclks == 12: - self._register(FINAL_RANGE_CONFIG_VALID_PHASE_HIGH, 0x38) - self._register(FINAL_RANGE_CONFIG_VALID_PHASE_LOW, 0x08) - self._register(GLOBAL_CONFIG_VCSEL_WIDTH, 0x03) - self._register(ALGO_PHASECAL_CONFIG_TIMEOUT, 0x08) - self._register(0xFF, 0x01) - self._register(ALGO_PHASECAL_LIM, 0x20) - self._register(0xFF, 0x00) - elif period_pclks == 14: - self._register(FINAL_RANGE_CONFIG_VALID_PHASE_HIGH, 0x48) - self._register(FINAL_RANGE_CONFIG_VALID_PHASE_LOW, 0x08) - self._register(GLOBAL_CONFIG_VCSEL_WIDTH, 0x03) - self._register(ALGO_PHASECAL_CONFIG_TIMEOUT, 0x07) - self._register(0xFF, 0x01) - self._register(ALGO_PHASECAL_LIM, 0x20) - self._register(0xFF, 0x00) - else: - return False - - self._register(FINAL_RANGE_CONFIG_VCSEL_PERIOD, vcsel_period_reg) - - new_final_range_timeout_mclks = self.timeout_microseconds_to_Mclks(self.timeouts["final_range_us"], period_pclks) - - if self.enables["pre_range"]: - new_final_range_timeout_mclks += 1 - self._register(FINAL_RANGE_CONFIG_TIMEOUT_MACROP_HI, self.encode_timeout(new_final_range_timeout_mclks)) - else: - return False - self.set_measurement_timing_budget(self.measurement_timing_budget_us) - sequence_config = self._register(SYSTEM_SEQUENCE_CONFIG) - self._register(SYSTEM_SEQUENCE_CONFIG, 0x02) - self.perform_single_ref_calibration(0x0) - self._register(SYSTEM_SEQUENCE_CONFIG, sequence_config) - - return True - - def get_sequence_step_enables(self): - sequence_config = self._register(0x01) - - self.enables["tcc"] = (sequence_config >> 4) & 0x1 - self.enables["dss"] = (sequence_config >> 3) & 0x1 - self.enables["msrc"] = (sequence_config >> 2) & 0x1 - self.enables["pre_range"] = (sequence_config >> 6) & 0x1 - self.enables["final_range"] = (sequence_config >> 7) & 0x1 - - def get_vcsel_pulse_period(self, type): - if type == self.vcsel_period_type[0]: - return self.decode_Vcsel_period(0x50) - elif type == self.vcsel_period_type[1]: - return self.decode_Vcsel_period(0x70) - else: - return 255 - - def get_sequence_step_timeouts(self): - self.timeouts["pre_range_vcsel_period_pclks"] = self.get_vcsel_pulse_period(self.vcsel_period_type[0]) - self.timeouts["msrc_dss_tcc_mclks"] = int(self._register(MSRC_CONFIG_TIMEOUT_MACROP)) + 1 - self.timeouts["msrc_dss_tcc_us"] = self.timeout_Mclks_to_microseconds(self.timeouts["msrc_dss_tcc_mclks"], - self.timeouts[ - "pre_range_vcsel_period_pclks"]) - self.timeouts["pre_range_mclks"] = self.decode_timeout(PRE_RANGE_CONFIG_TIMEOUT_MACROP_HI) - self.timeouts["pre_range_us"] = self.timeout_Mclks_to_microseconds(self.timeouts["pre_range_mclks"], - self.timeouts[ - "pre_range_vcsel_period_pclks"]) - self.timeouts["final_range_vcsel_period_pclks"] = self.get_vcsel_pulse_period(self.vcsel_period_type[1]) - self.timeouts["final_range_mclks"] = self.decode_timeout(self._register(FINAL_RANGE_CONFIG_TIMEOUT_MACROP_HI)) - - if self.enables["pre_range"]: - self.timeouts["final_range_mclks"] -= self.timeouts["pre_range_mclks"] - self.timeouts["final_range_us"] = self.timeout_Mclks_to_microseconds(self.timeouts["final_range_mclks"], - self.timeouts[ - "final_range_vcsel_period_pclks"]) - - def timeout_Mclks_to_microseconds(self, timeout_period_mclks, vcsel_period_pclks): - macro_period_ns = self.calc_macro_period(vcsel_period_pclks) - return ((timeout_period_mclks * macro_period_ns) + (macro_period_ns / 2)) / 1000 - - def timeout_microseconds_to_Mclks(self, timeout_period_us, vcsel_period_pclks): - macro_period_ns = self.calc_macro_period(vcsel_period_pclks) - return (((timeout_period_us * 1000) + (macro_period_ns / 2)) / macro_period_ns) - - def calc_macro_period(self, vcsel_period_pclks): - return (((2304 * (vcsel_period_pclks) * 1655) + 500) / 1000) - - def decode_timeout(self, reg_val): - return ((reg_val & 0x00FF) << ((reg_val & 0xFF00) >> 8)) + 1 - - def encode_timeout(self, timeout_mclks): - timeout_mclks = int(timeout_mclks) - ls_byte = 0 - ms_byte = 0 - - if timeout_mclks > 0: - ls_byte = timeout_mclks - 1 - - while (ls_byte & 0xFFFFFF00) > 0: - ls_byte >>= 1 - ms_byte += 1 - return (ms_byte << 8) or (ls_byte & 0xFF) - else: - return 0 - - def set_measurement_timing_budget(self, budget_us): - start_overhead = 1320 - end_overhead = 960 - msrc_overhead = 660 - tcc_overhead = 590 - dss_overhead = 690 - pre_range_overhead = 660 - final_range_overhead = 550 - - min_timing_budget = 20000 - - if budget_us < min_timing_budget: - return False - used_budget_us = start_overhead + end_overhead - - self.get_sequence_step_enables() - self.get_sequence_step_timeouts() - - if self.enables["tcc"]: - used_budget_us += self.timeouts["msrc_dss_tcc_us"] + tcc_overhead - if self.enables["dss"]: - used_budget_us += 2* self.timeouts["msrc_dss_tcc_us"] + dss_overhead - if self.enables["msrc"]: - used_budget_us += self.timeouts["msrc_dss_tcc_us"] + msrc_overhead - if self.enables["pre_range"]: - used_budget_us += self.timeouts["pre_range_us"] + pre_range_overhead - if self.enables["final_range"]: - used_budget_us += final_range_overhead - - if used_budget_us > budget_us: - return False - final_range_timeout_us = budget_us - used_budget_us - final_range_timeout_mclks = self.timeout_microseconds_to_Mclks(final_range_timeout_us, self.timeouts["final_range_vcsel_period_pclks"]) - - if self.enables["pre_range"]: - final_range_timeout_mclks += self.timeouts["pre_range_mclks"] - self._register(FINAL_RANGE_CONFIG_TIMEOUT_MACROP_HI, self.encode_timeout(final_range_timeout_mclks)) - self.measurement_timing_budget_us = budget_us - return True - - def perform_single_ref_calibration(self, vhv_init_byte): - chrono = Timer.Chrono() - self._register(SYSRANGE_START, 0x01|vhv_init_byte) - chrono.start() - while self._register((RESULT_INTERRUPT_STATUS & 0x07) == 0): - time_elapsed = chrono.read_ms() - if time_elapsed > _IO_TIMEOUT: - return False - self._register(SYSTEM_INTERRUPT_CLEAR, 0x01) - self._register(SYSRANGE_START, 0x00) - return True diff --git a/python-controller/main.py b/python-controller/main.py deleted file mode 100644 index 1a3169a..0000000 --- a/python-controller/main.py +++ /dev/null @@ -1,64 +0,0 @@ -import time -import network -import socket -from machine import Pin -from machine import I2C -import VL53L0X -import MPU6050 - -ssid = "cruise" -password = "rust" - -ap = network.WLAN(network.AP_IF) -ap.config(essid=ssid) -ap.active(True) - -i2c_tof = I2C(1, scl=Pin(27), sda=Pin(26)) -tof = False -try: - tof = VL53L0X.VL53L0X(i2c_tof, address=0x29) -except Exception as e: - tof = False - -i2c_gyro = machine.I2C(0, sda=machine.Pin(20), scl=machine.Pin(21)); -mpu = False -try: - mpu = MPU6050.MPU6050(i2c_gyro, address = 0x68) - mpu.wake() -except Exception as e: - mpu = False - -while (ap.active() == False): - pass -print("network active") -print("ip: "+ap.ifconfig()[0]) - -s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) -s.bind(('', 1337)) -s.listen(5) - -while True: - try: - cl, addr = s.accept() - request = cl.recv(1024) - print(request) - cl.send("recvd") - cl.close() - except OSError as e: - cl.close() - print("closed") - - pass - - -while True: - if tof: - tof.start() - print(tof.read()) - - if mpu: - gyro = mpu.read_gyro_data() - accel = mpu.read_accel_data() - print("Gyro: " + str(gyro) + ", Accel: " + str(accel)) - time.sleep(0.1) - diff --git a/simcontroller/Cargo.lock b/simcontroller/Cargo.lock deleted file mode 100644 index bf04056..0000000 --- a/simcontroller/Cargo.lock +++ /dev/null @@ -1,2158 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.24.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler2" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" - -[[package]] -name = "ahash" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8fd72866655d1904d6b0997d0b07ba561047d070fbe29de039031c641b61217" -dependencies = [ - "const-random", -] - -[[package]] -name = "aho-corasick" -version = "1.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" -dependencies = [ - "memchr", -] - -[[package]] -name = "async-channel" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" -dependencies = [ - "concurrent-queue", - "event-listener 2.5.3", - "futures-core", -] - -[[package]] -name = "async-channel" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89b47800b0be77592da0afd425cc03468052844aff33b84e33cc696f64e77b6a" -dependencies = [ - "concurrent-queue", - "event-listener-strategy", - "futures-core", - "pin-project-lite 0.2.14", -] - -[[package]] -name = "async-executor" -version = "1.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ca9a001c1e8ba5149f91a74362376cc6bc5b919d92d988668657bd570bdcec" -dependencies = [ - "async-task", - "concurrent-queue", - "fastrand", - "futures-lite", - "slab", -] - -[[package]] -name = "async-global-executor" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05b1b633a2115cd122d73b955eadd9916c18c8f510ec9cd1686404c60ad1c29c" -dependencies = [ - "async-channel 2.3.1", - "async-executor", - "async-io", - "async-lock", - "blocking", - "futures-lite", - "once_cell", -] - -[[package]] -name = "async-io" -version = "2.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444b0228950ee6501b3568d3c93bf1176a1fdbc3b758dcd9475046d30f4dc7e8" -dependencies = [ - "async-lock", - "cfg-if 1.0.0", - "concurrent-queue", - "futures-io", - "futures-lite", - "parking", - "polling", - "rustix", - "slab", - "tracing", - "windows-sys 0.59.0", -] - -[[package]] -name = "async-lock" -version = "3.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff6e472cdea888a4bd64f342f09b3f50e1886d32afe8df3d663c01140b811b18" -dependencies = [ - "event-listener 5.3.1", - "event-listener-strategy", - "pin-project-lite 0.2.14", -] - -[[package]] -name = "async-process" -version = "2.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a8a07789659a4d385b79b18b9127fc27e1a59e1e89117c78c5ea3b806f016374" -dependencies = [ - "async-channel 2.3.1", - "async-io", - "async-lock", - "async-signal", - "async-task", - "blocking", - "cfg-if 1.0.0", - "event-listener 5.3.1", - "futures-lite", - "rustix", - "tracing", - "windows-sys 0.59.0", -] - -[[package]] -name = "async-signal" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637e00349800c0bdf8bfc21ebbc0b6524abea702b0da4168ac00d070d0c0b9f3" -dependencies = [ - "async-io", - "async-lock", - "atomic-waker", - "cfg-if 1.0.0", - "futures-core", - "futures-io", - "rustix", - "signal-hook-registry", - "slab", - "windows-sys 0.59.0", -] - -[[package]] -name = "async-std" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c634475f29802fde2b8f0b505b1bd00dfe4df7d4a000f0b36f7671197d5c3615" -dependencies = [ - "async-channel 1.9.0", - "async-global-executor", - "async-io", - "async-lock", - "async-process", - "crossbeam-utils 0.8.20", - "futures-channel", - "futures-core", - "futures-io", - "futures-lite", - "gloo-timers", - "kv-log-macro", - "log", - "memchr", - "once_cell", - "pin-project-lite 0.2.14", - "pin-utils", - "slab", - "wasm-bindgen-futures", -] - -[[package]] -name = "async-task" -version = "4.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "autocfg" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" - -[[package]] -name = "backtrace" -version = "0.3.74" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" -dependencies = [ - "addr2line", - "cfg-if 1.0.0", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", - "windows-targets", -] - -[[package]] -name = "bindgen" -version = "0.63.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36d860121800b2a9a94f9b5604b332d5cffb234ce17609ea479d723dbc9d3885" -dependencies = [ - "bitflags 1.3.2", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "log", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 1.0.109", - "which", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" - -[[package]] -name = "blocking" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "703f41c54fc768e63e091340b424302bb1c29ef4aa0c7f10fe849dfb114d29ea" -dependencies = [ - "async-channel 2.3.1", - "async-task", - "futures-io", - "futures-lite", - "piper", -] - -[[package]] -name = "bumpalo" -version = "3.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "0.4.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -dependencies = [ - "byteorder", - "either", - "iovec", -] - -[[package]] -name = "cc" -version = "1.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" -dependencies = [ - "jobserver", - "libc", - "shlex", -] - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - -[[package]] -name = "cfg-if" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "clang" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "84c044c781163c001b913cd018fc95a628c50d0d2dfea8bca77dad71edb16e37" -dependencies = [ - "clang-sys", - "libc", -] - -[[package]] -name = "clang-sys" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" -dependencies = [ - "glob", - "libc", - "libloading", -] - -[[package]] -name = "cloudabi" -version = "0.0.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "concurrent-queue" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" -dependencies = [ - "crossbeam-utils 0.8.20", -] - -[[package]] -name = "const-random" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87e00182fe74b066627d63b85fd550ac2998d4b0bd86bfed477a0ae4c7c71359" -dependencies = [ - "const-random-macro", -] - -[[package]] -name = "const-random-macro" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d839f2a20b0aee515dc581a6172f2321f96cab76c1a38a4c584a194955390e" -dependencies = [ - "getrandom", - "once_cell", - "tiny-keccak", -] - -[[package]] -name = "const-tweaker" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "297be2ecc39b6e680c7bb03d8d053a483c32a61d95bd758fca76e9b95ce7e276" -dependencies = [ - "async-std", - "const-tweaker-attribute", - "ctor", - "dashmap", - "horrorshow", - "lazy_static", - "serde", - "tide", -] - -[[package]] -name = "const-tweaker-attribute" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d709e38f0f6100c0c8c0b3aefb0aa1f83af865d7b6b267e8402820513a0c0d8" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "cookie" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5" -dependencies = [ - "time", - "url", -] - -[[package]] -name = "crossbeam-deque" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20ff29ded3204c5106278a81a38f4b482636ed4fa1e6cfbeef193291beb29ed" -dependencies = [ - "crossbeam-epoch", - "crossbeam-utils 0.7.2", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "058ed274caafc1f60c4997b5fc07bf7dc7cca454af7c6e81edffe5f33f70dace" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", - "lazy_static", - "maybe-uninit", - "memoffset", - "scopeguard", -] - -[[package]] -name = "crossbeam-queue" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "774ba60a54c213d409d5353bda12d49cd68d14e45036a285234c8d6f91f92570" -dependencies = [ - "cfg-if 0.1.10", - "crossbeam-utils 0.7.2", - "maybe-uninit", -] - -[[package]] -name = "crossbeam-utils" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c7c73a2d1e9fc0886a08b93e98eb643461230d5f1925e4036204d5f2e261a8" -dependencies = [ - "autocfg", - "cfg-if 0.1.10", - "lazy_static", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" - -[[package]] -name = "crunchy" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" - -[[package]] -name = "ctor" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d2301688392eb071b0bf1a37be05c469d3cc4dbbd95df672fe28ab021e6a096" -dependencies = [ - "quote", - "syn 1.0.109", -] - -[[package]] -name = "darling" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d706e75d87e35569db781a9b5e2416cff1236a47ed380831f959382ccd5f858" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0c960ae2da4de88a91b2d920c2a7233b400bc33cb28453a2987822d8392519b" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 1.0.109", -] - -[[package]] -name = "darling_macro" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b5a2f4ac4969822c62224815d069952656cadc7084fdca9751e6d959189b72" -dependencies = [ - "darling_core", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "dashmap" -version = "3.11.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f260e2fc850179ef410018660006951c1b55b79e8087e87111a2c388994b9b5" -dependencies = [ - "ahash", - "cfg-if 0.1.10", - "num_cpus", -] - -[[package]] -name = "data-encoding" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8566979429cf69b49a5c740c60791108e86440e8be149bbea4fe54d2c32d6e2" - -[[package]] -name = "dunce" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" - -[[package]] -name = "either" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" - -[[package]] -name = "errno" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" -dependencies = [ - "libc", - "windows-sys 0.52.0", -] - -[[package]] -name = "error-chain" -version = "0.12.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" -dependencies = [ - "backtrace", - "version_check", -] - -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "event-listener" -version = "5.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6032be9bd27023a771701cc49f9f053c751055f71efb2e0ae5c15809093675ba" -dependencies = [ - "concurrent-queue", - "parking", - "pin-project-lite 0.2.14", -] - -[[package]] -name = "event-listener-strategy" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f214dc438f977e6d4e3500aaa277f5ad94ca83fbbd9b1a15713ce2344ccc5a1" -dependencies = [ - "event-listener 5.3.1", - "pin-project-lite 0.2.14", -] - -[[package]] -name = "fastrand" -version = "2.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "fuchsia-zircon" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e9763c69ebaae630ba35f74888db465e49e259ba1bc0eda7d06f4a067615d82" -dependencies = [ - "bitflags 1.3.2", - "fuchsia-zircon-sys", -] - -[[package]] -name = "fuchsia-zircon-sys" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" - -[[package]] -name = "futures" -version = "0.1.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a471a38ef8ed83cd6e40aa59c1ffe17db6855c18e3604d9c4ed8c08ebc28678" - -[[package]] -name = "futures" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-channel" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" -dependencies = [ - "futures-core", - "futures-sink", -] - -[[package]] -name = "futures-core" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" - -[[package]] -name = "futures-cpupool" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab90cde24b3319636588d0c35fe03b1333857621051837ed769faefb4c2162e4" -dependencies = [ - "futures 0.1.31", - "num_cpus", -] - -[[package]] -name = "futures-executor" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" -dependencies = [ - "futures-core", - "futures-task", - "futures-util", -] - -[[package]] -name = "futures-io" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" - -[[package]] -name = "futures-lite" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52527eb5074e35e9339c6b4e8d12600c7128b68fb25dcb9fa9dec18f7c25f3a5" -dependencies = [ - "fastrand", - "futures-core", - "futures-io", - "parking", - "pin-project-lite 0.2.14", -] - -[[package]] -name = "futures-macro" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "futures-sink" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" - -[[package]] -name = "futures-task" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" - -[[package]] -name = "futures-util" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" -dependencies = [ - "futures 0.1.31", - "futures-channel", - "futures-core", - "futures-io", - "futures-macro", - "futures-sink", - "futures-task", - "memchr", - "pin-project-lite 0.2.14", - "pin-utils", - "slab", - "tokio-io", -] - -[[package]] -name = "getrandom" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.11.0+wasi-snapshot-preview1", -] - -[[package]] -name = "gimli" -version = "0.31.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "gloo-timers" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbb143cf96099802033e0d4f4963b19fd2e0b728bcf076cd9cf7f6634f092994" -dependencies = [ - "futures-channel", - "futures-core", - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "h2" -version = "0.1.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5b34c246847f938a410a03c5458c7fee2274436675e76d8b903c08efc29c462" -dependencies = [ - "byteorder", - "bytes", - "fnv", - "futures 0.1.31", - "http", - "indexmap", - "log", - "slab", - "string", - "tokio-io", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hermit-abi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" - -[[package]] -name = "hermit-abi" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" - -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - -[[package]] -name = "horrorshow" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8371fb981840150b1a54f7cb117bf6699f7466a1d4861daac33bc6fe2b5abea0" - -[[package]] -name = "http" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6ccf5ede3a895d8856620237b2f02972c1bbc78d2965ad7fe8838d4a0ed41f0" -dependencies = [ - "bytes", - "fnv", - "itoa 0.4.8", -] - -[[package]] -name = "http-body" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6741c859c1b2463a423a1dbce98d418e6c3c3fc720fb0d45528657320920292d" -dependencies = [ - "bytes", - "futures 0.1.31", - "http", - "tokio-buf", -] - -[[package]] -name = "http-service" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9625f605ddfaf894bf78a544a7b8e31f562dc843654723a49892d9c7e75ac708" -dependencies = [ - "async-std", - "bytes", - "futures 0.3.30", - "http", - "pin-project-lite 0.1.12", -] - -[[package]] -name = "http-service-hyper" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33d5dae94e0fdb82f9524ea2f2b98458b3d8448526d8cc8beccb3d3fded8aff" -dependencies = [ - "futures 0.3.30", - "http", - "http-service", - "hyper", -] - -[[package]] -name = "httparse" -version = "1.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" - -[[package]] -name = "hyper" -version = "0.12.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c843caf6296fc1f93444735205af9ed4e109a539005abb2564ae1d6fad34c52" -dependencies = [ - "bytes", - "futures 0.1.31", - "futures-cpupool", - "h2", - "http", - "http-body", - "httparse", - "iovec", - "itoa 0.4.8", - "log", - "net2", - "rustc_version", - "time", - "tokio", - "tokio-buf", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "tokio-tcp", - "tokio-threadpool", - "tokio-timer", - "want", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown", -] - -[[package]] -name = "iovec" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" -dependencies = [ - "libc", -] - -[[package]] -name = "itoa" -version = "0.4.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4" - -[[package]] -name = "itoa" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" - -[[package]] -name = "jobserver" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" -dependencies = [ - "libc", -] - -[[package]] -name = "js-sys" -version = "0.3.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "kernel32-sys" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7507624b29483431c0ba2d82aece8ca6cdba9382bff4ddd0f7490560c056098d" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] - -[[package]] -name = "kv-log-macro" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0de8b303297635ad57c9f5059fd9cee7a47f8e8daa09df0fcd07dd39fb22977f" -dependencies = [ - "log", -] - -[[package]] -name = "lazy_static" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "libc" -version = "0.2.158" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" - -[[package]] -name = "libloading" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" -dependencies = [ - "cfg-if 1.0.0", - "windows-targets", -] - -[[package]] -name = "linux-raw-sys" -version = "0.4.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" - -[[package]] -name = "lock_api" -version = "0.3.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" -dependencies = [ - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" -dependencies = [ - "value-bag", -] - -[[package]] -name = "matches" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" - -[[package]] -name = "maybe-uninit" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" - -[[package]] -name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "memoffset" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" -dependencies = [ - "autocfg", -] - -[[package]] -name = "mime" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" -dependencies = [ - "adler2", -] - -[[package]] -name = "mio" -version = "0.6.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" -dependencies = [ - "cfg-if 0.1.10", - "fuchsia-zircon", - "fuchsia-zircon-sys", - "iovec", - "kernel32-sys", - "libc", - "log", - "miow", - "net2", - "slab", - "winapi 0.2.8", -] - -[[package]] -name = "miow" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" -dependencies = [ - "kernel32-sys", - "net2", - "winapi 0.2.8", - "ws2_32-sys", -] - -[[package]] -name = "net2" -version = "0.2.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b13b648036a2339d06de780866fbdfda0dde886de7b3af2ddeba8b14f4ee34ac" -dependencies = [ - "cfg-if 0.1.10", - "libc", - "winapi 0.3.9", -] - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "num-traits" -version = "0.2.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" -dependencies = [ - "autocfg", -] - -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi 0.3.9", - "libc", -] - -[[package]] -name = "object" -version = "0.36.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" - -[[package]] -name = "opencv" -version = "0.92.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c01f7646f18911737aa3d721dec4a0060d044ef1224eb54a439ae6fa716ccb86" -dependencies = [ - "cc", - "dunce", - "jobserver", - "libc", - "num-traits", - "once_cell", - "opencv-binding-generator", - "pkg-config", - "semver 1.0.23", - "shlex", - "vcpkg", - "windows", -] - -[[package]] -name = "opencv-binding-generator" -version = "0.90.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c238fe1b9e78bf939dfab14184464a25acaf42d634fd502dc9ccc445f5bad1b9" -dependencies = [ - "clang", - "clang-sys", - "dunce", - "once_cell", - "percent-encoding 2.3.1", - "regex", -] - -[[package]] -name = "parking" -version = "2.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" - -[[package]] -name = "parking_lot" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f842b1982eb6c2fe34036a4fbfb06dd185a3f5c8edfaacdf7d1ea10b07de6252" -dependencies = [ - "lock_api", - "parking_lot_core", - "rustc_version", -] - -[[package]] -name = "parking_lot_core" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66b810a62be75176a80873726630147a5ca780cd33921e0b5709033e66b0a" -dependencies = [ - "cfg-if 0.1.10", - "cloudabi", - "libc", - "redox_syscall", - "rustc_version", - "smallvec", - "winapi 0.3.9", -] - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - -[[package]] -name = "percent-encoding" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" - -[[package]] -name = "pin-project-lite" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "257b64915a082f7811703966789728173279bdebb956b143dbcd23f6f970a777" - -[[package]] -name = "pin-project-lite" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" - -[[package]] -name = "pin-utils" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" - -[[package]] -name = "piper" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96c8c490f422ef9a4efd2cb5b42b76c8613d7e7dfc1caf667b8a3350a5acc066" -dependencies = [ - "atomic-waker", - "fastrand", - "futures-io", -] - -[[package]] -name = "pkg-config" -version = "0.3.30" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" - -[[package]] -name = "polling" -version = "3.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc2790cd301dec6cd3b7a025e4815cf825724a51c98dccfe6a3e55f05ffb6511" -dependencies = [ - "cfg-if 1.0.0", - "concurrent-queue", - "hermit-abi 0.4.0", - "pin-project-lite 0.2.14", - "rustix", - "tracing", - "windows-sys 0.59.0", -] - -[[package]] -name = "proc-macro2" -version = "1.0.86" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.37" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "redox_syscall" -version = "0.1.57" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" - -[[package]] -name = "regex" -version = "1.10.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata", - "regex-syntax", -] - -[[package]] -name = "regex-automata" -version = "0.4.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax", -] - -[[package]] -name = "regex-syntax" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" - -[[package]] -name = "route-recognizer" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea509065eb0b3c446acdd0102f0d46567dc30902dc0be91d6552035d92b0f4f8" - -[[package]] -name = "rustc-demangle" -version = "0.1.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "rustc_version" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" -dependencies = [ - "semver 0.9.0", -] - -[[package]] -name = "rustix" -version = "0.38.36" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f55e80d50763938498dd5ebb18647174e0c76dc38c5505294bb224624f30f36" -dependencies = [ - "bitflags 2.6.0", - "errno", - "libc", - "linux-raw-sys", - "windows-sys 0.52.0", -] - -[[package]] -name = "ryu" -version = "1.0.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "semver" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" -dependencies = [ - "semver-parser", -] - -[[package]] -name = "semver" -version = "1.0.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" - -[[package]] -name = "semver-parser" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" - -[[package]] -name = "serde" -version = "1.0.210" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.210" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "serde_json" -version = "1.0.128" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" -dependencies = [ - "itoa 1.0.11", - "memchr", - "ryu", - "serde", -] - -[[package]] -name = "serde_qs" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43eef44996bbe16e99ac720e1577eefa16f7b76b5172165c98ced20ae9903e1" -dependencies = [ - "data-encoding", - "error-chain", - "percent-encoding 1.0.1", - "serde", -] - -[[package]] -name = "shlex" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" - -[[package]] -name = "signal-hook-registry" -version = "1.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" -dependencies = [ - "libc", -] - -[[package]] -name = "simcontroller" -version = "0.1.0" -dependencies = [ - "const-tweaker", - "opencv", - "thiserror", - "webots", -] - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "smallvec" -version = "0.6.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" -dependencies = [ - "maybe-uninit", -] - -[[package]] -name = "string" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d24114bfcceb867ca7f71a0d3fe45d45619ec47a6fbfa98cb14e14250bfa5d6d" -dependencies = [ - "bytes", -] - -[[package]] -name = "strsim" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6446ced80d6c486436db5c078dde11a9f73d42b57fb273121e160b84f63d894c" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.77" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "thiserror" -version = "1.0.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.63" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "tide" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e619c99048ae107912703d0efeec4ff4fbff704f064e51d3eee614b28ea7b739" -dependencies = [ - "async-std", - "cookie", - "futures 0.3.30", - "http", - "http-service", - "http-service-hyper", - "log", - "mime", - "pin-project-lite 0.1.12", - "route-recognizer", - "serde", - "serde_json", - "serde_qs", -] - -[[package]] -name = "time" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b797afad3f312d1c66a56d11d0316f916356d11bd158fbc6ca6389ff6bf805a" -dependencies = [ - "libc", - "wasi 0.10.0+wasi-snapshot-preview1", - "winapi 0.3.9", -] - -[[package]] -name = "tiny-keccak" -version = "2.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" -dependencies = [ - "crunchy", -] - -[[package]] -name = "tinyvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a09c0b5bb588872ab2f09afa13ee6e9dac11e10a0ec9e8e3ba39a5a5d530af6" -dependencies = [ - "bytes", - "futures 0.1.31", - "mio", - "num_cpus", - "tokio-current-thread", - "tokio-executor", - "tokio-io", - "tokio-reactor", - "tokio-threadpool", - "tokio-timer", -] - -[[package]] -name = "tokio-buf" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb220f46c53859a4b7ec083e41dec9778ff0b1851c0942b211edb89e0ccdc46" -dependencies = [ - "bytes", - "either", - "futures 0.1.31", -] - -[[package]] -name = "tokio-current-thread" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de0e32a83f131e002238d7ccde18211c0a5397f60cbfffcb112868c2e0e20e" -dependencies = [ - "futures 0.1.31", - "tokio-executor", -] - -[[package]] -name = "tokio-executor" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb2d1b8f4548dbf5e1f7818512e9c406860678f29c300cdf0ebac72d1a3a1671" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures 0.1.31", -] - -[[package]] -name = "tokio-io" -version = "0.1.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" -dependencies = [ - "bytes", - "futures 0.1.31", - "log", -] - -[[package]] -name = "tokio-reactor" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09bc590ec4ba8ba87652da2068d150dcada2cfa2e07faae270a5e0409aa51351" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures 0.1.31", - "lazy_static", - "log", - "mio", - "num_cpus", - "parking_lot", - "slab", - "tokio-executor", - "tokio-io", - "tokio-sync", -] - -[[package]] -name = "tokio-sync" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edfe50152bc8164fcc456dab7891fa9bf8beaf01c5ee7e1dd43a397c3cf87dee" -dependencies = [ - "fnv", - "futures 0.1.31", -] - -[[package]] -name = "tokio-tcp" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98df18ed66e3b72e742f185882a9e201892407957e45fbff8da17ae7a7c51f72" -dependencies = [ - "bytes", - "futures 0.1.31", - "iovec", - "mio", - "tokio-io", - "tokio-reactor", -] - -[[package]] -name = "tokio-threadpool" -version = "0.1.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df720b6581784c118f0eb4310796b12b1d242a7eb95f716a8367855325c25f89" -dependencies = [ - "crossbeam-deque", - "crossbeam-queue", - "crossbeam-utils 0.7.2", - "futures 0.1.31", - "lazy_static", - "log", - "num_cpus", - "slab", - "tokio-executor", -] - -[[package]] -name = "tokio-timer" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93044f2d313c95ff1cb7809ce9a7a05735b012288a888b62d4434fd58c94f296" -dependencies = [ - "crossbeam-utils 0.7.2", - "futures 0.1.31", - "slab", - "tokio-executor", -] - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite 0.2.14", - "tracing-core", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" - -[[package]] -name = "try-lock" -version = "0.2.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" - -[[package]] -name = "unicode-bidi" -version = "0.3.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna", - "matches", - "percent-encoding 1.0.1", -] - -[[package]] -name = "value-bag" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a84c137d37ab0142f0f2ddfe332651fdbf252e7b7dbb4e67b6c1f1b2e925101" - -[[package]] -name = "vcpkg" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" - -[[package]] -name = "version_check" -version = "0.9.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" - -[[package]] -name = "want" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6395efa4784b027708f7451087e647ec73cc74f5d9bc2e418404248d679a230" -dependencies = [ - "futures 0.1.31", - "log", - "try-lock", -] - -[[package]] -name = "wasi" -version = "0.10.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a143597ca7c7793eff794def352d41792a93c481eb1042423ff7ff72ba2c31f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" -dependencies = [ - "cfg-if 1.0.0", - "once_cell", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.77", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.43" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" -dependencies = [ - "cfg-if 1.0.0", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.93" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" - -[[package]] -name = "web-sys" -version = "0.3.70" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webots" -version = "0.1.0" -source = "git+https://github.com/katharostech/webots-rust#6becd69d86b3468d4f2311b5b6474b4dc5f57b2d" -dependencies = [ - "bindgen", -] - -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - -[[package]] -name = "winapi" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-build" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd04d41d93c4992d421894c18c8b43496aa748dd4c081bac0dc93eb0489272b6" -dependencies = [ - "windows-core", - "windows-targets", -] - -[[package]] -name = "windows-core" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ba6d44ec8c2591c134257ce647b7ea6b20335bf6379a27dac5f1641fcf59f99" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-result", - "windows-strings", - "windows-targets", -] - -[[package]] -name = "windows-implement" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bbd5b46c938e506ecbce286b6628a02171d56153ba733b6c741fc627ec9579b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "windows-interface" -version = "0.58.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "053c4c462dc91d3b1504c6fe5a726dd15e216ba718e84a0e46a88fbe5ded3515" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.77", -] - -[[package]] -name = "windows-result" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-strings" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" -dependencies = [ - "windows-result", - "windows-targets", -] - -[[package]] -name = "windows-sys" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-sys" -version = "0.59.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_gnullvm", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" - -[[package]] -name = "windows_i686_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" - -[[package]] -name = "windows_i686_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" - -[[package]] -name = "windows_i686_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.52.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" - -[[package]] -name = "ws2_32-sys" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59cefebd0c892fa2dd6de581e937301d8552cb44489cdff035c6187cb63fa5e" -dependencies = [ - "winapi 0.2.8", - "winapi-build", -] diff --git a/simcontroller/Cargo.toml b/simcontroller/Cargo.toml deleted file mode 100644 index 383b72e..0000000 --- a/simcontroller/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "simcontroller" -version = "0.1.0" -edition = "2021" - -[dependencies] -const-tweaker = "0.3.1" -opencv = {version = "0.92.3", features = ["clang-runtime"]} -thiserror = "1.0.63" -webots = { git = "https://github.com/katharostech/webots-rust" } diff --git a/simcontroller/Justfile b/simcontroller/Justfile deleted file mode 100644 index a4131cd..0000000 --- a/simcontroller/Justfile +++ /dev/null @@ -1,4 +0,0 @@ -debug: - cargo build - cp target/debug/simcontroller ../simulation/controllers/cruise/cruise - diff --git a/simcontroller/src/camera.rs b/simcontroller/src/camera.rs deleted file mode 100644 index 5ca4de4..0000000 --- a/simcontroller/src/camera.rs +++ /dev/null @@ -1,122 +0,0 @@ -// MIT from HULKs -// https://github.com/HULKs/webots-rs/blob/5c4c36012c8cc0f0fe53f67b19294605a6867649/src/camera.rs - -use std::{ffi::CString, slice::from_raw_parts}; - -use thiserror::Error; -use webots::{robot::Device, sys::{ - wb_camera_disable, wb_camera_enable, wb_camera_get_exposure, wb_camera_get_focal_distance, - wb_camera_get_focal_length, wb_camera_get_fov, wb_camera_get_height, wb_camera_get_image, - wb_camera_get_max_focal_distance, wb_camera_get_max_fov, wb_camera_get_min_focal_distance, - wb_camera_get_min_fov, wb_camera_get_near, wb_camera_get_sampling_period, wb_camera_get_width, - wb_camera_has_recognition, wb_camera_save_image, wb_camera_set_exposure, - wb_camera_set_focal_distance, wb_camera_set_fov, wb_device_get_node_type, WbDeviceTag, - WbNodeType_WB_NODE_CAMERA, -}}; - -#[derive(Debug, Error)] -pub enum CameraError { - #[error("failed to get image: image data is NULL")] - ImageDataIsNull, -} - -pub struct Camera(WbDeviceTag); - -impl Camera { - pub(crate) fn new(device: &str) -> Self { - let device = Device::new(device).tag; - assert_eq!(WbNodeType_WB_NODE_CAMERA, unsafe { - wb_device_get_node_type(device) - }); - Self(device) - } - - pub fn enable(&self, sampling_period: i32) { - unsafe { wb_camera_enable(self.0, sampling_period) } - } - - pub fn disable(&self) { - unsafe { wb_camera_disable(self.0) } - } - - pub fn get_sampling_period(&self) -> i32 { - unsafe { wb_camera_get_sampling_period(self.0) } - } - - pub fn get_image(&self) -> Result<&[u8], CameraError> { - let width = self.get_width(); - let height = self.get_height(); - unsafe { - let image = wb_camera_get_image(self.0); - if image.is_null() { - return Err(CameraError::ImageDataIsNull); - } - Ok(from_raw_parts(image, (width * height * 4) as usize)) - } - } - - pub fn get_width(&self) -> i32 { - unsafe { wb_camera_get_width(self.0) } - } - - pub fn get_height(&self) -> i32 { - unsafe { wb_camera_get_height(self.0) } - } - - pub fn get_fov(&self) -> f64 { - unsafe { wb_camera_get_fov(self.0) } - } - - pub fn get_max_fov(&self) -> f64 { - unsafe { wb_camera_get_max_fov(self.0) } - } - - pub fn get_min_fov(&self) -> f64 { - unsafe { wb_camera_get_min_fov(self.0) } - } - - pub fn set_fov(&self, fov: f64) { - unsafe { wb_camera_set_fov(self.0, fov) } - } - - pub fn get_exposure(&self) -> f64 { - unsafe { wb_camera_get_exposure(self.0) } - } - - pub fn set_exposure(&self, exposure: f64) { - unsafe { wb_camera_set_exposure(self.0, exposure) } - } - - pub fn get_focal_length(&self) -> f64 { - unsafe { wb_camera_get_focal_length(self.0) } - } - - pub fn get_focal_distance(&self) -> f64 { - unsafe { wb_camera_get_focal_distance(self.0) } - } - - pub fn get_max_focal_distance(&self) -> f64 { - unsafe { wb_camera_get_max_focal_distance(self.0) } - } - - pub fn get_min_focal_distance(&self) -> f64 { - unsafe { wb_camera_get_min_focal_distance(self.0) } - } - - pub fn set_focal_distance(&self, focal_distance: f64) { - unsafe { wb_camera_set_focal_distance(self.0, focal_distance) } - } - - pub fn get_near(&self) -> f64 { - unsafe { wb_camera_get_near(self.0) } - } - - pub fn save_image(&self, filename: &str, quality: i32) -> i32 { - let filename = CString::new(filename).expect("CString::new failed"); - unsafe { wb_camera_save_image(self.0, filename.as_ptr(), quality) } - } - - pub fn has_recognition(&self) -> bool { - unsafe { wb_camera_has_recognition(self.0) != 0 } - } -} diff --git a/simcontroller/src/main.rs b/simcontroller/src/main.rs deleted file mode 100644 index 1158874..0000000 --- a/simcontroller/src/main.rs +++ /dev/null @@ -1,193 +0,0 @@ -use camera::Camera; -use opencv::{core::{bitwise_and, bitwise_and_def, bitwise_or_def, in_range, Kernel, KeyPoint, KeyPointTraitConst, Mat, MatTraitConst, MatTraitConstManual, Ptr, Size, Size_, VecN, Vector, CV_64F, CV_8UC4}, features2d::{draw_matches_def, BFMatcher, AKAZE, ORB}, gapi::{bgr2_luv, erode_def, GMat}, highgui::{self, MouseCallback}, imgcodecs::ImreadModes, imgproc::{self, cvt_color_def, gaussian_blur, gaussian_blur_def, get_structuring_element_def, sobel_def, MorphShapes, COLOR_BGR2GRAY, COLOR_BGR2HLS}, prelude::{DescriptorMatcherTrait, DescriptorMatcherTraitConst, Feature2DTrait}, ximgproc::erode}; -use webots::prelude::*; -use std::{f64::consts::TAU, time::Duration}; -mod camera; - -const TIME_STEP: Duration = Duration::from_millis(20); -const MAX_SPEED: f64 = TAU; - -// const tweaker only supports floating point, these are mapped -#[const_tweaker::tweak] -const LOWERB_H: f32 = 18. / 180.; -#[const_tweaker::tweak] -const LOWERB_L: f32 = 23. / 255.; -#[const_tweaker::tweak] -const LOWERB_S: f32 = 36. / 255.; -#[const_tweaker::tweak] -const UPPERB_H: f32 = 92. / 180.; -#[const_tweaker::tweak] -const UPPERB_L: f32 = 151. / 255.; -#[const_tweaker::tweak] -const UPPERB_S: f32 = 169. / 255.; - -struct MyRobot { - camera: Camera, - left_motor: Motor, - right_motor: Motor, - window: &'static str, - orb_detector: Ptr, - matcher: BFMatcher, - last_frame_descriptors: Option, - last_frame_keypoints: Option>, - last_image: Option, - direction: f32, - rotational_velocity: f32, -} - -impl Robot for MyRobot { - fn time_step(&self) -> Duration { - TIME_STEP - } - - fn init() -> Self { - let camera = Camera::new("camera7"); - - let left_motor = Motor::new("motorl"); - let right_motor = Motor::new("motorr"); - - left_motor.set_position(f64::INFINITY); - right_motor.set_position(f64::INFINITY); - left_motor.set_velocity(0.1 * MAX_SPEED); - right_motor.set_velocity(0.1 * MAX_SPEED); - - let window = "processed"; - //highgui::named_window(window, 1).unwrap(); - - //highgui::set_mouse_callback(window, |x,y,_,_| {dbg!(x+y);}).unwrap(); - - let orb_detector = ORB::create_def().unwrap(); - let matcher = opencv::features2d::BFMatcher::new_def().unwrap(); - //let last_frame_descriptors = opencv::core::Mat::default(); - - Self { - camera, - left_motor, - right_motor, - window, - orb_detector, - matcher, - last_frame_descriptors: None, - last_frame_keypoints: None, - last_image: None, - direction: 0., - rotational_velocity: 0., - } - } - - fn step(&mut self, _time: StepTime) { - - self.camera.enable(20); - - if let Ok(img) = self.camera.get_image() { // BGRA - let img = opencv::core::Mat::new_rows_cols_with_bytes::>(240, 320, &img).unwrap(); - - //opencv::imgcodecs::imwrite_def("cam.png", &img).unwrap(); - //highgui::imshow(self.window, &img).unwrap(); - - - let mut blurred = opencv::core::Mat::default(); - let mut edge = opencv::core::Mat::default(); - gaussian_blur_def(&img, &mut blurred, Size::new(3, 3), 0.).unwrap(); - //sobel_def(&blurred, &mut edge, CV_64F, 0, 2).unwrap(); - cvt_color_def(&blurred, &mut edge, COLOR_BGR2HLS).unwrap(); - highgui::imshow(self.window, &blurred).unwrap(); - let mut mask_a = opencv::core::Mat::default(); - let mut mask_b = opencv::core::Mat::default(); - let mut mask = opencv::core::Mat::default(); - opencv::imgcodecs::imwrite_def("blurred.png", &blurred).unwrap(); - println!("Lowrerh {}", LOWERB_H); - let lowerb = dbg!([(*LOWERB_H*255.) as u8,(*LOWERB_L*255.) as u8,(*LOWERB_S*255.) as u8,255]); - let upperb = [(*UPPERB_H*255.) as u8,(*UPPERB_L*255.) as u8,(*UPPERB_S*255.) as u8,255]; - in_range(&blurred, &lowerb, &upperb, &mut mask_a).unwrap(); // h low - let gmask = GMat::new(mask_a).unwrap(); - let kernel= get_structuring_element_def(MorphShapes::MORPH_CROSS as i32, Size_::new(2, 2)).unwrap(); - let eroded = erode_def(&gmask, &kernel).unwrap(); - // 103/180 - in_range(&blurred, &[0,30,4,255], &[52,209,63,255], &mut mask_b).unwrap(); // hh28 - //highgui::imshow("a", &mask_a).unwrap(); - //highgui::imshow("b", &mask_b).unwrap(); - dbg!(blurred.row(240/2).unwrap().col(320/2).unwrap().data_bytes().unwrap()); - let mut range = opencv::core::Mat::default(); - //bitwise_or_def(&mask_a, &mask_a, &mut mask).unwrap(); - bitwise_and(&img, &img, &mut range, &eroded.into()).unwrap(); - - highgui::imshow("edge", &range).unwrap(); - - let mask = opencv::core::Mat::default(); - let mut keypoints = opencv::core::Vector::default(); - let mut descriptors = opencv::core::Mat::default(); - self.orb_detector.detect_and_compute_def(&blurred, &mask, &mut keypoints, &mut descriptors).unwrap(); - let mut debugout = opencv::core::Mat::default(); - opencv::features2d::draw_keypoints(&img, &keypoints, &mut debugout, opencv::core::VecN([0.,255.,255.,255.]), opencv::features2d::DrawMatchesFlags::DEFAULT).unwrap(); - //highgui::imshow("keypoints", &debugout).unwrap(); - - - - - let mut matches: Vector = Vector::new(); - - - if let Some(mut last_frame_descriptors) = self.last_frame_descriptors.as_ref() { - if let Err(e) = self.matcher.train_match_def(&mut last_frame_descriptors, &mut descriptors, &mut matches) { - eprintln!("no features to match"); - } - - - let matches = matches.iter().filter(|m| m.distance < 105.).collect(); - draw_matches_def(self.last_image.as_ref().unwrap(), self.last_frame_keypoints.as_ref().unwrap(), &img , &keypoints, &matches, &mut debugout).unwrap(); - highgui::imshow("matches", &debugout).unwrap(); - - let mut horiz = Vec::new(); - for hit in matches { - if hit.distance > 45. {continue;} - let last = self.last_frame_keypoints.as_ref().unwrap().get(hit.query_idx as usize).unwrap(); - let current = keypoints.get(hit.train_idx as usize).unwrap(); - - let dx = last.pt().x - current.pt().x; - - horiz.push(dx); - } - if horiz.len() > 0 { - let avg = horiz.iter().sum::()/horiz.len() as f32; - - let lerp = 0.1 + horiz.len() as f32 * 0.05; - let lerp = lerp.max(0.65); - self.rotational_velocity = self.rotational_velocity * (1.-lerp) + avg * lerp; - //self.direction += avg; - } - self.direction += self.rotational_velocity; - } - self.last_frame_descriptors = Some(descriptors); - self.last_frame_keypoints = Some(keypoints); - self.last_image = Some(img.clone_pointee()); - } - highgui::poll_key().unwrap(); - - const DEG_TO_PX: f64 = 320. / 62.2; - let goal = if _time.elapsed.as_secs() % 8 < 4 { - 90. * DEG_TO_PX - } else { - 0. * DEG_TO_PX - }; - let error = goal - self.direction as f64; - let mut error = error * 0.02; - if error.abs() < 0.5 { - error = 0.; - } - dbg!(self.direction); - dbg!(self.rotational_velocity); - let mut left_speed = error * MAX_SPEED; - let mut right_speed = -error * MAX_SPEED; - - self.left_motor.set_velocity(left_speed.clamp(-10., 10.)); - self.right_motor.set_velocity(right_speed.clamp(-10., 10.)); - //self.left_motor.set_velocity(0.); - //self.right_motor.set_velocity(0.); - } -} - -fn main() { - println!("Rust controller has started"); - webots::run_robot::(); -}