AUTOFLEX 2.0 New and Improved Autonomous Programming Tool for FIRST Robots by Brian Cieslak n the March ‘06 issue of SERVO Magazine, I Iintroduced you to a program called AutoFlex — a tool used for developing autonomous routines for FRC (First Robotics Competition) robot controllers. The program was created by members of FRC Team 1675 when they realized that they were going to the FIRST (For Inspiration and Recognition of Science and Technology) National Championships FIGURE 1. Team 1675’s first robot in Atlanta, GA without any up to the goal and shoot an entire programmed with Autoflex for the autonomous functionality for their magazine of balls through the hole FIRST Triple Play competition would know one tetra from the goal and robot. Without having access to the (most of the time). cap the second during the robot until the event, they needed a The original program was a little autonomous period. way to quickly program the robot cumbersome and complicated to use. to perform some task during the While the driver commanded the more laptops and cables, editing data, autonomous period. The solution was robot through the routine that was and reprogramming. Programmer to create a program that would allow to be recorded and then played it stress levels have been greatly reduced! the team’s driver to teach the robot back during the autonomous mode, what it had to do during the a programmer — with a laptop Imagine This! autonomous period by recording the connected to the robot via a serial driver’s commands as he drove cable — chased (or was chased by) the During practice, you set your through the autonomous routine. robot as he captured data. The robot on the playing field, click a Training took place on the practice data then had to be loaded into a button on the operator interface and field before the matches started. file and the whole program was start driving. Then you set your robot At the beginning of the match, the recompiled and reloaded into the back to the starting point, connect a robot would repeat the commands robot. From the sidelines, this was fun dongle to the competition port of the that it was taught. to watch, but those actually involved operator interface and flip the dongle In 2005 during the Triple play in the process were often quite switch to autonomous and the robot competition, the robot scored two stressed and in peril. will replay the practice session you tetras during each autonomous Autoflex has been simplified and just recorded. Don’t like what you period. During the 2006 Aim High updated to version 2.0 to take see? Just reset the dongle switch competition, the robot could drive advantage of the internal EEPROM back to the off position and just click memory available in the FRC robot the program button again to re-record Photos courtesy of FRC Team 1675 — controller. Commands are now written another session until you get it The Ultimate Protection Squad. directly to the EEPROM memory. No right. Neat, eh?? Your robot is 28 SERVO 11.2007 ready to run during the autonomous Now you are an period, all in about 15 minutes. expert. Getting Started For the Beginning A .zip file can be downloaded FIRST from the FRC Team 1675 website (see Programmer Web Links sidebar) that includes a version of the FRC default code with AutoFlex included. I/O mapping for the If you are just default program is as follows: learning to program a FIRST robot, a Joystick 1 - Y axis to PWM_1 sample project that Joystick 2 - Y axis to PWM_2 is fully functional is FIGURE 2 Joystick 1 - X axis to PWM_5 included in the zip Joystick 2 - X axis to PWM_6 file you can download from the Team shown in Figure 2. Also add the 1675 website that can serve as a tem- #include”AutoFlex.h statement at the Set your robot to program mode plate to get you started. The program- beginning of the file. and download the FRCAutoFlex.hex file ming kit that comes with your robot using the IFIdownloader program includes a disk with the MPLAB-IDE 3) Open the user_routines.c file. Add a available from the IFI website (www. programming environment and the call to the function autoflex_recorder() ifirobotics.com). C18-Complier Version 2.4, as well as to the Process_Data_From_ Master_ Attach a programming dongle to the downloader program. You will uP() function as shown in Figure 3. the competition port of the operator need these tools to compile and down- Also add the #include”AutoFlex.h” interface (instructions on how to make load your program to the robot. statement at the beginning of the file. your own are also available from the IFI website) and set the autonomous Adding Autoflex to 4) Open the main.c file. Add a call to switch to the open position. You are Your Existing Code the function rewind_autoflex_ now ready to start programming playback() to the main()function as your robot for autonomous operation. Adding AutoFlex to your existing shown in Figure 5. Also add the The FRCAutoFlexCode.hex program code is simple if all the calls to your #include"AutoFlex.h" statement at the records four inputs: joystick 1 x-axis, control functions (motor control, beginning of the file. joystick 1 y-axis, joystick 2 x-axis, and manipulator arm, etc.) are made from joystick 2 y-axis. the Default_Routine() function found FIGURE 4. Team 1675’s Aim High robot Click the trigger on the port 1 in the User_Routines.c file. would drive up to the goal and shoot joystick to start recording. You now You must do the following (refer most of its 10 balls through the hole. have 15 seconds to drive through your to the sample code provided): autonomous routine. After 15 seconds, the robot stops recording commands 1) Copy the following files to your even though it lets you keep driving. project folder, then open MPLAB and To replay what you just recorded, add them to your project: ‘close’ the autonomous switch on the a) AutoFlex.c dongle. Watch out! Your robot will b) Autoflex.h start to execute the code you just c VEX_eeprom.c recorded. The robot will play 15 d) VEX_eeprom.h seconds of commands and then stop until you open the autonomous 2) Open the user_routines_fast.c switch again. file. Add a call to the function Once you are satisfied with the autoflex_playback() to the user_ autonomous routine you’ve recorded, autonomous_code() function as place a jumper on the ‘digital input 1’ pins. This write protects your autonomous program from being accidentally erased if you click the trigger while driving around. FIGURE 3 That’s the basic operation. SERVO 11.2007 29 (1024/ number_of_inputs) - 1 = Web Links max_tenths_of_seconds. For exam- ple: (1024/4 inputs)-1 = 255, so For Autoflex files TIME_LIMIT could be set to 255 http://team1675.com/ tenths_of_seconds. (25.5 seconds). teamdownload.html // The length of the autonomous For competition routine in tenths of seconds port dongle #define TIME_LIMIT 150 www.ifirobotics.com/ FIGURE 5 oi.shtml d) You can assign which digital port you want to use for your WRITE_ 5) Configure Autoflex.h to reflect your //inputs on the line below. PROTECT jumper. If you don’t want robot system. Sections that you #define NUM_OF_INPUTS 4i to write protect your autonomous may want to consider changing include code or you have used up all your the following: b) You can determine what you want digital ports, re-define WRITE_ to use as the ‘Record Button.’ The PROTECT to ‘1.’ a) Determine how many inputs you default is port 1 trigger Button. want to capture and which ones. // if jumper in place then do not //add defines here to assign //define the mechanism that will //record (assuming jumper pulls pin //commands to user controls that //act as the record button. //low) // you want record/ //In this example port trigger is a #define WRITE_PROTECT \ #define AUTO_COMMAND1 p1_x //button on the OI. (rc_dig_in01) //left Joystick x // that you would press to the #define AUTO_COMMAND2 p1_y //forward position to start recording e) Since an FRC robot uses a //left Joystick y longer timing interval than VEX #define AUTO_COMMAND3 p2_y #define \ robots during autonomous opera- //right joystick y AUTO_BUTTON_REV_THRESH \ tion, uncomment the #define FRC 1 #define AUTO_COMMAND4 p2_x (unsigned char)100 // used by Vex line to adjust the timing if you are //right joystick x #define \ adding Autoflex to a FRC robot. //#define AUTO_COMMAND5 AUTO_BUTTON_FWD_THRESH \ //uncomment to add another input (unsigned char)154 // used by Vex No More Excuses //#define AUTO_COMMAND6 #define \ to Sit Idle! //uncomment to add another input AUTO_NEUTRAL_PWM_VALUE \ (unsigned char)127 When I attended FIRST Regional // Number of inputs we plan to competitions in Milwaukee, WI and //record #define AUTO_RECORD (p1_sw_trig) Cleveland, OH and the FIRST National // Default is set up to save 4 inputs. //port_1 trigger to start recording Championship in Atlanta, I was //You can save up to 6 surprised by how many robots sat idle // inputs. You can define two auto c) You can adjust the length of time during the autonomous segment of //command lines above. you want to record commands by the match. Our team started touting // then change the number of changing the TIME_LIMIT value. the benefits and simplicity of the Default is 150 tenths of a second Autoflex program there and enabled FIGURE 6. Autoflex was used to program (or 15 seconds). The maximum value several teams to compete during that a large claw-like manipulator during the of TIME_LIMIT depends on the 15 second period at the beginning of autonomous period at the beginning number of inputs you are trying the match.
Details
-
File Typepdf
-
Upload Time-
-
Content LanguagesEnglish
-
Upload UserAnonymous/Not logged-in
-
File Pages3 Page
-
File Size-