fixed compile errors
This commit is contained in:
1 parent
330b000b6e
commit
4ebd09d2eb
3 files changed
+29
-52
No files matched your search
@@ -1,13 +1,9 @@
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use super::BufferV1;
|
||||
use control_core::actors::Actor;
|
||||
|
||||
impl Actor for BufferV1 {
|
||||
fn act(
|
||||
&mut self,
|
||||
now: Instant
|
||||
) -> std::pin::Pin<Box<dyn Future<Output = ()> + Send + '_>> {
|
||||
use control_core::machines::new::MachineAct;
|
||||
impl MachineAct for BufferV1 {
|
||||
fn act(&mut self, now: Instant) -> std::pin::Pin<Box<dyn Future<Output = ()> + Send + '_>> {
|
||||
Box::pin(async move {
|
||||
//self.buffer_tower.act(now).await;
|
||||
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
pub mod act;
|
||||
pub mod api;
|
||||
pub mod new;
|
||||
pub mod buffer_tower_controller;
|
||||
pub mod new;
|
||||
pub mod puller_speed_controller;
|
||||
|
||||
use api::{
|
||||
BufferV1Events, Buffer1Namespace, StateEvent, ModeState, SineWaveState, LiveValuesEvent,
|
||||
Buffer1Namespace, BufferV1Events, LiveValuesEvent, ModeState, SineWaveState, StateEvent,
|
||||
};
|
||||
use buffer_tower_controller::BufferTowerController;
|
||||
use control_core::{machines::Machine, socketio::namespace::NamespaceCacheingLogic};
|
||||
use puller_speed_controller::PullerSpeedController;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::time::Instant;
|
||||
use tracing::info;
|
||||
use uom::si::{f64::Frequency, frequency::hertz};
|
||||
use std::time::Instant;
|
||||
use puller_speed_controller::{PullerSpeedController};
|
||||
use buffer_tower_controller::{BufferTowerController};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct BufferV1 {
|
||||
@@ -38,6 +38,7 @@ impl std::fmt::Display for BufferV1 {
|
||||
write!(f, "BufferV1")
|
||||
}
|
||||
}
|
||||
|
||||
impl Machine for BufferV1 {}
|
||||
|
||||
impl BufferV1 {
|
||||
@@ -78,7 +79,7 @@ impl BufferV1 {
|
||||
_ => (2.0 * std::f64::consts::PI * freq_hz * elapsed).sin(),
|
||||
};
|
||||
|
||||
amplitude
|
||||
amplitude
|
||||
}
|
||||
|
||||
pub fn change_frequency(&mut self, frequency: f64) {
|
||||
@@ -98,14 +99,10 @@ impl BufferV1 {
|
||||
fn switch_to_standby(&mut self) {
|
||||
match self.mode {
|
||||
BufferV1Mode::Standby => (),
|
||||
BufferV1Mode::FillingBuffer => {
|
||||
|
||||
}
|
||||
BufferV1Mode::EmptyingBuffer => {
|
||||
|
||||
}
|
||||
BufferV1Mode::FillingBuffer => {}
|
||||
BufferV1Mode::EmptyingBuffer => {}
|
||||
};
|
||||
self.mode = BufferV1Mode::Standby;
|
||||
self.mode = BufferV1Mode::Standby;
|
||||
}
|
||||
|
||||
// Turn on motor and fill buffer
|
||||
@@ -113,23 +110,19 @@ impl BufferV1 {
|
||||
match self.mode {
|
||||
BufferV1Mode::Standby => self.fill_buffer(),
|
||||
BufferV1Mode::FillingBuffer => (),
|
||||
BufferV1Mode::EmptyingBuffer => {
|
||||
|
||||
}
|
||||
BufferV1Mode::EmptyingBuffer => {}
|
||||
};
|
||||
self.mode = BufferV1Mode::FillingBuffer;
|
||||
self.mode = BufferV1Mode::FillingBuffer;
|
||||
}
|
||||
|
||||
// Turn off motor and empty buffer
|
||||
fn switch_to_emptying(&mut self) {
|
||||
match self.mode {
|
||||
BufferV1Mode::Standby => self.empty_buffer(),
|
||||
BufferV1Mode::FillingBuffer => {
|
||||
|
||||
}
|
||||
BufferV1Mode::FillingBuffer => {}
|
||||
BufferV1Mode::EmptyingBuffer => (),
|
||||
};
|
||||
self.mode = BufferV1Mode::EmptyingBuffer;
|
||||
self.mode = BufferV1Mode::EmptyingBuffer;
|
||||
}
|
||||
|
||||
fn switch_mode(&mut self, mode: BufferV1Mode) {
|
||||
@@ -156,7 +149,7 @@ impl BufferV1 {
|
||||
self.emit_state();
|
||||
}
|
||||
fn set_rpm_state(&mut self, rpm: f64) {
|
||||
//TODO
|
||||
//TODO
|
||||
self.emit_state();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use std::time::Instant;
|
||||
|
||||
use anyhow::Error;
|
||||
use control_core::actors::stepper_driver_el70x1::StepperDriverEL70x1;
|
||||
use control_core::converters::linear_step_converter::LinearStepConverter;
|
||||
use control_core::machines::identification::DeviceHardwareIdentification;
|
||||
use control_core::machines::new::{
|
||||
@@ -12,15 +11,13 @@ use control_core::machines::new::{
|
||||
use control_core::uom_extensions::velocity::meter_per_minute;
|
||||
use ethercat_hal::coe::ConfigurableDevice;
|
||||
use ethercat_hal::devices::ek1100::EK1100;
|
||||
use ethercat_hal::devices::ek1100::EK1100_IDENTITY_A;
|
||||
use ethercat_hal::devices::el7031_0030::coe::EL7031_0030Configuration;
|
||||
use ethercat_hal::devices::el7031_0030::pdo::EL7031_0030PredefinedPdoAssignment;
|
||||
use ethercat_hal::devices::el7031_0030::{
|
||||
self, EL7031_0030, EL7031_0030_IDENTITY_A,
|
||||
};
|
||||
use ethercat_hal::devices::el7031_0030::{self, EL7031_0030, EL7031_0030_IDENTITY_A};
|
||||
use ethercat_hal::devices::el7041_0052::coe::EL7041_0052Configuration;
|
||||
use ethercat_hal::devices::el7041_0052::{EL7041_0052Port, EL7041_0052, EL7041_0052_IDENTITY_A};
|
||||
use ethercat_hal::devices::el7041_0052::{EL7041_0052, EL7041_0052_IDENTITY_A, EL7041_0052Port};
|
||||
use ethercat_hal::devices::{EthercatDeviceUsed, downcast_device, subdevice_identity_to_tuple};
|
||||
use ethercat_hal::devices::{ek1100::EK1100_IDENTITY_A};
|
||||
use ethercat_hal::io::stepper_velocity_el70x1::StepperVelocityEL70x1;
|
||||
use ethercat_hal::shared_config;
|
||||
use ethercat_hal::shared_config::el70x1::{EL70x1OperationMode, StmMotorConfiguration};
|
||||
@@ -29,13 +26,11 @@ use uom::si::frequency::hertz;
|
||||
use uom::si::length::{centimeter, millimeter};
|
||||
use uom::si::velocity::Velocity;
|
||||
|
||||
use crate::machines::buffer1::BufferV1Mode;
|
||||
use crate::machines::buffer1::buffer_tower_controller::BufferTowerController;
|
||||
use crate::machines::buffer1::puller_speed_controller::PullerSpeedController;
|
||||
use crate::machines::buffer1::BufferV1Mode;
|
||||
|
||||
use super::{
|
||||
api::{Buffer1Namespace}, BufferV1
|
||||
};
|
||||
use super::{BufferV1, api::Buffer1Namespace};
|
||||
|
||||
impl MachineNewTrait for BufferV1 {
|
||||
fn new<'maindevice>(params: &MachineNewParams) -> Result<Self, Error> {
|
||||
@@ -158,7 +153,7 @@ impl MachineNewTrait for BufferV1 {
|
||||
(device, config)
|
||||
};
|
||||
|
||||
// Role 2
|
||||
// Role 2
|
||||
// 1x Stepper Puller
|
||||
// EL7031
|
||||
let (el7031_0030, el7031_0030_config) = {
|
||||
@@ -218,29 +213,23 @@ impl MachineNewTrait for BufferV1 {
|
||||
device_guard.set_used(true);
|
||||
}
|
||||
(device, config)
|
||||
};
|
||||
};
|
||||
|
||||
// LIVE VALUE TESTING
|
||||
let t_0 = Instant::now();
|
||||
let frequency: Frequency = Frequency::new::<hertz>(0.5);
|
||||
|
||||
|
||||
// Controllers
|
||||
let puller_speed_controller = PullerSpeedController::new(
|
||||
Velocity::new::<meter_per_minute>(1.0),
|
||||
Length::new::<millimeter>(1.75),
|
||||
LinearStepConverter::from_diameter(
|
||||
200,
|
||||
Length::new::<centimeter>(8.0),
|
||||
),
|
||||
LinearStepConverter::from_diameter(200, Length::new::<centimeter>(8.0)),
|
||||
);
|
||||
|
||||
let buffer_tower_controller = BufferTowerController::new(
|
||||
Velocity::new::<meter_per_minute>(1.0),
|
||||
Length::new::<millimeter>(1.75),
|
||||
LinearStepConverter::from_diameter(
|
||||
200,
|
||||
Length::new::<centimeter>(8.0),
|
||||
),
|
||||
LinearStepConverter::from_diameter(200, Length::new::<centimeter>(8.0)),
|
||||
el7041,
|
||||
el7041_config,
|
||||
);
|
||||
@@ -256,7 +245,6 @@ impl MachineNewTrait for BufferV1 {
|
||||
};
|
||||
buffer.emit_state();
|
||||
Ok(buffer)
|
||||
})
|
||||
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user