Merge remote-tracking branch 'spc/dev' into dev

# Conflicts:
#	demo/constructor/src/jvmMain/kotlin/main.kt
This commit is contained in:
Alexander Nozik 2023-11-08 15:31:55 +03:00
commit 0c128bce36
2 changed files with 1 additions and 3 deletions

View File

@ -49,7 +49,7 @@ public class VirtualDrive(
public val positionState: MutableDeviceState<Double>,
) : Drive, DeviceBySpec<Drive>(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

View File

@ -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)
}
}
}