MoveHolonomic() {FR}
Purpose
Easily implement a Holonomic style drive for a mobile robot that uses 4 omnidirectional drive wheels.
When to use
If you have a Holonomic styled drive system configuration, where a signal controls forward/backward motion, another controls left/right 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.
This function requires the use of the following functions at some point of your .ino
file in order to work properly:
Returns
This function does not return a value once it has completed its tasks.
Main prototype and parameters
static void CrcLib::MoveHolonomic(int8_t forwardChannel, int8_t yawChannel, int8_t strafeChannel, 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:
forwardChannel
: The speed value used to control the forward/backward motion. Must be of the typeint8_t
(also calledsigned char
), so ranging[-128, 127]
.yawChannel
: The speed value used to control left/right motion. Must be of the typeint8_t
(also calledsigned char
), so ranging[-128, 127]
.strafeChannel
: The speed value used to control the rotative 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: Directly using remote controller joystick values
static void CrcLib::MoveHolonomic(ANALOG forwardChannel, ANALOG yawChannel, ANALOG strafeChannel, 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:
forwardChannel
: The speed value used to control the forward motion. Must be of the typeANALOG
.yawChannel
: The speed value used to control left/right motion. Must be of the typeANALOG
.strafeChannel
: The speed value used to control rotative 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
.backRightMotor
:The name of the PWM pin to wich is connected the back right motor. Must be of the typeunsigned char
.
Examples
More on this function
There is sadly nothing more to be said about this function…