2323class SimMotor (StandardReadable , Stoppable , Subscribable [float ], Locatable [float ]):
2424 """For usage when simulating a motor."""
2525
26- def __init__ (self , name = "" , instant = True ) -> None :
26+ def __init__ (
27+ self ,
28+ name : str = "" ,
29+ instant : bool = True ,
30+ initial_value : float = 0.0 ,
31+ units : str = "mm" ,
32+ ) -> None :
2733 """Simulate a motor, with optional velocity.
2834
2935 :param name: name of device
3036 :param instant: whether to move instantly or calculate move time using velocity
37+ :param initial_value: initial position of the motor
38+ :param units: units of the motor position
3139 """
3240 # Define some signals
3341 with self .add_children_as_readables (Format .HINTED_SIGNAL ):
@@ -37,8 +45,8 @@ def __init__(self, name="", instant=True) -> None:
3745 with self .add_children_as_readables (Format .CONFIG_SIGNAL ):
3846 self .velocity = soft_signal_rw (float , 0 if instant else 1.0 )
3947 self .acceleration_time = soft_signal_rw (float , 0.5 )
40- self .units = soft_signal_rw (str , "mm" )
41- self .user_setpoint = soft_signal_rw (float , 0 )
48+ self .units = soft_signal_rw (str , units )
49+ self .user_setpoint = soft_signal_rw (float , initial_value )
4250
4351 # Whether set() should complete successfully or not
4452 self ._set_success = True
0 commit comments