私が2つの機能を持っているとしましょう:
def moveMotorToPosition(position,velocity)
#moves motor to a particular position
#does not terminate until motor is at that position
と
def getMotorPosition()
#retrieves the motor position at any point in time
実際には、モーターを前後に振動させたいと思っています( moveMotorToPosition を2回呼び出すループを持つことにより、正の位置で1回、負の位置で1回)。
その「制御」ループが反復している間、getMotorPositionnd を呼び出して、別の while ループが特定の頻度でデータをプルするようにします。次に、このループにタイマーを設定して、サンプリング周波数を設定できるようにします。
LabView (モーター コントローラーはフックする DLL を提供します) では、これを「並列」while ループで実現します。私は以前に並列と python で何もしたことがなく、どちらが最も説得力のある方向性なのか正確にはわかりません。