Purpose
Easily implement a Tank style drive for a mobile robot.
When to use
If you have a Tank styled drive system configuration, where a signal controls right side motors another one controls controls left side motors.
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 parametersObjectif
Facilement ajouter un contrôle de style « tank » à votre base de robot.
Quand l’utiliser
Si vous avez une base de robot en configuration « tank », où un signal contrôle les moteurs du côté droit et un autre les moteurs du côté gauche.
Où l’utiliser
Dans la partie void loop()
de votre fichier .ino
, puisqu’il faut qu’elle soit appelée en boucle le plus rapidement possible.
Note |
---|
Cette fonction requiert l’utilisation des fonctions suivantes dans votre programme: |
Valeur de retour
Cette fonction ne retourne aucune valeur après avoir exécuté ses tâches.
Prototype principal
static void CrcLib::MoveTank(int8_t leftChannel, int8_t rightChannel, 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
: The speed value used to control the left drive motor. Must be of the Les paramètres suivants sont requis par la fonction:
leftChannel
: La vitesse à laquelle les moteurs gauches devrait aller. De typeint8_t
(also called aussi appelésigned char
), so ranging [soit entre -128 , et 127].rightChannel
: The speed value used to control the right drive motor. Must be of the La vitesse à laquelle les moteurs droits devrait aller. De typeint8_t
(also called aussi appelésigned char
), so ranging [soit entre -128 , et 127].frontLeftMotor
: The name of the PWM pin to wich is connected the front left motor. Must be of the typeunsigned char
Le port PWM auquel est connecté le moteur avant gauche.backLeftMotor
: The name of the PWM pin to wich is connected the back left motor. Must be of the typeunsigned char
Le port PWM auquel est connecté le moteur arrière gauche.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
Le port PWM auquel est connecté le moteur avant droit.backRightMotor
: Le port PWM auquel est connecté le moteur arrière droit.
Overloads
#1: Using only one motor per sideUn seul moteur par côté
static void CrcLib::MoveTank(int8_t leftChannel, int8_t rightChannel, unsigned char leftMotor, unsigned char rightMotor)
The following parameters must be passed to the function for it to work properly:
leftChannel
: The speed value used to control the left drive motor. Must be of the Les paramètres suivants sont requis par la fonction:
leftChannel
: La vitesse à laquelle les moteurs gauches devrait aller. De typeint8_t
(also called aussi appelésigned char
), so ranging [soit entre -128 , et 127].rightChannel
: The speed value used to control the right drive motor. Must be of the La vitesse à laquelle les moteurs droits devrait aller. De typeint8_t
(also called aussi appelésigned char
), so ranging [soit entre -128 , et 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
.
Le port PWM auquel est connecté le moteur gauche.
rightMotor
: Le port PWM auquel est connecté le moteur droit.
#2: Utiliser directement les valeurs de la manettes, 2 moteurs par côté
static void CrcLib::MoveTank(ANALOG leftChannel, ANALOG rightChannel, 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 properlyLes paramètres suivants sont requis par la fonction:
leftChannel
: The remote controller joystick channel used to control the left drive motors. Must be of the typeANALOG
.rightChannel
:The remote controller joystick channel used to control the right drive motors. 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
.
Le « channel » de joystick à utiliser pour contrôler les moteurs gauches. De type
ANALOG
(voir CrcLib: accéder aux boutons de la télécommande )rightChannel
: Le « channel » de joystick à utiliser pour contrôler les moteurs droits. De typeANALOG
(voir CrcLib: accéder aux boutons de la télécommande )frontLeftMotor
: Le port PWM auquel est connecté le moteur avant gauche.backLeftMotor
: Le port PWM auquel est connecté le moteur arrière gauche.frontRightMotor
: Le port PWM auquel est connecté le moteur avant droit.backRightMotor
: Le port PWM auquel est connecté le moteur arrière droit.
#3: Utiliser directement les valeurs de la manettes, 1 seul moteur par côté
static void CrcLib::MoveTank(ANALOG leftChannel, ANALOG rightChannel, unsigned char leftMotor, unsigned char rightMotor)
The following parameters must be passed to the function for it to work properlyLes paramètres suivants sont requis par la fonction:
leftChannel
: The remote controller joystick channel used to control the left drive motor. Must be of the typeANALOG
.rightChannel:
The remote controller joystick channel used to control the right drive motor. 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
.
Le « channel » de joystick à utiliser pour contrôler les moteurs gauches. De type
ANALOG
(voir CrcLib: accéder aux boutons de la télécommande )rightChannel
: Le « channel » de joystick à utiliser pour contrôler les moteurs droits. De typeANALOG
(voir CrcLib: accéder aux boutons de la télécommande )leftMotor
: Le port PWM auquel est connecté le moteur gauche.rightMotor
: Le port PWM auquel est connecté le moteur droit.
Exemples
Expand | |||||
---|---|---|---|---|---|
| |||||
|
More on this function
There is sadly nothing more to be said about this function…
Related articlesArticles reliés
Filter by label (Content by label) | ||||||
---|---|---|---|---|---|---|
|