![]() |
MatrixMiniR4 1.2.2
Matrix Mini R4 Arduino Library API Documentation
|
Class for controlling a DC motor with encoder functionality. More...
#include <MiniR4DriveDC.h>
Public Member Functions | |
| MiniR4DriveDC () | |
| uint8_t | begin (uint8_t leftMotorID, uint8_t rightMotorID, bool isLeftReverse, bool isRightReverse) |
| Initializes the DC motor settings. | |
| bool | setMoveSyncPID (float kp, float ki, float kd) |
| Sets the DriveDC motor parameters (Unuse) | |
| bool | setMoveGyroPID (float kp, float ki, float kd) |
| Sets the PID parameters for DriveDC MoveGyro. | |
| bool | setTurnGyroPID (float kp, float ki, float kd) |
| Sets the PID parameters for DriveDC TurnGyro. | |
| uint8_t | Move (int16_t power_left, int16_t power_right) |
| Sets the Motor Type for DriveDC. (Unuse) | |
| uint8_t | MoveDegs (int16_t power_left, int16_t power_right, uint16_t degree, bool brake, bool async=false) |
| Sets the power level of the DC motor for a specific degree. | |
| uint8_t | MoveTime (int16_t power_left, int16_t power_right, float Time_S, bool brake, bool async=false) |
| Sets the power level of the DC motor for a specific time period. | |
| uint8_t | MoveSync (int16_t power_left, int16_t power_right) |
| Sets the power level of the DC motor with synchronization. | |
| uint8_t | MoveSyncDegs (int16_t power_left, int16_t power_right, uint16_t degree, bool brake, bool async=false) |
| Sets the power level of the DC motor with synchronization for specific degrees. | |
| uint8_t | MoveSyncTime (int16_t power_left, int16_t power_right, float Time_S, bool brake, bool async=false) |
| Sets the power level of the DC motor with synchronization for specific time. | |
| uint8_t | MoveGyro (int16_t power, int16_t Target) |
| Sets the power level with gyro guidance. | |
| uint8_t | MoveGyroDegs (int16_t power_X, int16_t Target_D, uint16_t degree, bool brake, bool async=false) |
| Sets the power level with gyro guidance for specific degrees. | |
| uint8_t | MoveGyroTime (int16_t power, int16_t Target, float Time_S, bool brake, bool async=false) |
| Sets the power level with gyro guidance for specific time. | |
| uint8_t | TurnGyro (int16_t power, int16_t Target_D, uint8_t mode, bool brake, bool async=false) |
| Turns the robot to a specific gyro heading. | |
| int32_t | getCounter (void) |
| Gets the estimated rotation counter of the drivebase. (not degrees) | |
| int32_t | getDegrees (void) |
| Gets the estimated degrees of the drivebase. | |
| uint8_t | resetCounter (void) |
| Resets the drivebase encoder counter/degrees to zero. | |
| uint8_t | brake (bool brakeType) |
| Sets the brake mode for the DC motor. | |
| bool | isPrevTaskDone (void) |
| Checks if the previous task has completed. | |
Class for controlling a DC motor with encoder functionality.
This template class provides methods for initializing, driving DC motor by Move, MoveSync, MoveGyro, TurnGyro function
| ID | The identifier for the motor. |
Definition at line 29 of file MiniR4DriveDC.h.
|
inline |
Definition at line 30 of file MiniR4DriveDC.h.
|
inline |
Initializes the DC motor settings.
This function sets the speed range, resets the encoder counter, powers off the motor, and sets the direction to forward.
Note: Once you call MiniR4.DriveDC.begin, DriveDC class motor will automatically begin.
| leftMotorID | : the number of Left motor |
| rightMotorID | : the number of Right motor |
| isLeftReverse | : the direction of Left motor encoder |
| isRightReverse | : the direction of Right motor encoder |
Definition at line 49 of file MiniR4DriveDC.h.
|
inline |
Sets the brake mode for the DC motor.
Like LEGO EV3/SPIKE, True is Brake, False is Coast.
| brakeType | True to engage the brake, false to coast the motor. |
Definition at line 676 of file MiniR4DriveDC.h.
|
inline |
Gets the estimated rotation counter of the drivebase. (not degrees)
Definition at line 622 of file MiniR4DriveDC.h.
|
inline |
Gets the estimated degrees of the drivebase.
Definition at line 639 of file MiniR4DriveDC.h.
|
inline |
Checks if the previous task has completed.
Definition at line 693 of file MiniR4DriveDC.h.
|
inline |
Sets the Motor Type for DriveDC. (Unuse)
| typeXC | => 1:Blue Motor / 2:LEGO Motor |
Sets the power level of the DC motor.
It's like LEGO EV3/SPIKE Power block (Unregulated Motor) It will output the Motor PWM from 0% to 100%
| power_left | The power level to set for left motor (-100 to 100). |
| power_right | The power level to set for right motor (-100 to 100). |
Definition at line 203 of file MiniR4DriveDC.h.
|
inline |
Sets the power level of the DC motor for a specific degree.
It's like LEGO EV3/SPIKE Power block (Unregulated Motor) It will output the Motor PWM from 0% to 100%
| power_left | The power level to set for left motor (-100 to 100). |
| power_right | The power level to set for right motor (-100 to 100). |
| degree | Target Degree for Stop |
| brake | True(Brake) / false(coast) |
| async | True(non-block) / false(block) - default: false |
Definition at line 237 of file MiniR4DriveDC.h.
|
inline |
Sets the power level with gyro guidance.
Robot moves with gyro sensor feedback to maintain straight line or target heading
| power | The power level to set (-100 to 100). |
| Target | Target Degree of the IMU Yaw (-360 ~ +360) |
Definition at line 458 of file MiniR4DriveDC.h.
|
inline |
Sets the power level with gyro guidance for specific degrees.
Robot moves with gyro sensor feedback to maintain heading while moving specific encoder degrees
| power_X | The power level to set (-100 to 100). |
| Target_D | Target Degree of the IMU Yaw (-360 ~ +360) |
| degree | Target Degree of the motor encoder for stop |
| brake | True(Brake) / false(coast) |
| async | True(non-block) / false(block) - default: false |
Definition at line 491 of file MiniR4DriveDC.h.
|
inline |
Sets the power level with gyro guidance for specific time.
Robot moves with gyro sensor feedback to maintain heading for specific time duration
| power | The power level to set (-100 to 100). |
| Target | Target Degree of the IMU Yaw (-360 ~ +360) |
| Time_S | The Period(secs) of the motor running |
| brake | True(Brake) / false(coast) |
| async | True(non-block) / false(block) - default: false |
Definition at line 539 of file MiniR4DriveDC.h.
|
inline |
Sets the power level of the DC motor with synchronization.
It's like LEGO EV3/SPIKE Power block (Regulated Motor) Motors will run synchronized with encoder feedback
| power_left | The power level to set for left motor (-100 to 100). |
| power_right | The power level to set for right motor (-100 to 100). |
Definition at line 329 of file MiniR4DriveDC.h.
|
inline |
Sets the power level of the DC motor with synchronization for specific degrees.
It's like LEGO EV3/SPIKE Power block (Regulated Motor) Motors will run synchronized with encoder feedback
| power_left | The power level to set for left motor (-100 to 100). |
| power_right | The power level to set for right motor (-100 to 100). |
| degree | Target Degree |
| brake | True(Brake) / false(coast) |
| async | True(non-block) / false(block) - default: false |
Definition at line 363 of file MiniR4DriveDC.h.
|
inline |
Sets the power level of the DC motor with synchronization for specific time.
It's like LEGO EV3/SPIKE Power block (Regulated Motor) Motors will run synchronized with encoder feedback
| power_left | The power level to set for left motor (-100 to 100). |
| power_right | The power level to set for right motor (-100 to 100). |
| Time_S | Period of the Motor Running (secs) |
| brake | True(Brake) / false(coast) |
| async | True(non-block) / false(block) - default: false |
Definition at line 412 of file MiniR4DriveDC.h.
|
inline |
Sets the power level of the DC motor for a specific time period.
It's like LEGO EV3/SPIKE Power block (Unregulated Motor) It will output the Motor PWM from 0% to 100%
| power_left | The power level to set for left motor (-100 to 100). |
| power_right | The power level to set for right motor (-100 to 100). |
| Time_S | Period of the Motor Running (secs) |
| brake | True(Brake) / false(coast) |
| async | True(non-block) / false(block) - default: false |
Definition at line 284 of file MiniR4DriveDC.h.
|
inline |
Resets the drivebase encoder counter/degrees to zero.
Definition at line 656 of file MiniR4DriveDC.h.
|
inline |
Sets the PID parameters for DriveDC MoveGyro.
| kp | Proportional gain.(TT:6.01, LE:0.52) |
| ki | Integral gain.(TT:0.00, LE:0.00) |
| kd | Derivative gain.(TT:2.15, LE:0.15) |
Definition at line 146 of file MiniR4DriveDC.h.
|
inline |
Sets the DriveDC motor parameters (Unuse)
| m1_no | : the number of Left motor |
| m2_no | : the number of Right motor |
| m1_dir | : the direction of Left motor encoder |
| m2_dir | : the direction of Right motor encoder |
Sets the PID parameters for DriveDC MoveSync.
| kp | Proportional gain.(TT:0.02, LE:0.002) |
| ki | Integral gain.(TT:0.00, LE:0.00) |
| kd | Derivative gain.(TT:0.04, LE:0.004) |
Definition at line 127 of file MiniR4DriveDC.h.
|
inline |
Sets the PID parameters for DriveDC TurnGyro.
| kp | Proportional gain.(TT:22.75, LE-F:22.75, LE-S:5.25) |
| ki | Integral gain.(TT:0.08, LE:0.02) |
| kd | Derivative gain.(TT:0.25, LE:1.54) |
Definition at line 165 of file MiniR4DriveDC.h.
|
inline |
Turns the robot to a specific gyro heading.
Robot turns in place using gyro sensor feedback to reach target heading
| power | The power level to set (-100 to 100). |
| Target_D | Target Degree of the IMU Yaw (-360 ~ +360) |
| mode | 0:single motor / 1:two motor |
| brake | True(Brake) / false(coast) |
| async | True(non-block) / false(block) - default: false |
Definition at line 587 of file MiniR4DriveDC.h.