My program is doing random things the night before a competition!! My team did not realize this until really close to competition time. They stayed for a while longer so we could figure it out. At the time, our lift was not working. When we would press the button to lift it, it would just move forever. As a programmer on the team, my teammate and I thought that maybe it was just a while loop that did not need to be there. We checked the code over and over and did not find any errors. A member on my team then pointed out that I should check an earlier version of my code that worked and compare it with the newer version. So I grabbed his flash drive and loaded the code up. It worked. The arms lifted like normal. I and my programming teammate wanted to see what we did wrong so we checked the code. It looked the same to us so, thinking that we did not check thoroughly enough, compared the code line by line. To our astonishment, it was exactly the same. We then checked for potential things around that code that could have been causing errors, and we found nothing. The working, older version had not changed much from the newer version, with the exception of a few functions that had nothing to do with the lift. We could not figure out the problem so we just transferred all of the new changes to the old version and stuck with that. Later on, we were driving our robot and when we lifted the arms, the same thing happened again! They moved upward infinitely! This was frustrating as all of the code we moved over did nothing to interfere with our lift. We even checked the code over again. We decided to put that aside because we had more important things to work on such as autonomous, skills autonomous, and drive practice. Eventually, I was able to get it fixed but now I have new problems. And the reason I went out of my way to tell that was to show that there are no problems with my code. This is really frustrating because now the arms are doing random things. They are going up when the blocks come in and force them up, even when I have them on brakeType::hold
. once they move up, you cannot get them back down, even by forcing it. also, my depositing function is giving me problems too. despite telling it to rotate to a specific position, it randomly moves to different positions every time I restart the program and do it again. I have not changed my code since the working version and they are still doing random things. I do have some clues though. For every USB cable, I plug into the computer, it eventually malfunctions, and as a result I end up downloading code and then it disconnects while downloading. Do you think it is a USB error? other than that, I do not know what is going on
Could you post the code? That would help us identify the issue.
Edit: This sounds very similar to a coding issue I had in turning point with tasks
That’s what I was trying to say above and trust me, there is no code issues
Just out of curiosity, I want to check over your code before assuming it’s a mechanical problem. Would you mind sending your code? If you don’t want to make it public, you could just dm me. I think your issue may be something that could compromise more advanced features of your code so before I start making those public, I’d want a look.
Although there may not be a coding error, there may be a logic error. (code runs fine but not as intended) The problem I had in turning point was I turned the motor off in one task but another that I didn’t realize hadn’t finished redefined it as on.
This definitely sounds like a logic error between versions. You might have to check every line, errors like that don’t have to be localized to wherever you intended the lift code to be.
the motors don’t know absolute position. When you restart the program the motors are in a different position so it’ll try to go somewhere else.
Yes but the motors were at the same starting position every time I restarted the program
There are always “some” code issues, why don’t you post it and see if we can make suggestions.
Yeah, this isn’t something mechanical, maby you just set the degree your going too too high
I fixed the problem, it was that rotateTo is always set to “true”. So for some reason, the motor wasn’t reaching its set value and was freezing all code. To fix it, we just added “false” after the velocityUnits in the rotateTo call and it fixed it.