Mexhanum wheel spin strafe

So I made a little coding robot to learn to code mechanum wheels, and with the help of the amazing people of this forum I was able to get it to work with little to no problem
but I am wandering how to spin strafe. It looks super cool and after a lot of fiddling around I still can’t figure out how to do it. Anyone know how?

I think what you are referencing is swing turns(correct me if I am wrong). This will be difficult to with mechanum wheels but the general idea is spinning 2 of the wheels faster than the other two. If I am not wrong, I believe this would be the diagonal wheels? if not, the rear ones. I don’t really know more than that.

1 Like

attached it my entire code for mecanum
the 4 buttons do speed let me know any questions

/*----------------------------------------------------------------------------*/

/* /
/
Module: main.cpp /
/
Author: ddd /
/
Created: Tue Nov 03 2020 /
/
Description: V5 project /
/
/
/
----------------------------------------------------------------------------*/

// ---- START VEXCODE CONFIGURED DEVICES ----
// Robot Configuration:
// [Name] [Type] [Port(s)]
// Controller1 controller
// BackLeft motor 1
// BackRight motor 10
// FrontRight motor 3
// FrontLeft motor 9
// ---- END VEXCODE CONFIGURED DEVICES ----

#include “vex.h”
using namespace vex;
/float speed;
float speed2;
float speed3;
float speed4;
/

void speed2()
{

FrontRight.spin(directionType::fwd,((Controller1.Axis3.value() - Controller1.Axis1.value()- Controller1.Axis4.value())*2),velocityUnits::rpm);  
BackRight.spin(directionType::fwd,((Controller1.Axis3.value() - Controller1.Axis1.value()+ Controller1.Axis4.value())*2),velocityUnits::rpm);
FrontLeft.spin(directionType::fwd,((Controller1.Axis3.value() + Controller1.Axis1.value()+ Controller1.Axis4.value())*2),velocityUnits::rpm);
BackLeft.spin(directionType::fwd,((Controller1.Axis3.value() + Controller1.Axis1.value()- Controller1.Axis4.value())*2),velocityUnits::rpm);

}
void speed4()
{
FrontRight.spin(directionType::fwd,((Controller1.Axis3.value() - Controller1.Axis1.value()- Controller1.Axis4.value())*4),velocityUnits::rpm);
BackRight.spin(directionType::fwd,((Controller1.Axis3.value() - Controller1.Axis1.value()+ Controller1.Axis4.value())*4),velocityUnits::rpm);
FrontLeft.spin(directionType::fwd,((Controller1.Axis3.value() + Controller1.Axis1.value()+ Controller1.Axis4.value())*4),velocityUnits::rpm);
BackLeft.spin(directionType::fwd,((Controller1.Axis3.value() + Controller1.Axis1.value()- Controller1.Axis4.value())*4),velocityUnits::rpm);
}

void slow2()
{
FrontRight.spin(directionType::fwd,((Controller1.Axis3.value() - Controller1.Axis1.value()- Controller1.Axis4.value())/2),velocityUnits::rpm);
BackRight.spin(directionType::fwd,((Controller1.Axis3.value() - Controller1.Axis1.value()+ Controller1.Axis4.value())/2),velocityUnits::rpm);
FrontLeft.spin(directionType::fwd,((Controller1.Axis3.value() + Controller1.Axis1.value()+ Controller1.Axis4.value())/2),velocityUnits::rpm);
BackLeft.spin(directionType::fwd,((Controller1.Axis3.value() + Controller1.Axis1.value()- Controller1.Axis4.value())/2),velocityUnits::rpm);
}

void slow4()
{ FrontRight.spin(directionType::fwd,((Controller1.Axis3.value() - Controller1.Axis1.value()- Controller1.Axis4.value())/4),velocityUnits::rpm);
BackRight.spin(directionType::fwd,((Controller1.Axis3.value() - Controller1.Axis1.value()+ Controller1.Axis4.value())/4),velocityUnits::rpm);
FrontLeft.spin(directionType::fwd,((Controller1.Axis3.value() + Controller1.Axis1.value()+ Controller1.Axis4.value())/4),velocityUnits::rpm);
BackLeft.spin(directionType::fwd,((Controller1.Axis3.value() + Controller1.Axis1.value()- Controller1.Axis4.value())/4),velocityUnits::rpm);
}

int main() {
// Initializing Robot Configuration. DO NOT REMOVE!
vexcodeInit();
while(true) {

if(Controller1.ButtonX.pressing())
{
speed4();
}
if(Controller1.ButtonY.pressing())
{
slow2();
}
if(Controller1.ButtonB.pressing())
{
slow4();
}
if(Controller1.ButtonA.pressing())
{
speed2();
}

FrontRight.spin(directionType::fwd,((Controller1.Axis3.value() - Controller1.Axis1.value()- Controller1.Axis4.value())),velocityUnits::rpm);  
BackRight.spin(directionType::fwd,((Controller1.Axis3.value() - Controller1.Axis1.value()+ Controller1.Axis4.value())),velocityUnits::rpm);
FrontLeft.spin(directionType::fwd,((Controller1.Axis3.value() + Controller1.Axis1.value()+ Controller1.Axis4.value())),velocityUnits::rpm);
BackLeft.spin(directionType::fwd,((Controller1.Axis3.value() + Controller1.Axis1.value()- Controller1.Axis4.value())),velocityUnits::rpm);

}
}

1 Like

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.