@@ -115,15 +115,24 @@ def cmd(
115115 smoothstart : bool = False ,
116116 brake : bool = False ,
117117 ) -> None :
118- """Send a CONTROLLED_MOTORCMD to MotorControl.
118+ """Send a controlled motor command to MotorControl.
119119
120120 :param ports: Port or ports to control, use one of the port identifiers, or
121121 an iterable returning one or two of them.
122122 :param power: Speed or power, -100 to 100.
123- :param tacholimit: Position to drive to, 1 to 999999, or 0 for unlimited .
123+ :param tacholimit: Position to drive to, 1 to 999999.
124124 :param speedreg: ``True`` to enable regulation.
125125 :param smoothstart: ``True`` to enable smooth start.
126126 :param brake: ``True`` to hold brake at end of movement.
127+
128+ The motors on the selected ports must be idle, i.e. they can not be carrying out
129+ any other movement commands. If this should happen, the NXT will indicate this
130+ error by a signal (high and low beep) and will drop the message. To find out if
131+ a motor is ready to accept new commands, use the :meth:`is_ready` method. It is
132+ also possible to stop the motor before using :meth:`set_output_state` method.
133+
134+ In certain situations, :meth:`set_output_state` method should be used instead.
135+ See :meth:`set_output_state` for more details.
127136 """
128137 self ._interval_is_ready ()
129138 ports , strports = self ._decode_ports (ports , 2 )
@@ -173,13 +182,29 @@ def set_output_state(
173182 tacholimit : int ,
174183 speedreg : bool = True ,
175184 ) -> None :
176- """Send a CLASSIC_MOTORCMD to MotorControl.
185+ """Send a classic motor command to MotorControl.
177186
178187 :param ports: Port or ports to control, use one of the port identifiers, or
179188 an iterable returning one or two of them.
180189 :param power: Speed or power, -100 to 100.
181190 :param tacholimit: Position to drive to, 1 to 999999, or 0 for unlimited.
182191 :param speedreg: ``True`` to enable regulation.
192+
193+ This is similar to the regular :meth:`nxt.brick.Brick.set_output_state` method,
194+ but informs the MotorControl program to avoid any unwanted side effect.
195+
196+ When to use :meth:`set_output_state` instead of :meth:`cmd`:
197+
198+ - when tacholimit is 0 for unlimited movement,
199+ - or when the motor must coast (spin freely) after tacholimit has been reached
200+ (it will overshoot then),
201+ - or when you want to be able to change the power of a running motor at runtime.
202+
203+ Also use this method to stop a currently running motor:
204+
205+ - To stop and let a motor spin freely (coasting), use `power` 0 and no
206+ regulation.
207+ - To stop and hold the current position (brake), use `power` 0 with regulation.
183208 """
184209 self ._interval_is_ready ()
185210 ports , strports = self ._decode_ports (ports , 2 )
0 commit comments