Check My Code

My team is competing in the long island regional next week, and we want to make sure our autonomous works. I have attached my code, and hope that anyone can look it over and tell me if I need to fix some things. A question i have is how to make a motor run for certain amounts of time, especially a relay. I put a wait function in these sections in the code, figuring that is what i need, but am unsure. Most of my questions/concerns are in the code itself, so please read all the text boxes i have added.
Basically what we want is the robot to follow the line, then raise the arm, drive forward, lower the arm for a slight period of time, then backup.

Thanks for the help in advanced.

Arcade Drive Autnomous FINAL.vi (15.7 KB)


Arcade Drive Autnomous FINAL.vi (15.7 KB)

I have three quick comments.

First, you don’t need to use that “At T” local variable. You can just wire the value out of the first while loop into the beginning of your flat sequence. That way, the sequence will not run until the line-following loop ends and provides a value.

Second, it’s really easy to have a relay hold a value for a certain amount of time. Since relays don’t have motor safeties to shut them down if you don’t keep setting them every so often, just put the Relay Set and a Wait function next to each other in the sequence frame. That frame will not finish until the Wait time has elapsed, and you can put another Relay Set in the next frame to turn it off.

Finally, the motor safeties make it not so easy to do the same thing for your drive motors. You can turn off the safety and try it that way, or you can try to adapt something Greg McKaskle posted a while back.

Hey Alan,
Thanks for the help. I went with your advice of disabling the drive safety and putting wait functions in. I didn’t really want to use greg’s method as great as it is, because it would have gotten pretty confusing for me, and the other method seemed simplier in my mind. I have attached my new version, if you can just take a glance at it. Thanks again.

Jared

Arcade Drive Autnomous with correct timing.vi (27.4 KB)


Arcade Drive Autnomous with correct timing.vi (27.4 KB)

At first glance, it seems okay. A deeper look reveals a couple of things I would have done differently, such as getting the Arm relay reference only once and passing the reference through the sequence to each relay set function, but that’s not a major issue. I’m also a little concerned that you might not be driving your motors hard enough, with 0.3 seeming a little low.

Yeah, i guess it would be a smart idea to increase the speed and decrease the time. I set it low to avoid it driving into the wall, but your thought seems valid. Thanks

Alan,
I have recently seen the video posted herehttp://www.chiefdelphi.com/forums/showthread.php?t=93404 by team 1678. I have been thinking about it, and think it could be useful for our robot. Are they just simply taking the line following code from autonomous, and copying it into a case structure in teleop attached to a button? Or is there more to it then what i believe?

Ask someone on 1678 about their code. It’s obviously not exactly the same as the default autonomous line tracking, as theirs begins by driving forward rather than turning to find the line.