Bryn Mawr College IPRE Kickoff Meeting Bryn Mawr College Doug Blank Software Development.
US First Kickoff 2011 Software Programming
description
Transcript of US First Kickoff 2011 Software Programming
![Page 1: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/1.jpg)
US First Kickoff 2011Software Programming
(And Control System)
Daniel KohnUniversity of Memphis
![Page 2: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/2.jpg)
What will be presented……
Rookie Teams• General intro
programming options
Veteran Teams• Changes from Last Yea
r
For Everyone• Classmate Updates / Install
![Page 3: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/3.jpg)
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!
![Page 4: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/4.jpg)
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!
![Page 5: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/5.jpg)
ROOKIE TEAMS
![Page 6: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/6.jpg)
Programming Options• LabVIEW• C/C++• Java
![Page 7: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/7.jpg)
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)
![Page 8: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/8.jpg)
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
![Page 9: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/9.jpg)
Sample LabVIEW Code
![Page 10: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/10.jpg)
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
![Page 11: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/11.jpg)
C/C++ Disadvantages• Licensing issues!
![Page 12: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/12.jpg)
Sample C/C++ Code
![Page 13: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/13.jpg)
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.
![Page 14: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/14.jpg)
Java Disadvantages• Newest Language (only the 2nd year offered)• Least amount of help/info available
![Page 15: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/15.jpg)
Sample Java Code
![Page 16: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/16.jpg)
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)
![Page 17: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/17.jpg)
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
![Page 18: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/18.jpg)
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)
![Page 19: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/19.jpg)
VETERAN TEAMS
![Page 20: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/20.jpg)
Major Changes This Year• Hardware and Software support for Jaguar
CAN interface• “Watchdog” replaced with “Motor Safety” VI’s
or routines
![Page 21: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/21.jpg)
New with LabView in 2011
![Page 22: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/22.jpg)
Safety VI’s• Instead of the watchdog function that would
shut down the entire robot, safety VI’s now monitor each motor separately.
![Page 23: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/23.jpg)
Drive VI’s• Drive motors now have their own VI’s, with
pre-existing Arcade and Tank Drive VI’s.
![Page 24: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/24.jpg)
Motor Set Output• Motor Set Speed VI has been replaced with
Motor Set Output VI, which is basically the same thing.
![Page 25: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/25.jpg)
CAN Libraries• LabView now has VI’s made specifically for
teams who wish to use CAN.
![Page 26: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/26.jpg)
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.
![Page 27: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/27.jpg)
New Features for 2011
C++ Beta Testing
![Page 28: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/28.jpg)
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;};
![Page 29: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/29.jpg)
class RobotDrive: public MotorSafety{ <original declarations>
void SetExpiration(float timeout); float GetExpiration(); bool IsAlive(); void StopMotor(); bool IsSafetyEnabled(); void SetSafetyEnabled(bool enabled);
<etc>};
Motor Based Classes
Any class with motion involved is now derived from MotorSafetyand implements its virtual functions.
![Page 30: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/30.jpg)
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.
![Page 31: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/31.jpg)
Example: Autonomous ModeOld 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);}
![Page 32: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/32.jpg)
Example: Teleop ModeOld 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}
![Page 33: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/33.jpg)
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
![Page 34: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/34.jpg)
C/C++ WPILIB
• Safety functiono Take place of watchdogo Works on per-actuator basiso Implemented in all PWM classes
![Page 35: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/35.jpg)
Java Updates• Updated along with C/C++ and LabVIEW
CAN Watchdog Replaced Etc….
![Page 36: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/36.jpg)
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/
![Page 37: US First Kickoff 2011 Software Programming](https://reader036.fdocuments.in/reader036/viewer/2022062520/56815eee550346895dcdaba3/html5/thumbnails/37.jpg)
Thanks to…..• Bill’s Blog
http://frcdirector.blogspot.com/• FRC Website
http://www.usfirst.org/Default.aspx