I hope everyone is making great progress on their robots! My team has finished building, but we are now struggling with the autonomous. We’ve transitioned to V5 and Vex Coding Studio so it’s a pretty new coding experience for us. Could anyone share their autonomous to help us out, or even give suggestions on how to make ours work? We have been trying to set up a function that rotates each motor to a value specified by a variable, but it is proving to be quite a challenge. Any help is appreciated, thank you all so much!!
If you want AutoVals to set the values of the other variables you need a function to do that.
Something like this (which would replace your AutoVals)
void setVals(float time, float LD, float RD, float lift, float FClaw, float GClaw, float puncher){
TimeVal = time;
LDMotorPow = LD;
RDMotorPow = RD;
LiftMotorsPow = lift;
FClawMotorPow = FClaw;
GClawMotorPow = GClaw;
PuncherMotorPow = puncher;
}
or you could build it into the Drive function
void Drive(float time, float LD, float RD, float lift, float FClaw, float GClaw, float puncher){
RDMotor.rotateFor(time, vex::timeUnits::sec, RD, vex::velocityUnits::pct);
LDMotor.rotateFor(time, vex::timeUnits::sec, LD, vex::velocityUnits::pct);
LiftMotor1.rotateFor(time, vex::timeUnits::sec, lift, vex::velocityUnits::pct);
LiftMotor2.rotateFor(time, vex::timeUnits::sec, lift, vex::velocityUnits::pct);
FClawMotor.rotateFor(time, vex::timeUnits::sec, FClaw, vex::velocityUnits::pct);
GClawMotor.rotateFor(time, vex::timeUnits::sec, GClaw, vex::velocityUnits::pct);
PunchMotor.rotateFor(time, vex::timeUnits::sec, puncher, vex::velocityUnits::pct);
}
Also when you call a function you need to put parentheses after them
instead of
Drive;
Reset;
it would be
Drive();
Reset();
it might also be a good idea to break it into differnt functions i.e
Drive()
would just drive and
Lift()
would move the lift etc.
and I would use the sensors instead of time
Thanks so much for your help! We have a tournament this weekend and have been struggling to solve this problem, but now we may have a working autonomous
@eggplant, do you know how to code the autonomous voids but instead of using time use encoder ticks?