parameters – Parameters and Constants¶
Constant parameters/arguments for the Pybricks API.
-
class
Port¶ Port on the programmable brick or hub.
-
class
Direction¶ Rotational direction for positive speed or angle values.
-
CLOCKWISE¶ A positive speed value should make the motor move clockwise.
-
COUNTERCLOCKWISE¶ A positive speed value should make the motor move counterclockwise.
positive_direction =Positive speed: Negative speed: Direction.CLOCKWISEclockwise counterclockwise Direction.COUNTERCLOCKWISEcounterclockwise clockwise By default, the positive direction is set as clockwise. Refer to this diagram to see which direction this is for EV3 motors.
-
-
class
Stop¶ Action after the motor stops: coast, brake, or hold.
-
COAST¶ Let the motor move freely.
-
BRAKE¶ Passively resist small external forces.
-
HOLD¶ Keep controlling the motor to hold it at the commanded angle. This is only available on motors with encoders.
The following table show how each stop type adds an extra level of resistance to motion. In these examples,
mis aMotorand anddis aDriveBase. The examples also show how running at zero speed compares to these stop types.TypeFrictionBackEMFSpeedkept at 0Angle keptat targetExamplesCoast m.stop()m.run_target(500, 90, Stop.COAST)Brake m.brake()m.run_target(500, 90, Stop.BRAKE)m.run(0)d.drive(0, 0)Hold m.hold()m.run_target(500, 90, Stop.HOLD)d.straight(0)d.straight(100)-