Robot program runs only when not on the ground...?

We have an issue with trying to run our code where the robot won’t turn when it’s on the field/ground. However, if we lift up the robot and it isn’t touching the ground, the wheels will move just how it should and how it was programmed.

We had one instance where the robot could turn, but only when we wrote that line of code alone. When trying to add other lines such as going forward to it, it doesn’t turn anymore unless it’s not touching the ground (aka the robot is being held up).

Any solutions? Thank you!

Just to note, our robot turns fine during driver control. We have a four motor chassis, with omni wheels, 200 rpm motors, and a 3:5 gear train.
Here is our code if you’d like to take a look btw:

[quote=“rian, post:1, topic:98420, full:true”]
We have an issue with trying to run our code where when we try to run it, the robot won’t turn when it’s on the field. However, if we lift up the robot and it isn’t touching the ground, the wheels will move just how it should and how it was programmed.

We had one instance where the robot could turn, but only when we wrote that line of code alone. When trying to add other lines such as going forward to it, it doesn’t turn anymore unless it’s not touching the ground (aka the robot is being held up).

Any solutions? Thank you!

Just to note, our robot turns fine during driver control. We have a four motor chassis, with omni wheels, 200 rpm motors, and a 3:5 gear train.
Here is our code if you’d like to take a look btw:

/---------------------------------------------------------------------------/
/* Autonomous Task /
/
---------------------------------------------------------------------------*/

//global statements

void dt(int pos, int speed, bool stopping) {
bRight.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, false);
fRight.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, false);
fLeft.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, stopping);
bLeft.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, stopping);
}

void rd(int pos, int speed, bool stopping) {
bRight.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, false);
fRight.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, false);
}

void ld(int pos, int speed, bool stopping) {
bLeft.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, false);
fLeft.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, false);
}

void Arm(int pos, int speed, bool stopping) {
rarm.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, stopping);
larm.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, stopping);
}

//rotates the claw
void cm(int pos, int speed, bool stopping) {
Claw.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, stopping);
}

void bcm(int pos, int speed, bool stopping) {
bclaw.rotateFor(pos, rotationUnits::deg, speed, velocityUnits::pct, stopping);}

void autonomous(void) {
//TASK 1 - Dispenses the ring from the back claw
bcm(600, 80, true);
bcm(-600, 80, true);

//TASK 2 - Drives forward
dt(110, 90, true);

//TASK 3 - Turns left
ld(500, 70, false);
rd(-500, 70, false);

//TASK 4 - Drives Forward one block
dt(110, 50, true);

//TASK 5 - Turns Left to Reposition
ld(500, 95, false);
rd(-500, 50, false);

//TASK 6 - Zooms across the field

dt(2300, 110, true);

//TASK 7 - Dispenses ring from front claw
dt(90, 20, true);
cm(450, 80, true);

//TASK 8 - Drives out of the awl

dt(-350, 100, true);

wait(20, msec);

}

Read topic about the blocking and non-blocking function. Your issue is “wait for completion ”

4 Likes