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?
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.
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)
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
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.