Vex EXP robot responding differently

Hey Everyone,

I am a first year teacher in robotics with the VEX EXP that we just purchased. I have my class doing a challenge where they need to pick up balls and set them on four different tables of various heights within a 4x8 arena. I had one student that was almost done, the robot was consistently setting the ball on three of the four tables, he just needed to code the last table. However, he decided to change the height that the arm lowers at the second table because he was going down a bit too low. With only changing the arm travel in his code, the robot is now not traveling the same distances that it was before, both to table one and tables coded after the arm height change. These distances shouldn’t have anything to do with the armCode. Another student is making comments about large inconsistency in what the robot chooses to do as well. This is making it very frustrating for them to try and program the robots. Any suggestions?

Without seeing the code, it is very difficult to comment. Can you post thw code here?

3 Likes

I actually can’t because the student changed it all. However, I do have another issue going on. Student has the following code. The Robot performs up until the line 106 and just stops. It doesn’t reverse. We have tried re downloading the program but it didn’t make a difference. I will try to copy and paste the way someone mentioned with the CODE]/CODE] but it doesn’t seem to be working

CODE] // Include the VEX Library

#include “vex.h”

// Allows for easier use of the VEX Library

using namespace vex;

int main() {

/*

armMotor.setStopping(hold);

armMotor.setTimeout(5, seconds);

armMotor.spinToPosition(480, degrees);

armMotor.setStopping(hold);

armMotor.setTimeout(5, seconds);

armMotor.spinToPosition(180, degrees);

wait(2, seconds);

armMotor.spinToPosition(480, degrees);

*/

/*

clawMotor.setStopping(coast);

clawMotor.setMaxTorque(30, percent);

clawMotor.spinToPosition(90, degrees);

clawMotor.spinToPosition(-90, degrees);

*/

Drivetrain.driveFor(forward, 850, mm);

wait(2, seconds);

Drivetrain.turnToHeading(275, degrees);

Drivetrain.driveFor(forward, 70, mm);

wait(2, seconds);

clawMotor.setStopping(hold);

clawMotor.setMaxTorque(35, percent);

clawMotor.spinToPosition(90, degrees);

wait(1, seconds);

armMotor.spinToPosition(470, degrees);

//back up

Drivetrain.turnToHeading(0, degrees);

Drivetrain.driveFor(forward, 980, mm);

wait(1, seconds);

clawMotor.spinToPosition(-90, degrees);

This is where the code stops and doesn’t continue

Drivetrain.driveFor(reverse, 970, mm);

armMotor.spinToPosition(0, degrees);

wait(1, seconds);

Drivetrain.turnToHeading(275, degrees);

Drivetrain.driveFor(forward, 70, mm);

wait(1, seconds);

clawMotor.setStopping(hold);

clawMotor.setMaxTorque(35, percent);

clawMotor.spinToPosition(90, degrees);

wait(1, seconds);

armMotor.spinToPosition(230, degrees);

}/CODE]

I think I figured it out right after I posted. He doesn’t have a set stopping for the claw so it is still trying to get to -90.


#include “vex.h”

// Allows for easier use of the VEX Library

using namespace vex;

int main() {

/*

armMotor.setStopping(hold);

armMotor.setTimeout(5, seconds);

armMotor.spinToPosition(480, degrees);

armMotor.setStopping(hold);

armMotor.setTimeout(5, seconds);

armMotor.spinToPosition(180, degrees);

wait(2, seconds);

armMotor.spinToPosition(480, degrees);

*/

/*

clawMotor.setStopping(coast);

clawMotor.setMaxTorque(30, percent);

clawMotor.spinToPosition(90, degrees);

clawMotor.spinToPosition(-90, degrees);

*/

Drivetrain.driveFor(forward, 850, mm);

wait(2, seconds);

Drivetrain.turnToHeading(275, degrees);

Drivetrain.driveFor(forward, 70, mm);

wait(2, seconds);

clawMotor.setStopping(hold);

clawMotor.setMaxTorque(35, percent);

clawMotor.spinToPosition(90, degrees);

wait(1, seconds);

armMotor.spinToPosition(470, degrees);

//back up

Drivetrain.turnToHeading(0, degrees);

Drivetrain.driveFor(forward, 980, mm);

wait(1, seconds);

clawMotor.spinToPosition(-90, degrees);

This is where the code stops and doesn’t continue

Drivetrain.driveFor(reverse, 970, mm);

armMotor.spinToPosition(0, degrees);

wait(1, seconds);

Drivetrain.turnToHeading(275, degrees);

Drivetrain.driveFor(forward, 70, mm);

wait(1, seconds);

clawMotor.setStopping(hold);

clawMotor.setMaxTorque(35, percent);

clawMotor.spinToPosition(90, degrees);

wait(1, seconds);

armMotor.spinToPosition(230, degrees); ```

@Joeagles Did you work out where the issue was? Where exactly in the code is the student not seeing the behaviour they expect?
Sometimes, this may be because the code is asking a motor to move to a position that it cannot achieve. Since some of these commands are “blocking” (i.e. the program won’t move past that line of code until it is complete), it can seem like other parts of the code aren’t working.

Debugging by printing information to the screen is useful here. For example, before an arm moves up or a claw opens, you could print something like “Arm UP started…” and then after the line of code that moves the arm, you could put “Arm UP complete.” so that you know the program has completed that arm movement as expected.

You can use the set timeout command for a motor using
armMotor.setTimeout(2, seconds);

In this case, if the arm got stuck, after 2 seconds the program would move on to the next instruction, regardless of if the arm reached it’s target or not.

1 Like

Hey calvc01,

Thanks for the reply. I haven’t had a chance to try it over the weekend but, after I posted this question, I did notice that the student didn’t have the setTimeout command in his code. I’m pretty sure that is his problem.