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);
}
}
}