|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Review Tracking Code
We're pretty new to Java target tracking - we've started to play around with it this year! Most of our code uses the FRC 2013 Vision sample code, but we figured that it would be fine to use and build upon the example. (Unfortunately, we have not tried using it yet, since the mechanical guys are still working on building the robot!)
We have two Netbeans projects - RobotSeeRobotDo (clever, eh?) and RobotSeeRobotDoLite. RobotSeeRobotDo handles all the corner cases, while RobotSeeRobotDoLite ignores corner cases and greatly simplifies the code. I would be grateful if anyone can review the source and provide feedback! ![]() http://code.google.com/p/frcbot4067/...obotSeeRobotDo http://code.google.com/p/frcbot4067/...SeeRobotDoLite Thanks in advance! EDIT: RobotSeeRobotDo and RobotSeeRobotDoLite have been updated to fix a logic problem. Last edited by alberth : 06-02-2013 at 22:52. |
|
#2
|
||||
|
||||
|
Re: Review Tracking Code
I didn't do an in-depth review, but I'd recommend breaking your functions up a little more so they aren't super-long. It also makes verifying the logic a lot easier.
Also, I noted some Timer.delay() bits in there... keep in mind that if you delay, then nothing else can happen on your robot during that time (including feeding the watchdog, and driving), so you'll end up with the robot freezing when doing certain things. |
|
#3
|
|||
|
|||
|
Re: Review Tracking Code
Quote:
Again, I would appreciate it if you (or any other people) could review the vision code! http://code.google.com/p/frcbot4067/...obotSeeRobotDo http://code.google.com/p/frcbot4067/...SeeRobotDoLite Quote:
One fix is to keep the delays, but have the shooter and alignment code run in a thread. I'm not sure if FRC Java supports it, nor whether this is safe or not. Plus it's a tad bit more complex. Another fix would be to use System.nanoTime(). I would take that function's output and use it as a start time, then continuously take measurements until the difference meets a certain time. The issue with that is that I would have to check the difference everywhere, which leads to messy code. At the moment, I don't see this becoming too much of a problem. In autonomous, it would be advantageous to let the shooting code complete in case you are just about to shoot, the horn sounds, and you make that final autonomous shot. (Don't know if that will score you any autonomous bonus points, but points are still points!) In teleop, we probably won't be moving while shooting, so a controls lockup would be fine. (We're not planning to do the "shooting while driving" trick like some teams have done! )Nevertheless, it is still a handicap, and I would appreciate any suggestions on how to fix this! ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|