1 / 37

US First Kickoff 2011 Software Programming

US First Kickoff 2011 Software Programming. (And Control System) Daniel Kohn University of Memphis. What will be presented……. For Everyone Classmate Updates / Install. Rookie Teams General intro programming options. Veteran Teams Changes from Last Year. Classmate PC. Rookie Teams

casey
Download Presentation

US First Kickoff 2011 Software Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. US First Kickoff 2011Software Programming (And Control System) Daniel Kohn University of Memphis

  2. What will be presented…… • For Everyone • Classmate Updates / Install Rookie Teams • General intro • programming options Veteran Teams • Changes from Last Year

  3. Classmate PC • Rookie Teams • There will be NO Software loaded on the Classmate when you get it. • Veteran Teams • Classmates (driver station NetBook) will be re-imaged. • BACKUP FIRST!

  4. Classmate PC • See handout “Updating the CTL Classmate PC” for how to load up the software from the USB Thumb Drive provided in the KOP • Note: Images for rookie and veteran teams are different!

  5. Rookie Teams

  6. Programming Options • LabVIEW • C/C++ • Java

  7. LabVIEW - Advantages • Made By National Instruments (NI) • Makers of the cRIO Control system • Graphical Programming Language • Lots of support on line in forums and from NI • NI is a huge supporter of FRC and FIRST • Lots of build in documentation (help on every VI)

  8. LabVIEW - Disadvantages • Many windows need to be opened to do anything (hard to do on the Classmate) • Hard to find things the first time you need them • Programmers (those who know standard programming languages) have a hard time with the graphical nature of LabVIEW

  9. Sample LabVIEW Code

  10. C/C++ Advantages • Common programming language • Mentors and students might be more comfortable with C/C++ if they programmed in C before • Many books on C/C++ (but NOT the specifics for FRC teams) • Mentors and students who know C/C++ will have a shorter learning curve

  11. C/C++ Disadvantages • Licensing issues!

  12. Sample C/C++ Code

  13. Java Advantages • Uses NetBeans (commonly used by programmers) • Mentors and students who know Java already will have a very short learning curve. • All public domain – no licensing issues in off season and no registration required.

  14. Java Disadvantages • Newest Language (only the 2nd year offered) • Least amount of help/info available

  15. Sample Java Code

  16. Where to Start • Basic code • Each language has basic robot code or templates available • Don’t be afraid to search the internet, some teams post code from previous years! • HINT: the basic code usually uses the standard wiring (don’t deviate from the standard wiring or code will not work)

  17. Keep Current • A common rookie mistake is not to keep the software up to date. • Check the 2011 software update website often: http://www.usfirst.org/roboticsprograms/frc/content.aspx?id=18758

  18. Other Comments • If you are NOT using LabVIEW, you still need many of the files that are installed with LabVIEW (so you will need to install LabVIEW anyway) • You will probably want to do your programming on a computer with a bigger screen (laptop)

  19. Veteran Teams

  20. Major Changes This Year • Hardware and Software support for Jaguar CAN interface • “Watchdog” replaced with “Motor Safety” VI’s or routines

  21. New with LabView in 2011

  22. Safety VI’s • Instead of the watchdog function that would shut down the entire robot, safety VI’s now monitor each motor separately.

  23. Drive VI’s • Drive motors now have their own VI’s, with pre-existing Arcade and Tank Drive VI’s.

  24. Motor Set Output • Motor Set Speed VI has been replaced with Motor Set Output VI, which is basically the same thing.

  25. CAN Libraries • LabView now has VI’s made specifically for teams who wish to use CAN.

  26. Other Changes • Improved Error Reporting- Because of the safety vi’s, errors in the diagnostics tab are more specific. • Faster build and deployment times. • Robot Framework- You can choose a framework that comes with some game-specific code.

  27. New Features for 2011 C++ Beta Testing

  28. New Motor Safety Class class MotorSafety { public: virtual void SetExpiration(float timeout) = 0; virtual float GetExpiration() = 0; virtual bool IsAlive() = 0; virtual void StopMotor() = 0; virtual void SetSafetyEnabled(bool enabled) = 0; virtual bool IsSafetyEnabled() = 0; };

  29. Motor Based Classes Any class with motion involved is now derived from MotorSafety and implements its virtual functions. class RobotDrive: public MotorSafety { <original declarations> void SetExpiration(float timeout); float GetExpiration(); bool IsAlive(); void StopMotor(); bool IsSafetyEnabled(); void SetSafetyEnabled(bool enabled); <etc> };

  30. Usage • Much like the existing watchdog. • Watchdog still available, but there is no need to use both. • Motor(s) will stop if the Motor Safety feature times out. • No dedicated “Feed” function • Timeout occurs if the motor speed is not set within the expiration time • Depending on situation, can use Set(), Drive(), TankDrive() etc.

  31. Example: Autonomous Mode Old Way void Autonomous() { // drive forward half speed myRobot.Drive(0.5, 0.0); // Wait for 2 seconds Wait(2.0); // Stop myRobot.Drive(0.0, 0.0); } New Way void Autonomous() { Timer driveTime; driveTime.Start(); do { myRobot.Drive(0.5, 0.0); // Wait 1 motor update time Wait(0.005); // 5 ms } while (driveTime.Get() < 2.0); myRobot.Drive(0.0, 0.0); }

  32. Example: Teleop Mode Old Way while ( IsOperatorControl() ) { myRobot.ArcadeDrive(stick); if ( stick.GetRawButton(5) ) roller.Set(0.5); else if ( stick.GetRawButton(6) ) roller.Set(1.0); else if ( stick.GetRawButton(4) ) roller.Set(0.0); // wait for a motor update time Wait(0.005); } New Way double rollerSpeed = 0.0; while ( IsOperatorControl() ) { myRobot.ArcadeDrive(stick); if ( stick.GetRawButton(5) ) rollerSpeed = 0.5; else if ( stick.GetRawButton(6) ) rollerSpeed = 1.0; else if ( stick.GetRawButton(4) ) rollerSpeed = 0.0; roller.Set( rollerSpeed ); Wait(0.005); // motor update time }

  33. New Imaging Tool • now looks for images in ADE specific locations • now allows you to image when multiple network interfaces are enabled and connected • will warn you if your PC subnet will not work with the cRIO address • will allow you to turn on NetConsole • has more verbose progress feedback • allows you to rescan for cRIO devices

  34. C/C++ WPILIB • Safety function • Take place of watchdog • Works on per-actuator basis • Implemented in all PWM classes 

  35. Java Updates • Updated along with C/C++ and LabVIEW • CAN • Watchdog Replaced • Etc….

  36. Thanks to….. • Chop Shop )Team 166) • http://www.chopshop166.com/cms/ • The Fighting PI (Team 1718) • http://www.fightingpi.org/first-robotics-competition/ • The Green Machine (Team 1816) • http://www.edinarobotics.com/

  37. Thanks to….. • Bill’s Blog • http://frcdirector.blogspot.com/ • FRC Website • http://www.usfirst.org/Default.aspx

More Related