Presentation is loading. Please wait.

Presentation is loading. Please wait.

2010 Control System Writing and Reading the cRio Presented By: Frank Larkin Lansdale Catholic Robotics, Team 272 First 2010 Kickoff, Jan. 2010.

Similar presentations


Presentation on theme: "2010 Control System Writing and Reading the cRio Presented By: Frank Larkin Lansdale Catholic Robotics, Team 272 First 2010 Kickoff, Jan. 2010."— Presentation transcript:

1 2010 Control System Writing and Reading the cRio Presented By: Frank Larkin Lansdale Catholic Robotics, Team 272 First 2010 Kickoff, Jan. 2010

2 Big Al says…

3 Starters Resources –LC web site -- www.frc272.com –Seminar Archive Software seminar in 2 nd week in December in Radnor All dev. environments covered, C++, Java and Labview. www.frc272.com/seminar/Archive –LC 2009 FRC C++ code in archive –F Larkin email -- pafwl@aol.com Development Ideas –Multiple groups do parallel development –How to communicate what is needed? You take the lead! Use Excel spread sheet to tell all groups what you need and what you expect. www.frc272.com/documents/2008RobotVariables.xls

4 Batch Files Use batch files to quickly change computer ethernet connection. –You must know what your connection is called.

5 netsh Command netsh – used to set network parameters –Command: netsh /? To see parameters Example: Set interface to Crio Note: In the example above the netsh command is on the same line! @echo off echo Setting the Ip to CRIO network 10.2.72.6. netsh interface ip set address name="Local Area Connection" static 10.2.72.6 255.0.0.0 pause

6 Many batches SetToCamera.bat SetToDHCP.bat Note: All the above commands are set on the same batch line. The wrapping is the result of powerpoint netsh interface ip set address name="Local Area Connection" dhcp netsh interface ip set address name="Local Area Connection" static 10.2.72.3 255.0.0.0

7 Write and Reading How to write and files on the cRio. Config Files –Allows you to override settings without recompiling and download of code. Startup Log file –Keep information about what happened at startup –Issue: Writing to cRio in real time is slow but only done at startup. Telemetry Files –Save all variables from a round to later review in Excel. –Issue: Do it with no additional burden on cRio. Autonomous Scripting –Multiple steps in modules –Faster development and testing –Quick changes in competition cRio Issues: –Not the fastest file system. –Solution: Where you can write to memory and dump at the end of the round.

8 Crio File System Very similar to Linux file system –Use / vs. \ if necessary FTP server –Connect with Internet Explorer ftp://10.2.72.2ftp://10.2.72.2 –Use IE to drag and drop files to cRio –May need login to FTP server. Will update this preso with info. Standard C code to open a file #include filename = "mystuff.txt"; fp=fopen(fileName, "w"); //write fp=fopen(fileName, "r"); //read fp=fopen(fileName, "a"); //append –Opens file –returns a file handle or Null on error. –See Code for details

9 Logfiles Save startup info you want –File system slow so do not log during round. It will slow down your code! –No need for terminal connection –Save for later review –See what happened on the field at startup –Verify what carbon based units (CBUs) are telling you. Steps –1 – Decide what mode write or append –2 – Open file –3 – Check for a good open –4 – Write message to file using fputs and screen using puts –5 – Close file –6 – Gently pat self on back, gently so as not to hurt yourself, for doing a good job Review of Code – Log.cpp

10 Read Config File Once all variables are initialized call LoadConfig() function my.f_GyroSmallTurnLimit =.20; my.f_GyroSmallTurnFactor =.10; my.f_GyroLargeTurnLimit =.30; my.f_GyroLargeTurnFactor =.20; //all variables that can change above here. LoadConfig(); AutoLoadFile(); void IterativeDemo2::SetConfigValue(char *parm, char *value) { int found = 0; if( parm[0] == '#') return; if(strcmp( parm, "ShooterWheel.DesiredDuration")==0) { shooter.p_Wheel->f_DesiredDuration = atof(value); found = 1; }

11 Telemetry Write all variables to system for later review. –cRio has flash memory that looks just like any Linux file system. –Do not touch any existing files or directories There I said it you are on your own!!!! Write Using Tab Delimited format –Tab character between variables –Easily read by MS Excel All variables are global but they do not have to be –You can pass in variables that you want to save. But file system is too slow to write on the fly? –Write to memory then save at the end of the round. Steps –1 - Allocate memory (maloc) to save string. –2 - Use sprintf to write to the memory –3 - Add memory to an arrary to save for later How much memory –Do the simple math1 –How many variables? –How much room per variable? –How much room per sample, don’t forget spaces and tabs. –How many loops through? –You got plenty. Review of Code – Telemetry.cpp

12 Autonomous Scripting Create a parameter based script file using simple commands and numeric parameters –Each command a represents a single module Test that module so it works with others Module Examples: –D = Drive Motor values, Timer –T = turn Power, direction, time Can use gyro Negative go one way, positive go the other way Start script line with program number –See other presentation on ideas how to select program. This allows CBU to select on the field. Review Code

13 Get It Done! 1.Start early 2.Work hard 3.Don’t Panic 4.Ask for help if you need it 5.Be Bold 6.Have Fun!! If (notHavingFun == True) checkPreviousSteps();


Download ppt "2010 Control System Writing and Reading the cRio Presented By: Frank Larkin Lansdale Catholic Robotics, Team 272 First 2010 Kickoff, Jan. 2010."

Similar presentations


Ads by Google