Thread: Autonomous Mode
View Single Post
  #6   Spotlight this post!  
Unread 14-01-2015, 14:26
Chris Hibner's Avatar Unsung FIRST Hero
Chris Hibner Chris Hibner is offline
Eschewing Obfuscation Since 1990
AKA: Lars Kamen's Roadie
FRC #0051 (Wings of Fire)
Team Role: Engineer
 
Join Date: May 2001
Rookie Year: 1997
Location: Canton, MI
Posts: 1,488
Chris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond reputeChris Hibner has a reputation beyond repute
Re: Autonomous Mode

What we usually do (and what I would recommend), is that you put any software that you intend to use in both teleop and auton in the periodic tasks VI. You can then pass data from auton and teleop to periodic tasks with global variables.

That may not make sense at first so I'll give an example.

Let's say you have a lifting mechanism to lift the totes. You decide that it would be ideal to command your lift to a height (using presets on buttons) and use a PID to control the lift to the commanded height. At the same time, it would make sense for autonomous to command the lift to a height and use a PID to control the lift to the commanded height.

Since both your autonomous strategy and your teleop strategy both rely on commanded heights and a PID, it would make sense to move your lift control code to periodic tasks so it can be shared by autonomous and teleop. You could then create a global variable called "LiftHeightCommand" that is the set point of the PID. In teleop, do your button processing to decide on the commanded lift height and assign the output of your logic to LiftHeightCommand. In autonomous, just set LiftHeightCommand directly.
__________________
-
An ounce of perception is worth a pound of obscure.
Reply With Quote