At our practice rounds today, we had a bit of an issue with some of our autonomous mode code working, and I’m wondering if maybe any of you can help me out with how this could be happening.
OK, here goes. Our robot has the capability to do two different things during autonomous mode. It can either seek boxes, for which it uses light sensors and a thing we made to count wheel rotations, or go up the ramp, which is based entirely on wheel rotations. There are two on/off switches on the robot that tell it what to do during autonomous mode. These switches are set by the people who put the robot on the field at the start of the match. One switch (rc_sw10) tells the robot which side of the field it is on, and the other (rc_sw14) tells the robot which program to use (Go up ramp when 0, seek boxes when 1). Now, both of these modes worked fine when we practiced at Rockwell Automation, where we work on the robot.
We got to competition today, and during practice had 3 chances to test out autonomous mode. We tried box seeking mode 3 times, and it successfully knocked down the opponent’s big stacks, but when we had the switch flipped to try going up the ramp, nothing happened at all during autonomous mode. After this, back in the pits, I sat the robot on a box and used our autonomous mode dongle to test these modes. Both appeared to be cause motion when using the dongle on the competition port, but for some reason, the robot did not do anything when it was told to use the ramp program and was in an actual practice round connected through FIRST’s radios, instead of a tether. So, my question is what could be causing one of these two parts of autonomous mode not to be working? Is there something different about the way a competition port dongle and tells the robot through the tether that we are in autonomous mode than when we hook up to the FIRST competition port on the field tells the robot through the radio? I spoke with Eric Rasmussen from FIRST about this at the event, and he thought maybe it could have to do with the fact that on the field, the competition port also enables and disables the robot in addition to changing the autonomous mode state, and that the order that this happens in could be messing it up, but, after looking at my code, I don’t really think that is it, though I may be just missing something (It happens a lot ). here is some of the code:
OK, first we have the section that tells the robot whether or not to do box seeking, then the section that tells it whether or not to go up the ramp. here is what it looks like:
If auton_mode = 0 or rc_sw14 = 0 then skip_box_seek:
(box seeking code here)
skip_box_seek:
If auton_mode = 0 or rc_sw14 = 1 then skip_up_ramp:
(code to drive up the ramp here)
skip_up_ramp:
I don’t think those middle parts should matter too much, since really the problem seems to be with how the robot enters autonomous mode, and since the program is actually on another computer next to me that I am looking at and then retyping here, it’s not worth the time to retype all of it. At any rate, none of that stuff considers the auton_mode bit at all anyway. I’m pretty stumped at what could be causing this (though I really can’t claim to be any type of a programming god), so please let me know if you have any idea. Also, please forgive the length of this post :). Thanks.
–Chris C.