So I am trying to make a holonomic base, but there is problems

Heres the code, if you notice anything please tell me
int main() {
while (true) {
LeftFrontDrive.setStopping(hold);
RightFrontDrive.setStopping(hold);
RightRearDrive.setStopping(hold);
LeftRearDrive.setStopping(hold);

if ((Controller1.Axis1.position()<5) && (Controller1.Axis1.position()>-5)) {

LeftFrontDrive.setVelocity((Controller1.Axis4.position()+Controller1.Axis3.position()+Controller1.Axis2.position()), percent);
RightFrontDrive.setVelocity((Controller1.Axis4.position()-Controller1.Axis3.position()+Controller1.Axis2.position()), percent);
LeftRearDrive.setVelocity((Controller1.Axis3.position()-Controller1.Axis4.position()+Controller1.Axis2.position()), percent);
RightRearDrive.setVelocity((Controller1.Axis2.position()-Controller1.Axis4.position()-Controller1.Axis3.position()), percent);

LeftFrontDrive.spin(forward);
RightFrontDrive.spin(forward);
RightRearDrive.spin(forward);
LeftRearDrive.spin(forward);

wait(.1,seconds);
}
else{
LeftFrontDrive.stop();
RightFrontDrive.stop();
LeftRearDrive.stop();
RightRearDrive.stop();
}

}
}

I’m mostly sure the controller axis is from 0-100, this locks the robot.

My team uses this

 //Drivetrain Control
    Rfront.setVelocity(double(Controller1.Axis2.position() - (Controller1.Axis1.position() + Controller1.Axis4.position()/2)), percent);
    Lfront.setVelocity(double(Controller1.Axis2.position() + (Controller1.Axis1.position() + Controller1.Axis4.position()/2)), percent);
    Rback.setVelocity(double(Controller1.Axis2.position() + (Controller1.Axis1.position() - Controller1.Axis4.position()/2)), percent);
    Lback.setVelocity(double(Controller1.Axis2.position() - (Controller1.Axis1.position() - Controller1.Axis4.position()/2)), percent);
    Rfront.spin(forward);
    Lfront.spin(forward);
    Rback.spin(forward);
    Lback.spin(forward);
1 Like

Lots of issues. First. Please format your code properly.

This means that your code will only work if Axis 1 is in between -5 and 5. The full range of the controller is -100 to 100. Also, this format of dead zone does work well with holonomic so I would just get rid of it and reintegrate it later if you want.

This isn’t your issue, but .1 sec is too long. That will have noticeable delay. I usually go with only 0.01 sec.

5 Likes

Thank you all for the info! I will try and implement this advice into my program. I’ll get back to you when I can!