public interface IMotor
Modifier and Type | Method and Description |
---|---|
float |
getMaxAcceleration()
• Returns the maximum acceleration.
|
float |
getMaxSpeed()
• Returns the maximum rotational velocity.
|
float |
getPosition()
• Returns the current angular position of the motor.
|
float |
getSpeed()
• Returns the instantaneous
(that is "real") rotational velocity of the motor.
|
float |
getTargetAcceleration()
• Returns the stored target acceleration.
|
float |
getTargetSpeed()
• Returns the currently stored target velocity.
|
boolean |
isMoving()
• Checks if the motor is currently in motion.
|
boolean |
isStalled()
• Checks if the motor control has been stalled.
|
void |
releaseControl()
• Releases the control of the motor.
|
void |
resetPosition()
• Resets the angular position of the motor.
|
void |
rotate(EDirection direction)
• Starts an unlimited rotation of the motor.
|
void |
rotateByAngle(float angle,
EWaitingMode waitingMode)
• Starts or completes a motor rotation by the given angle.
|
void |
rotateTime(float period,
EDirection direction,
EWaitingMode waitingMode)
• Starts or completes a time limited rotation of the motor.
|
void |
rotateToPostion(float position,
EWaitingMode waitingMode)
• Starts or completes a motor rotation to the given motor position.
|
void |
setCorrectionFactor(float correctionFactor)
• Sets the correction factor for the motor position to the given value.
|
void |
setTargetAcceleration(float acceleration)
• Sets the target acceleration to the given value.
|
void |
setTargetAccelerationToMax()
• Sets the target acceleration to its maximum value.
|
void |
setTargetSpeed(float speed)
• Sets the target velocity to the given value.
|
void |
setTargetSpeedToMax()
• Sets the target velocity to its maximum value.
|
void |
stopRotation(EWaitingMode waitingMode)
• Stops the current rotation obeying the current target acceleration (here: deceleration).
|
void |
waitUntilRotationCompleted()
• Waits for the end of the current motor rotation.
|
float getMaxAcceleration()
float getMaxSpeed()
float getPosition()
float getSpeed()
float getTargetAcceleration()
float getTargetSpeed()
boolean isMoving()
boolean isStalled()
void releaseControl()
void resetPosition()
void rotate(EDirection direction)
direction
- direction of rotation (see EDirection
)void rotateByAngle(float angle, EWaitingMode waitingMode)
EWaitingMode
).angle
- the rotation angle (in °)waitingMode
- determines whether program execution will be stalled during motor rotationvoid rotateTime(float period, EDirection direction, EWaitingMode waitingMode)
EWaitingMode
).
Expections should not be too high regarding the accuracy of the time measurement.
Note that if the motor already is in motion, the minimum rotation time will be the deceleration time
which depends on the starting velocity and the target acceleration.period
- duration of the motor rotation (in ms)direction
- direction of rotation (see EDirection
)waitingMode
- determines whether program execution will be stalled during motor rotationvoid rotateToPostion(float position, EWaitingMode waitingMode)
EWaitingMode
).position
- the target position of the motor (in °)waitingMode
- determines whether program execution will be stalled during motor rotationvoid setCorrectionFactor(float correctionFactor)
correctionFactor
- correction factor for the motor position (default value is 1)void setTargetAcceleration(float acceleration)
acceleration
- the new target acceleration (in °/s²)void setTargetAccelerationToMax()
void setTargetSpeed(float speed)
speed
- the new rotational target velocity (in °/s)void setTargetSpeedToMax()
void stopRotation(EWaitingMode waitingMode)
EWaitingMode
).waitingMode
- determines whether program execution will be stalled during motor rotationvoid waitUntilRotationCompleted()