Numerous Robot Malfunctions

Our new robot has decided it doesn’t want to work… There are many problems, which we have worked tirelessly and fruitlessly to find the causes of.

The first and foremost issue, our intake motors work fine in one direction, but if they try to move in the other direction, the move jerkily and weakly, stopping and starting sporadically. We tried rewriting our code, wiring the motors into different ports, using known working motors, and redownloading our cortex’s firmware, but the problem persisted. Then, we turned the wires around to that black went to red and red went to black, and the problem continued in the opposite of the direction it had been in before. We are utterly stumped.

We have problems with other parts of the robot. The arm motors, with no sacks loaded on the intake, stop and start every half second while moving up or down. We built this arm to have minimal friction, and we are using 393s that we know work. The arm is 15" long, the intake is light, and we’re using a 7:1 gear reduction.

We also have a wheel on our mecanum drive that refuses to move while we’re strafing right. It works fine moving forward, backward, and left strafing, but not strafing right.

Our cortex also has trouble connecting to VEXnet. Sometimes, all of the cortex lights are solid red, and sometimes the VEXnet light turns green and the other lights turn off. In both of these situations, the robot does not respond to the controllers.

We checked our wiring and it all seems to be in order. We have a brand new cortex, and we’re really hoping that it is not defective. We’re going to test with one of our other teams’ cortexes to see. Do you guys have any other theories?

Just in case it is the problem, could you post the code?

Also, did you try connecting the motors to the cortex without having them attached to your robot and just spinning them?

It sounds very much like a code issue to me. Would you mind posting your code? If you’d like it better, you could send me a PM with it so I could see if I can help you out.

~Jordan

Our new robot has decided it doesn’t want to work… ???

Sounds like you have a very smart robot. fantastic programming job. It can make decisions on its own. Thats awesome!!!

Definitely try a different cortex and some clean test code. Maybe detach your cortex, program all the ports to the same joystick and using a new motor test the ports one by one. That’s a good way to isolate the problem.

The code, copied directly from the ROBOTC file. The same drivetrain code worked fine during initial testing, and that part hasn’t been changed since then.

We used similar coding on our Gateway robot, and it (the code, at least) worked without fail.

This won’t work. Only button 5D will drive ports 5 & 6.

(ROBOTC is tolerant of this but you should also really use motor**…]** not motor(…) )

Edit:

Some alternative ways

int drive;

if( vexRT Btn5UXmtr2 ] )
    drive = 90;
else
if( vexRT Btn5DXmtr2 ] )
    drive = -90;
else
    drive = 0;
    
motor port5 ] = drive;
motor port6 ] = drive;

or

motor port5 ] = (vexRT Btn5UXmtr2 ] - vexRT Btn5DXmtr2 ]) * 90;
motor port6 ] = (vexRT Btn5UXmtr2 ] - vexRT Btn5DXmtr2 ]) * 90;

Thanks for the suggestions! However, we tried using “If” loops originally, and that was when the intake “jerking” was first observed.

EDIT: It would probably be helpful to tell you that ports 5 and 6 are the intake motors.

That still leaves the fact that your code as written will cause the behavior you describe. Give my suggestions a go, you may be surprised.

Yes, I figured that.

What is happening is you are setting your motor values to btn5U and then right after setting them to the value of btn5d. If btn5D isn’t pressed, the motor will not move (or will turn on for a split second and then turn off)

This makes sense.

We’ll implement the suggestions for the intake commands! Thanks, guys!

However, there is still the issue of the arm stopping and starting, and the front-right wheel strafing left but not strafing right. Any thoughts as to what might be causing these problems?

Is this the arm code?

motor(port10) = motor(port1) = vexRT[Ch3Xmtr2];
motor(port4) = vexRT[Ch2Xmtr2];
motor(port7) = vexRT[Ch2Xmtr2];

Two joystick channels for the arm? Is that what you intended?

Ports 4 and 7 are the arm, ports 1 and 10 are not important. Ignore them. :wink:

+1

I would suggest making it an if like jpearman suggests but using && so it says
if button5u==1&&button5d==0
do stuff
This will stop your motors from getting 90 and 0 power at the same time.

Okay, will do!

I would think two 393’s lifting a 15" arm with 7:1 gear reduction should be fine. Is one of the arm motors reversed in “Motors & sensors setup” ? or by (a habit I don’t like) wiring backwards, red motor wire to black MC29 wire, typically one would be or the motors will fight. Are any of the PTCs tripping? Do the motors sound like they are stalled when the arm stops?

There are many different ways to achieve this, the code I posted works without needing any changes, one decision when using buttons in this way, however, is what happens when both buttons are pressed, does one button have priority or should the motors be stopped in this situation.

Jpearman is absolutely right that his code would work because of the if and else which do the same thing for all intensive purposes. I was thinking for someone a little newer to programming the if else pair might be a little harder to grasp but ya it all really depends on which button to be more powerful.

edit: i only skimmed over his code and must have just missed the elses

We’ve used else pairs before, for our autonomous in Round Up.

Apply some of these suggestions and give a recap of the problems.

The intake works normally now. Thanks!

The other problems we’re still having are:
The front right wheel only spins at full speed in the backward direction. When we apply a control that would make the motor spin forward, it moves very slowly. This causes the robot to spin on that wheel when we’re trying to strafe right.

Our arm also quits randomly after several minutes of use.