You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Expose possible property values as class attributes
Unfortunately, python does not allow to add docstrings to class
attributes (there was a proposal for this which was rejected:
https://www.python.org/dev/peps/pep-0224/). That's why the values
descriptions are implemented simply as comments.
See discussion in f276d42.
# Run to an absolute position specified by `position_sp` and then
509
+
# stop using the command specified in `stop_command`.
510
+
command_run_to_abs_pos='run-to-abs-pos'
511
+
512
+
# Run to a position relative to the current `position` value.
513
+
# The new position will be current `position` + `position_sp`.
514
+
# When the new position is reached, the motor will stop using
515
+
# the command specified by `stop_command`.
516
+
command_run_to_rel_pos='run-to-rel-pos'
517
+
518
+
# Run the motor for the amount of time specified in `time_sp`
519
+
# and then stop the motor using the command specified by `stop_command`.
520
+
command_run_timed='run-timed'
521
+
522
+
# Run the motor at the duty cycle specified by `duty_cycle_sp`.
523
+
# Unlike other run commands, changing `duty_cycle_sp` while running *will*
524
+
# take effect immediately.
525
+
command_run_direct='run-direct'
526
+
527
+
# Stop any of the run commands before they are complete using the
528
+
# command specified by `stop_command`.
529
+
command_stop='stop'
530
+
531
+
# Reset all of the motor parameter attributes to their default value.
532
+
# This will also have the effect of stopping the motor.
533
+
command_reset='reset'
534
+
535
+
# Sets the normal polarity of the rotary encoder.
536
+
encoder_polarity_normal='normal'
537
+
538
+
# Sets the inversed polarity of the rotary encoder.
539
+
encoder_polarity_inversed='inversed'
540
+
541
+
# With `normal` polarity, a positive duty cycle will
542
+
# cause the motor to rotate clockwise.
543
+
polarity_normal='normal'
544
+
545
+
# With `inversed` polarity, a positive duty cycle will
546
+
# cause the motor to rotate counter-clockwise.
547
+
polarity_inversed='inversed'
548
+
549
+
# The motor controller will vary the power supplied to the motor
550
+
# to try to maintain the speed specified in `speed_sp`.
551
+
speed_regulation_on='on'
552
+
553
+
# The motor controller will use the power specified in `duty_cycle_sp`.
554
+
speed_regulation_off='off'
555
+
556
+
# Power will be removed from the motor and it will freely coast to a stop.
557
+
stop_command_coast='coast'
558
+
559
+
# Power will be removed from the motor and a passive electrical load will
560
+
# be placed on the motor. This is usually done by shorting the motor terminals
561
+
# together. This load will absorb the energy from the rotation of the motors and
562
+
# cause the motor to stop more quickly than coasting.
563
+
stop_command_brake='brake'
564
+
565
+
# Does not remove power from the motor. Instead it actively try to hold the motor
566
+
# at the current position. If an external force tries to turn the motor, the motor
567
+
# will ``push back`` to maintain its position.
568
+
stop_command_hold='hold'
505
569
506
-
_propval_command= {
507
-
'run-forever':'Run the motor until another command is sent.' ,
508
-
'run-to-abs-pos':'Run to an absolute position specified by `position_sp` and thenstop using the command specified in `stop_command`.' ,
509
-
'run-to-rel-pos':'Run to a position relative to the current `position` value.The new position will be current `position` + `position_sp`.When the new position is reached, the motor will stop usingthe command specified by `stop_command`.' ,
510
-
'run-timed':'Run the motor for the amount of time specified in `time_sp`and then stop the motor using the command specified by `stop_command`.' ,
511
-
'run-direct':'Run the motor at the duty cycle specified by `duty_cycle_sp`.Unlike other run commands, changing `duty_cycle_sp` while running *will*take effect immediately.' ,
512
-
'stop':'Stop any of the run commands before they are complete using thecommand specified by `stop_command`.' ,
513
-
'reset':'Reset all of the motor parameter attributes to their default value.This will also have the effect of stopping the motor.' ,
514
-
}
515
-
516
-
_propval_encoder_polarity= {
517
-
'normal':'Sets the normal polarity of the rotary encoder.' ,
518
-
'inversed':'Sets the inversed polarity of the rotary encoder.' ,
519
-
}
520
-
521
-
_propval_polarity= {
522
-
'normal':'With `normal` polarity, a positive duty cycle willcause the motor to rotate clockwise.' ,
523
-
'inversed':'With `inversed` polarity, a positive duty cycle willcause the motor to rotate counter-clockwise.' ,
524
-
}
525
-
526
-
_propval_speed_regulation= {
527
-
'on':'The motor controller will vary the power supplied to the motorto try to maintain the speed specified in `speed_sp`.' ,
528
-
'off':'The motor controller will use the power specified in `duty_cycle_sp`.' ,
529
-
}
530
-
531
-
_propval_stop_command= {
532
-
'coast':'Power will be removed from the motor and it will freely coast to a stop.' ,
533
-
'brake':'Power will be removed from the motor and a passive electrical load willbe placed on the motor. This is usually done by shorting the motor terminalstogether. This load will absorb the energy from the rotation of the motors andcause the motor to stop more quickly than coasting.' ,
534
-
'hold':'Does not remove power from the motor. Instead it actively try to hold the motorat the current position. If an external force tries to turn the motor, the motorwill ``push back`` to maintain its position.' ,
# Run the motor for the amount of time specified in `time_sp`
836
+
# and then stop the motor using the command specified by `stop_command`.
837
+
command_run_timed='run-timed'
838
+
839
+
# Run the motor at the duty cycle specified by `duty_cycle_sp`.
840
+
# Unlike other run commands, changing `duty_cycle_sp` while running *will*
841
+
# take effect immediately.
842
+
command_run_direct='run-direct'
843
+
844
+
# Stop any of the run commands before they are complete using the
845
+
# command specified by `stop_command`.
846
+
command_stop='stop'
847
+
848
+
# With `normal` polarity, a positive duty cycle will
849
+
# cause the motor to rotate clockwise.
850
+
polarity_normal='normal'
851
+
852
+
# With `inversed` polarity, a positive duty cycle will
853
+
# cause the motor to rotate counter-clockwise.
854
+
polarity_inversed='inversed'
798
855
799
-
_propval_command= {
800
-
'run-forever':'Run the motor until another command is sent.' ,
801
-
'run-timed':'Run the motor for the amount of time specified in `time_sp`and then stop the motor using the command specified by `stop_command`.' ,
802
-
'run-direct':'Run the motor at the duty cycle specified by `duty_cycle_sp`.Unlike other run commands, changing `duty_cycle_sp` while running *will*take effect immediately.' ,
803
-
'stop':'Stop any of the run commands before they are complete using thecommand specified by `stop_command`.' ,
804
-
}
856
+
# Power will be removed from the motor and it will freely coast to a stop.
857
+
stop_command_coast='coast'
805
858
806
-
_propval_polarity= {
807
-
'normal':'With `normal` polarity, a positive duty cycle willcause the motor to rotate clockwise.' ,
808
-
'inversed':'With `inversed` polarity, a positive duty cycle willcause the motor to rotate counter-clockwise.' ,
809
-
}
859
+
# Power will be removed from the motor and a passive electrical load will
860
+
# be placed on the motor. This is usually done by shorting the motor terminals
861
+
# together. This load will absorb the energy from the rotation of the motors and
862
+
# cause the motor to stop more quickly than coasting.
863
+
stop_command_brake='brake'
810
864
811
-
_propval_stop_command= {
812
-
'coast':'Power will be removed from the motor and it will freely coast to a stop.' ,
813
-
'brake':'Power will be removed from the motor and a passive electrical load willbe placed on the motor. This is usually done by shorting the motor terminalstogether. This load will absorb the energy from the rotation of the motors andcause the motor to stop more quickly than coasting.' ,
0 commit comments