diff --git a/controls-constructor/src/commonMain/kotlin/space/kscience/controls/constructor/Drive.kt b/controls-constructor/src/commonMain/kotlin/space/kscience/controls/constructor/Drive.kt index 9366971..0cf4ce0 100644 --- a/controls-constructor/src/commonMain/kotlin/space/kscience/controls/constructor/Drive.kt +++ b/controls-constructor/src/commonMain/kotlin/space/kscience/controls/constructor/Drive.kt @@ -49,7 +49,7 @@ public class VirtualDrive( public val positionState: MutableDeviceState, ) : Drive, DeviceBySpec(Drive, context) { - private val dt = meta["time.step"].double?.milliseconds ?: 5.milliseconds + private val dt = meta["time.step"].double?.milliseconds ?: 1.milliseconds private val clock = context.clock override var force: Double = 0.0 @@ -74,7 +74,6 @@ public class VirtualDrive( // compute new value based on velocity and acceleration from the previous step positionState.value += velocity * dtSeconds + force / mass * dtSeconds.pow(2) / 2 - propertyChanged(Drive.position, positionState.value) // compute new velocity based on acceleration on the previous step velocity += force / mass * dtSeconds diff --git a/controls-constructor/src/commonMain/kotlin/space/kscience/controls/constructor/PidRegulator.kt b/controls-constructor/src/commonMain/kotlin/space/kscience/controls/constructor/PidRegulator.kt index 9fc6e18..860af60 100644 --- a/controls-constructor/src/commonMain/kotlin/space/kscience/controls/constructor/PidRegulator.kt +++ b/controls-constructor/src/commonMain/kotlin/space/kscience/controls/constructor/PidRegulator.kt @@ -62,7 +62,6 @@ public class PidRegulator( lastPosition = drive.position drive.force = pidParameters.kp * delta + pidParameters.ki * integral + pidParameters.kd * derivative - propertyChanged(Regulator.position, drive.position) } } }