Thread: Autonomous
View Single Post
  #5   Spotlight this post!  
Unread 02-15-2016, 10:53 PM
alexusaywla alexusaywla is offline
Registered User
AKA: Alexus
FRC #6155 (ElektraBots)
Team Role: Programmer
 
Join Date: Jan 2016
Rookie Year: 2016
Location: San Antonio, TX
Posts: 13
alexusaywla is an unknown quantity at this point
Smile Re: Autonomous

Quote:
Originally Posted by cantdecide View Post
Are you changing the "auton" parameter from SmartDashboard? You need to tab away from the input box after changing its value for the changes to come through. Try putting a SmartDashboard:utNumber right after the GetNumber in Autonomous() with a different name in order to make sure that you're reading the number correctly. Also, I'd suggest not using cout since I'm not sure if you can view console output without Riolog. Try using another SmartDashboard variable for that.

On other small flaws I can see, I suggest using a while loop that runs while the robot is autonomous and enabled around drive code instead of blindly waiting. I'm not sure if just waiting would cause any issues with the code you have right now but if your method gets more complex and requires cleanup after it's complete, you're probably going to need to switch to IterativeRobot or have a while loop. And I'm also not sure why you added a SetSafetyEnabled(false).
Quote:
Originally Posted by rich2202 View Post
Two possible problems:

1) Isn't it "AutonomousPeriodic()" and not "Autonomous()"
2) "wait (2)" might give you heartbeat problems. If your periodic code hangs for 2 seconds, FMS might think you have crashed and disable your robot. It is better to set a timer and check the timer each time AutonomousPeriodic is called.
Quote:
Originally Posted by cantdecide View Post
I believe that OP is using SampleRobot, hence OperatorControl() and not OperatorPeriodic().
Thanks for the help guys! I never actually saw these until now but I've figured everything out with my autonomous. I'm not even sure what the heck I did before but I understand my new code and it works great. Also, I apologize if quoting each of your posts is a nuisance, I'm not yet sure how to technically reply to all of you at once.
Reply With Quote