|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Driverstation Pong!
Yesterday, the programming part of our team had a little fun playing pong on our (still functional!) Driverstation. I had originally written the code coming back from one of our competitions while trying to teach some C++ to a VB programmer, and had never tested it. Once we finished what we were doing yesterday, I happened to notice the project, and decided to test it out. Aside from a few small bugs, it worked! I have the (C++) source attached. This is fun!
to use: create new simpleTemplate example project, and copy DS pong files to it. Build and download. Then switch to the user display on the DS (hold Select down for 1 second). Start pong by pulling Joystick 1's trigger. to reset after winning or loosing, pull joystick 1's trigger. The ball moves in random directions from random locations. Ideal setup: Driver station on table between 2 people, with joystick 1 on left of DS, joy 2 on right, both backwards (trigger towards front of DS) |
|
#2
|
|||
|
|||
|
Re: Driverstation Pong!
This is quite a cool idea, although I did take a look at your code and found some issues.
Now, to defend the use of goto. Using an exception is the exact same thing as a goto in this case, except that the try/catch implies something different is going on, and ignores all real exceptions because of the catch(...). Yes, you could use some extra logic to handle exiting the double loop, but in the end, the simplest, and most readable solution is to have a label directly before the main while, and a goto on win. Although the best solution would be to split the code up into separate functions such as.
Then the problem wouldn't be there to begin with . |
|
#3
|
|||
|
|||
|
Re: Driverstation Pong!
cool. At first glance, I thought you were talking about "apple juice" pong. I then imagined trying to play DS pong and how hard it wouold be.
![]() |
|
#4
|
||||
|
||||
|
Re: Driverstation Pong!
Quote:
It is hard, I have a 30-40% hitting rate! (and about half are lost on the first hit) Last edited by byteit101 : 17-12-2009 at 22:28. |
|
#5
|
|||
|
|||
|
Re: Driverstation Pong!
Quote:
|
|
#6
|
||||
|
||||
|
Re: Driverstation Pong!
I have a stupid question...
Where are DriverStationLCD.h and DriverStationLCD.cpp coming from? I notice the official WPILib Header, but neither are in the latest version I'm aware of (3.1.1764). Should I be getting updates form somewhere besides the following site? http://first.wpi.edu/FRC/frcupdates.html |
|
#7
|
||||
|
||||
|
Re: Driverstation Pong!
Quote:
|
|
#8
|
||||
|
||||
|
Re: Driverstation Pong!
I (finally!) have a video of DS Pong:
http://thecatattack.org/DriverStationPong I don't know if it will work on the classmate, but I would think so, because it has the status updates in the corner |
|
#9
|
|||
|
|||
|
where do you paste the code in the template?
|
|
#10
|
|||
|
|||
|
haha just kidding i just got it. nice code!
![]() |
|
#11
|
||||
|
||||
|
Re: Driverstation Pong!
Anyone dare to post a picture?
|
|
#12
|
|||||
|
|||||
|
Re: Driverstation Pong!
Just as a random thought. (I have not dared to mess with my team's DS.) I know people have created virtual Driver Stations. Would it be possible to put this game into the Virtual DS?
|
|
#13
|
||||
|
||||
|
Re: Driverstation Pong!
I think it can display the User Data, so yes.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| driverstation outputs | agough | C/C++ | 3 | 15-02-2009 22:25 |
| mindstorm and pong | RX7-bernie | General Forum | 1 | 01-03-2007 14:54 |
| Shooting Ping Pong Balls | Jeremiah Johnson | FIRST Tech Challenge | 1 | 01-05-2006 21:20 |
| pong mechanik | Andrew Rudolph | Chit-Chat | 4 | 13-10-2004 22:44 |
| Revive a Classic: Pong | K. Skontrianos | General Forum | 6 | 21-02-2003 16:20 |