Holonomic Base Programming trouble with vcs

I am new to vcs (vex coding studio) and i am trying to learn how to program a holomonic base. I had the driver control working (going forward, going backwards, and turning) , but I wanted to try to make it move diagonal (I am using the arrow buttons on the v5) the driver control no longer worked so I put the driver control into else if statements. Once I did that all of the driver control started driving weird, the wheels look like they are going to spin but they don’t until I release the button and they only do that for 1/2 a second. I decided then to comment out the new program and go back to the original program (just the joysticks) it works fine and I can not figure out what is wrong with the program.

#include “robot-config.h”
using namespace vex;
vex::controller Controller1 = vex::controller();

int main()
{
while(true)
{
/*BLeft.spin(directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis4.value() - Controller1.Axis1.value()), velocityUnits::pct);
FLeft.spin(directionType::fwd, (Controller1.Axis3.value() + Controller1.Axis4.value() + Controller1.Axis1.value()), velocityUnits::pct);
BRight.spin(directionType::fwd, (Controller1.Axis3.value() - Controller1.Axis4.value() + Controller1.Axis1.value()), velocityUnits::pct);
FRight.spin(directionType::fwd, (Controller1.Axis3.value() - Controller1.Axis4.value() - Controller1.Axis1.value()), velocityUnits::pct);
*/
if (Controller1.ButtonLeft.pressing() && Controller1.ButtonUp.pressing())
{
BLeft.rotateFor(90,rotationUnits::deg,50,velocityUnits::pct, false);
FRight.rotateFor(90,rotationUnits::deg,50,velocityUnits::pct, false);
}
else if (Controller1.ButtonLeft.pressing() && Controller1.ButtonDown.pressing())
{
FLeft.rotateFor(-90,rotationUnits::deg,50,velocityUnits::pct, false);
BRight.rotateFor(-90,rotationUnits::deg,50,velocityUnits::pct, false);
}
else if (Controller1.ButtonUp.pressing() && Controller1.ButtonRight.pressing())
{
FLeft.rotateFor(90,rotationUnits::deg,50,velocityUnits::pct, false);
BRight.rotateFor(90,rotationUnits::deg,50,velocityUnits::pct, false);
}
else if (Controller1.ButtonDown.pressing() && Controller1.ButtonRight.pressing())
{
FRight.rotateFor(-90,rotationUnits::deg,50,velocityUnits::pct, false);
BLeft.rotateFor(-90,rotationUnits::deg,50,velocityUnits::pct, false);
}
else if (Controller1.Axis3.value())
{
FLeft.rotateFor(90,rotationUnits::deg,50,velocityUnits::pct, false);
BLeft.rotateFor(90,rotationUnits::deg,50,velocityUnits::pct, false);
FRight.rotateFor(90,rotationUnits::deg,50,velocityUnits::pct, false);
BRight.rotateFor(90,rotationUnits::deg,50,velocityUnits::pct, false);
}
else if (Controller1.Axis1.value())
{
FLeft.rotateFor(90,rotationUnits::deg,50,velocityUnits::pct, false);
BLeft.rotateFor(90,rotationUnits::deg,50,velocityUnits::pct, false);
FRight.rotateFor(-90,rotationUnits::deg,50,velocityUnits::pct, false);
BRight.rotateFor(-90,rotationUnits::deg,50,velocityUnits::pct, false);
}
}
}

@Clara_Gehm the issue you are having is that you are using the rotateFor function. That is causing the movement for only 1/2 a sec. I would recommend using the spin function that you used. With the spin function if the motor is not being used set the speed to zero so you don’t have residual movement. Also, you could detect if only a single button is pressed for that direction just have those detections towards then end of the else if loop. This is because once the program comes across a true statement it will skip to the end of the last else if. I hope that makes sense and is helpful.
1069B - Argonauts

3 Likes

thank you so much for the help. We got the base working! :smile:

1 Like