Control DC motors that have incremental encoders. Each motor is specified by a different index: 1, 2, 3, ...
The units used in this library are:
Warning: this library must be configured by a board-specific library in order to control that board.
The board-specific library must define the following blocks (which take no arguments):
edcmotors_getNumMotors
: return the number of DC motors you are using._edcmotors_initSystemVariables
: initialize system-specific Encoded DC Motors
variables._edcmotors_checkSystem
: check that the motors are powered on, or similar. This block is optional, but highly recommended if there is anything the user must do to run the motors. For example the XRP has a power switch that must be on to run the motors, but not to program the board via USB. That makes it very easy to forget to turn on the power switch.See the XRP library for an example.
For each block, there is a short description entry and a detailed block and component description. You can click on block pictures in the short description table to access the details.
e
Short Description | |
---|---|
Move motor at speed. | |
Move motor with effort. | |
Reset motor encoder. | |
Stop all motors. | |
Stop motors. | |
Wait for motors to stop. |
Move the specified motor at the specified speed (encoder counts/second) for the specified duration (milliseconds, 0=forever). Note that this block exits almost immediately; if you want to wait for the move to finish, put after this block.
Move the specified motor with the specified effort (-1023 to 1023). This ignores the encoders. This is a low-level block that may not be useful in normal code.
Reset the specified motor encoder value to 0. Please only do this when not controlling the motor in a feedback loop, because otherwise the motor may start moving very abruptly. This is a low-level block that may not be useful in normal code.
Stop all motors.
Stop the specified motors.
Wait for the specified motors to stop. This uses the predicted end time of the current move, rather than actually waiting for the wheels to stop, so it may exit early.