Purpose
Easily implement an Arcade style drive for a mobile robot.
When to use
If you have an Arcade styled drive system configuration, where a signal controls forward/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 parametersObjectif
Facilement ajouter un contôle style « arcade » à votre base de robot.
Quand l’utiliser
Si vous avez une base de robot en configuration « arcade », où un signal contrôle le mouvement avant/arrière et un second la rotation.
Où l’utiliser
Dans la section 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::MoveArcade(int8_t forwardChannel, int8_t yawChannel, 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:
forwardChannel
: The speed value used to control the forward/backward motion. Must be of the La vitesse à laquelle le robot devrait avancer/reculer. De typeint8_t
(also called aussi appelésigned char
), so ranging [soit entre -128 , et 127].yawChannel
: The speed value used to control rotative motion. Must be of the La vitesse à laquelle robot devrait tourner. 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
.
Overloads
#1: Using only one motor per sideLe port PWM auquel est connecté le moteur avant droit.
backRightMotor
: Le port PWM auquel est connecté le moteur arrière droit.
Overloads
#1: Un seul moteur par côté
static void CrcLib::MoveArcade(int8_t forwardChannel, int8_t yawChannel, 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:
forwardChannel
: The speed value used to control the forward/backward motion. Must be of the La vitesse à laquelle le robot devrait avancer/reculer. De typeint8_t
(also called aussi appelésigned char
), so ranging [soit entre -128 , et 127].yawChannel
: The speed value used to control rotative motion. Must be of the La vitesse à laquelle robot devrait tourner. 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::MoveArcade(ANALOG forwardChannel, ANALOG yawChannel, 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 typeANALOG
.yawChannel
: 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
.
#3: Directly using remote controller joystick values, with only 1 motor per sideLes paramètres suivants sont requis par la fonction:
forwardChannel
: Le « channel » de joystick à utiliser pour contrôler la vitesse avant/arrière. De typeANALOG
(voir CrcLib: accéder aux boutons de la télécommande)yawChannel
: Le « channel » de joystick à utiliser pour contrôler la vitesse de rotation. 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::MoveArcade(ANALOG forwardChannel, ANALOG yawChannel, unsigned char leftMotor, unsigned char rightMotor)
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 typeANALOG
.yawChannel
: The speed value used to control rotative motion. Must be of the typeANALOG
.leftMotor
:he 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
Les paramètres suivants sont requis par la fonction:
forwardChannel
: Le « channel » de joystick à utiliser pour contrôler la vitesse avant/arrière. De typeANALOG
(voir CrcLib: accéder aux boutons de la télécommande)yawChannel
: Le « channel » de joystick à utiliser pour contrôler la vitesse de rotation. 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) | ||||||
---|---|---|---|---|---|---|
|