Skip to content

Commit f6430d0

Browse files
committed
Merge in latest develop branch of ev3dev-lang
1 parent 377d063 commit f6430d0

File tree

2 files changed

+51
-36
lines changed

2 files changed

+51
-36
lines changed

ev3dev-lang

ev3dev/core.py

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -326,17 +326,17 @@ def commands(self):
326326
327327
- `run-forever` will cause the motor to run until another command is sent.
328328
- `run-to-abs-pos` will run to an absolute position specified by `position_sp`
329-
and then stop using the command specified in `stop_command`.
329+
and then stop using the action specified in `stop_action`.
330330
- `run-to-rel-pos` will run to a position relative to the current `position` value.
331331
The new position will be current `position` + `position_sp`. When the new
332-
position is reached, the motor will stop using the command specified by `stop_command`.
332+
position is reached, the motor will stop using the action specified by `stop_action`.
333333
- `run-timed` will run the motor for the amount of time specified in `time_sp`
334-
and then stop the motor using the command specified by `stop_command`.
334+
and then stop the motor using the action specified by `stop_action`.
335335
- `run-direct` will run the motor at the duty cycle specified by `duty_cycle_sp`.
336336
Unlike other run commands, changing `duty_cycle_sp` while running *will*
337337
take effect immediately.
338338
- `stop` will stop any of the run commands before they are complete using the
339-
command specified by `stop_command`.
339+
action specified by `stop_action`.
340340
- `reset` will reset all of the motor parameter attributes to their default value.
341341
This will also have the effect of stopping the motor.
342342
"""
@@ -594,7 +594,7 @@ def speed_d(self, value):
594594
def state(self):
595595
"""
596596
Reading returns a list of state flags. Possible flags are
597-
`running`, `ramping` `holding` and `stalled`.
597+
`running`, `ramping`, `holding`, `overloaded` and `stalled`.
598598
"""
599599
self._state, value = self.get_attr_set(self._state, 'state')
600600
return value
@@ -653,17 +653,17 @@ def time_sp(self, value):
653653
COMMAND_RUN_FOREVER = 'run-forever'
654654

655655
# Run to an absolute position specified by `position_sp` and then
656-
# stop using the command specified in `stop_command`.
656+
# stop using the action specified in `stop_action`.
657657
COMMAND_RUN_TO_ABS_POS = 'run-to-abs-pos'
658658

659659
# Run to a position relative to the current `position` value.
660660
# The new position will be current `position` + `position_sp`.
661661
# When the new position is reached, the motor will stop using
662-
# the command specified by `stop_command`.
662+
# the action specified by `stop_action`.
663663
COMMAND_RUN_TO_REL_POS = 'run-to-rel-pos'
664664

665665
# Run the motor for the amount of time specified in `time_sp`
666-
# and then stop the motor using the command specified by `stop_command`.
666+
# and then stop the motor using the action specified by `stop_action`.
667667
COMMAND_RUN_TIMED = 'run-timed'
668668

669669
# Run the motor at the duty cycle specified by `duty_cycle_sp`.
@@ -672,7 +672,7 @@ def time_sp(self, value):
672672
COMMAND_RUN_DIRECT = 'run-direct'
673673

674674
# Stop any of the run commands before they are complete using the
675-
# command specified by `stop_command`.
675+
# action specified by `stop_action`.
676676
COMMAND_STOP = 'stop'
677677

678678
# Reset all of the motor parameter attributes to their default value.
@@ -693,19 +693,34 @@ def time_sp(self, value):
693693
# cause the motor to rotate counter-clockwise.
694694
POLARITY_INVERSED = 'inversed'
695695

696+
# Power is being sent to the motor.
697+
STATE_RUNNING = 'running'
698+
699+
# The motor is ramping up or down and has not yet reached a constant output level.
700+
STATE_RAMPING = 'ramping'
701+
702+
# The motor is not turning, but rather attempting to hold a fixed position.
703+
STATE_HOLDING = 'holding'
704+
705+
# The motor is turning, but cannot reach its `speed_sp`.
706+
STATE_OVERLOADED = 'overloaded'
707+
708+
# The motor is not turning when it should be.
709+
STATE_STALLED = 'stalled'
710+
696711
# Power will be removed from the motor and it will freely coast to a stop.
697-
STOP_COMMAND_COAST = 'coast'
712+
STOP_ACTION_COAST = 'coast'
698713

699714
# Power will be removed from the motor and a passive electrical load will
700715
# be placed on the motor. This is usually done by shorting the motor terminals
701716
# together. This load will absorb the energy from the rotation of the motors and
702717
# cause the motor to stop more quickly than coasting.
703-
STOP_COMMAND_BRAKE = 'brake'
718+
STOP_ACTION_BRAKE = 'brake'
704719

705720
# Does not remove power from the motor. Instead it actively try to hold the motor
706721
# at the current position. If an external force tries to turn the motor, the motor
707-
# will ``push back`` to maintain its position.
708-
STOP_COMMAND_HOLD = 'hold'
722+
# will `push back` to maintain its position.
723+
STOP_ACTION_HOLD = 'hold'
709724

710725

711726
# ~autogen
@@ -720,7 +735,7 @@ def run_forever(self, **kwargs):
720735

721736
def run_to_abs_pos(self, **kwargs):
722737
"""Run to an absolute position specified by `position_sp` and then
723-
stop using the command specified in `stop_command`.
738+
stop using the action specified in `stop_action`.
724739
"""
725740
for key in kwargs:
726741
setattr(self, key, kwargs[key])
@@ -730,15 +745,15 @@ def run_to_rel_pos(self, **kwargs):
730745
"""Run to a position relative to the current `position` value.
731746
The new position will be current `position` + `position_sp`.
732747
When the new position is reached, the motor will stop using
733-
the command specified by `stop_command`.
748+
the action specified by `stop_action`.
734749
"""
735750
for key in kwargs:
736751
setattr(self, key, kwargs[key])
737752
self.command = 'run-to-rel-pos'
738753

739754
def run_timed(self, **kwargs):
740755
"""Run the motor for the amount of time specified in `time_sp`
741-
and then stop the motor using the command specified by `stop_command`.
756+
and then stop the motor using the action specified by `stop_action`.
742757
"""
743758
for key in kwargs:
744759
setattr(self, key, kwargs[key])
@@ -755,7 +770,7 @@ def run_direct(self, **kwargs):
755770

756771
def stop(self, **kwargs):
757772
"""Stop any of the run commands before they are complete using the
758-
command specified by `stop_command`.
773+
action specified by `stop_action`.
759774
"""
760775
for key in kwargs:
761776
setattr(self, key, kwargs[key])
@@ -906,8 +921,8 @@ def __init__(self, address=None, name_pattern=SYSTEM_DEVICE_NAME_CONVENTION, nam
906921
self._ramp_down_sp = None
907922
self._ramp_up_sp = None
908923
self._state = None
909-
self._stop_command = None
910-
self._stop_commands = None
924+
self._stop_action = None
925+
self._stop_actions = None
911926
self._time_sp = None
912927

913928
# ~autogen
@@ -1026,24 +1041,24 @@ def state(self):
10261041
return value
10271042

10281043
@property
1029-
def stop_command(self):
1044+
def stop_action(self):
10301045
"""
1031-
Sets the stop command that will be used when the motor stops. Read
1032-
`stop_commands` to get the list of valid values.
1046+
Sets the stop action that will be used when the motor stops. Read
1047+
`stop_actions` to get the list of valid values.
10331048
"""
1034-
raise Exception("stop_command is a write-only property!")
1049+
raise Exception("stop_action is a write-only property!")
10351050

1036-
@stop_command.setter
1037-
def stop_command(self, value):
1038-
self._stop_command = self.set_attr_string(self._stop_command, 'stop_command', value)
1051+
@stop_action.setter
1052+
def stop_action(self, value):
1053+
self._stop_action = self.set_attr_string(self._stop_action, 'stop_action', value)
10391054

10401055
@property
1041-
def stop_commands(self):
1056+
def stop_actions(self):
10421057
"""
1043-
Gets a list of stop commands. Valid values are `coast`
1058+
Gets a list of stop actions. Valid values are `coast`
10441059
and `brake`.
10451060
"""
1046-
self._stop_commands, value = self.get_attr_set(self._stop_commands, 'stop_commands')
1061+
self._stop_actions, value = self.get_attr_set(self._stop_actions, 'stop_actions')
10471062
return value
10481063

10491064
@property
@@ -1068,7 +1083,7 @@ def time_sp(self, value):
10681083
COMMAND_RUN_FOREVER = 'run-forever'
10691084

10701085
# Run the motor for the amount of time specified in `time_sp`
1071-
# and then stop the motor using the command specified by `stop_command`.
1086+
# and then stop the motor using the action specified by `stop_action`.
10721087
COMMAND_RUN_TIMED = 'run-timed'
10731088

10741089
# Run the motor at the duty cycle specified by `duty_cycle_sp`.
@@ -1077,7 +1092,7 @@ def time_sp(self, value):
10771092
COMMAND_RUN_DIRECT = 'run-direct'
10781093

10791094
# Stop any of the run commands before they are complete using the
1080-
# command specified by `stop_command`.
1095+
# action specified by `stop_action`.
10811096
COMMAND_STOP = 'stop'
10821097

10831098
# With `normal` polarity, a positive duty cycle will
@@ -1089,13 +1104,13 @@ def time_sp(self, value):
10891104
POLARITY_INVERSED = 'inversed'
10901105

10911106
# Power will be removed from the motor and it will freely coast to a stop.
1092-
STOP_COMMAND_COAST = 'coast'
1107+
STOP_ACTION_COAST = 'coast'
10931108

10941109
# Power will be removed from the motor and a passive electrical load will
10951110
# be placed on the motor. This is usually done by shorting the motor terminals
10961111
# together. This load will absorb the energy from the rotation of the motors and
10971112
# cause the motor to stop more quickly than coasting.
1098-
STOP_COMMAND_BRAKE = 'brake'
1113+
STOP_ACTION_BRAKE = 'brake'
10991114

11001115

11011116
# ~autogen
@@ -1110,7 +1125,7 @@ def run_forever(self, **kwargs):
11101125

11111126
def run_timed(self, **kwargs):
11121127
"""Run the motor for the amount of time specified in `time_sp`
1113-
and then stop the motor using the command specified by `stop_command`.
1128+
and then stop the motor using the action specified by `stop_action`.
11141129
"""
11151130
for key in kwargs:
11161131
setattr(self, key, kwargs[key])
@@ -1127,7 +1142,7 @@ def run_direct(self, **kwargs):
11271142

11281143
def stop(self, **kwargs):
11291144
"""Stop any of the run commands before they are complete using the
1130-
command specified by `stop_command`.
1145+
action specified by `stop_action`.
11311146
"""
11321147
for key in kwargs:
11331148
setattr(self, key, kwargs[key])

0 commit comments

Comments
 (0)