Purpose
Automatically implements an Arcade style drive controlled, where left and right motors (1 or 2 by side) are controlled by 2 dedicated inputs (most probably remote controller joystick channels)Purpose
Easily implement an Arcade style drive for a mobile robot.
When to use
If you have a tank an Arcade styled drive system configuration, where a channel controls TO DOsignal controls frontward and backward motion and another one controls the rotation.
Where to use
In the void loop()
part of your .ino
file, since it’s a one time calculation that needs to be re-executed at short intervals.
Note |
---|
This function requires the use of the following functions at some point of your |
Returns
This function does not return a value once it has completed its tasks.
Main prototype and parameters
static void Crc::CrcLib::MoveTankMoveArcade(int8_t leftChannelforwardChannel, int8_t rightChannelyawChannel, unsigned char frontLeftMotor, unsigned char backLeftMotor, unsigned char frontRightMotor, unsigned char backRightMotor)
The following parameters must be passed to the function for it to work properly:
leftChannel
forwardChannel
: The speed value used to control the left drive motorforward motion. Must be of the typeint8_t
(also calledsigned char
), so ranging[-128, 127]
.rightChannel
yawChannel
: The speed value used to control the right drive motorrotative motion. Must be of the typeint8_t
(also calledsigned char
), so ranging[-128, 127]
.frontLeftMotor
: The name of the PWM pin to wich is connected the front left motor. Must be of the typeunsigned char
.backLeftMotor:
The name of the PWM pin to wich is connected the back left motor. Must be of the typeunsigned char.
frontRightMotor
: The name of the PWM pin to wich is connected the front right motor. Must be of the typeunsigned char
.backLeftMotor:
The name of the PWM pin to wich is connected the back right motor. Must be of the typeunsigned char
.
Overloads
#1: Using only one motor per side
static void Crc::CrcLib::MoveTankMoveArcade(int8_t leftChannelforwardChannel, int8_t rightChannelyawChannel, unsigned char leftMotor, unsigned char rightMotor)
The following parameters must be passed to the function for it to work properly:
leftChannel
forwardChannel
: The speed value used to control the left drive motorforward motion. Must be of the typeint8_t
(also calledsigned char
), so ranging[-128, 127]
.rightChannel
yawChannel
: The speed value used to control the right drive motorrotative motion. Must be of the typeint8_t
(also calledsigned char
), so ranging[-128, 127]
.leftMotor:
The name of the PWM pin to wich is connected the left motor. Must be of the typeunsigned char.
rightMotor
: The name of the PWM pin to wich is connected the right motor. Must be of the typeunsigned char
.
#2: Directly using remote controller joystick values, with 2 motors per side
static void Crc::CrcLib::MoveTankMoveArcade(ANALOG leftChannelforwardChannel, ANALOG rightChannelyawChannel, unsigned char frontLeftMotor, unsigned char backLeftMotor, unsigned char frontRightMotor, unsigned char backRightMotor)
The following parameters must be passed to the function for it to work properly:
leftChannel
forwardChannel
: The remote controller joystick channel speed value used to control the left drive motorsforward motion. Must be of the typeANALOG
.rightChannelyawChannel
: The remote controller joystick channel speed value used to control the right drive motorsrotative motion. Must be of the typeANALOG
.frontLeftMotor
: The name of the PWM pin to wich is connected the front left motor. Must be of the typeunsigned char
.backLeftMotor:
The name of the PWM pin to wich is connected the back left motor. Must be of the typeunsigned char
.frontRightMotor
: The name of the PWM pin to wich is connected the front right motor. Must be of the typeunsigned char
.backLeftMotor:
The name of the PWM pin to wich is connected the back right motor. Must be of the typeunsigned char
.
#3: Directly using remote controller joystick values, with only 1 motor per side
static void Crc::CrcLib::MoveTankMoveArcade(ANALOG leftChannelforwardChannel, ANALOG rightChannelyawChannel, unsigned char leftMotor, unsigned char rightMotor)
The following parameters must be passed to the function for it to work properly:
leftChannel
forwardChannel
: The remote controller joystick channel speed value used to control the left drive motorforward motion. Must be of the typeANALOG
.rightChannelyawChannel
: The remote controller joystick channel speed value used to control the right drive motorrotative motion. Must be of the typeANALOG
.leftMotor:
The name of the PWM pin to wich is connected the left motor. Must be of the typeunsigned char.
rightMotor
: The name of the PWM pin to wich is connected the right motor. Must be of the typeunsigned char
.
Examples
Expand | |||||
---|---|---|---|---|---|
| code|||||
|
More on this function
There is sadly nothing more to be said about this function…