Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

Version 1 Current »

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 Crc::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 type int8_t (also called signed char), so ranging [-128, 127].

  • yawChannel: The speed value used to control left/right motion. Must be of the type int8_t (also called signed char), so ranging [-128, 127].

  • strafeChannel: The speed value used to control the rotative motion. Must be of the type int8_t (also called signed char), so ranging [-128, 127].

  • frontLeftMotor: The name of the PWM pin to wich is connected the front left motor. Must be of the type unsigned char.

  • backLeftMotor:The name of the PWM pin to wich is connected the back left motor. Must be of the type unsigned char.

  • frontRightMotor: The name of the PWM pin to wich is connected the front right motor. Must be of the type unsigned char.

  • backLeftMotor:The name of the PWM pin to wich is connected the back right motor. Must be of the type unsigned char.

Overloads

#1: Directly using remote controller joystick values

static void Crc::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 type ANALOG.

  • yawChannel: The speed value used to control left/right motion. Must be of the type ANALOG.

  • strafeChannel: The speed value used to control rotative motion. Must be of the type ANALOG.

  • frontLeftMotor: The name of the PWM pin to wich is connected the front left motor. Must be of the type unsigned char.

  • backLeftMotor:The name of the PWM pin to wich is connected the back left motor. Must be of the type unsigned char.

  • frontRightMotor: The name of the PWM pin to wich is connected the front right motor. Must be of the type unsigned char.

  • backRightMotor:The name of the PWM pin to wich is connected the back right motor. Must be of the type unsigned char.

Examples

 #1 We want to control 4 power motors, part of an Holonomic style drive system, controlled via motor controllers connected to PWM Port #1, #2, #3 and #4. We want the forward/backward movement to be directly controlled using the vertical axis of the left joystick, the left/right movement to be directly controlled using the horizontal axis of the left joystick and the rotative motion to be directly controlled using the horizontal axis of the right joystick on the remote controller connected via a CrcConnect module.
#include <CrcLib.h>

using namespace Crc;

void setup() {
    CrcLib::Initialize();

    CrcLib::InitializePwmOutput(CRC_PWM_1);
    CrcLib::InitializePwmOutput(CRC_PWM_2);
    CrcLib::InitializePwmOutput(CRC_PWM_3);
    CrcLib::InitializePwmOutput(CRC_PWM_4);
    
    /* 
    The rest of your setup code
    ...
     */
}
void loop() {
    CrcLib::Update();

    CrcLib::MoveHolonomic(ANALOG::JOYSTICK1_Y, ANALOG::JOYSTICK1_X, ANALOG::JOYSTICK2_X, CRC_PWM_1, CRC_PWM_2, CRC_PWM_3, CRC_PWM_4);
    
    /* 
    The rest of your looping code
    ...
    */
}

More on this function

There is sadly nothing more to be said about this function…

Articles liés

  • No labels

0 Comments

You are not logged in. Any changes you make will be marked as anonymous. You may want to Log In if you already have an account.