Go to Post the best way to make things most unfair is to have different rules for different people. - Jack Jones [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 10-10-2016, 14:53
Tom Bottiglieri Tom Bottiglieri is offline
Custom User Title
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,182
Tom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond reputeTom Bottiglieri has a reputation beyond repute
Send a message via AIM to Tom Bottiglieri
Re: Team 254 Presents: FRC 2016 Code

A quick note on the vision app and the motivation behind using Android.

We started the year under the mindset that we could build a protected zone shooter, but quickly realized with some prototypes and strategy sessions there was serious value to be had by building a small robot that could both go under the bar and shoot from anywhere near the tower. We knew this would require a very good vision system for our robot and got to work trying to make something to run on the NVIDIA Jetson board. This board proved to be very capable of processing frames (in fact, the best performance we got all year was an early prototype running on this board), but had some issues with power up/down reliability. We debated using a computer with a battery built in, but settled on Android because it was cheaper and "cooler".

The app was designed to work well on the hardware we selected for the robot (Nexus 5), but we have seen weird bugs on other devices. For instance, the framerate is worse and the picture is upside down on my Nexus 5X. I'm sure there is a perfectly reasonable cause for this, we just haven't felt the need to fix bugs for platforms that weren't on our robot. If you find bugs in the app or make it work on a new platform, feel free to submit a pull request and our students will review it.
__________________
Team 254 | San Jose, CA | Mentor (2010 - Present)
Team 125 | Boston, MA | College Student (2007 - 2011)
Team 195 | Southington, CT | Student (2002 - 2006)
Reply With Quote
  #2   Spotlight this post!  
Unread 10-10-2016, 17:07
Eugene Fang's Avatar
Eugene Fang Eugene Fang is offline
The Blue Alliance
no team
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Bay Area, CA -> Pittsburgh, PA
Posts: 759
Eugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond reputeEugene Fang has a reputation beyond repute
Re: Team 254 Presents: FRC 2016 Code

Quote:
Originally Posted by Tom Bottiglieri View Post
the picture is upside down on my Nexus 5X.
Apparently the camera module in the 5X is upside down due to packaging reasons. There's a software flag that apps are supposed to read to get camera orientation, but many (like the Augmented Reality feature in eDrawings) don't do it right...
__________________
Eugene Fang
2010 Silicon Valley Regional Dean's List Finalist

Various FLL Teams - Student (2000-2006), Mentor (2007-2010)
FRC Team 604 - Student (2007-2010), Mentor/Remote Advisor (2011-2015)
FRC Team 1323 - Mentor/Remote Advisor (2011-2014)

The Blue Alliance | TBA GameDay | TBA Android App
Reply With Quote
  #3   Spotlight this post!  
Unread 19-10-2016, 15:26
kingca kingca is offline
Registered User
FRC #0108 (SigmaC@ts)
Team Role: Programmer
 
Join Date: Feb 2016
Rookie Year: 2015
Location: Florida
Posts: 16
kingca is an unknown quantity at this point
Re: Team 254 Presents: FRC 2016 Code

How were you guys able to calculate the traction?
Reply With Quote
  #4   Spotlight this post!  
Unread 20-10-2016, 00:12
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,064
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Team 254 Presents: FRC 2016 Code

Quote:
Originally Posted by kingca View Post
How were you guys able to calculate the traction?
I'm not sure what you're referring to? We did have a "traction control" mode that used closed-loop speed feedback along with a gyro to cross defenses while remaining straight, but this didn't require calculating traction.
Reply With Quote
  #5   Spotlight this post!  
Unread 20-10-2016, 01:59
wsh32's Avatar
wsh32 wsh32 is offline
The Nerdiest of the Nerd Herd
AKA: Wesley Soo-Hoo
FRC #0687 (The Nerd Herd)
Team Role: Leadership
 
Join Date: Sep 2014
Rookie Year: 2014
Location: SoCal
Posts: 14
wsh32 is on a distinguished road
Re: Team 254 Presents: FRC 2016 Code

How do you check your position in auto after you crossed a defense like the moat, where your wheels might be turning more than you're actually moving? Or did you not run into that problem?
Reply With Quote
  #6   Spotlight this post!  
Unread 20-10-2016, 11:10
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,064
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Team 254 Presents: FRC 2016 Code

Quote:
Originally Posted by wsh32 View Post
How do you check your position in auto after you crossed a defense like the moat, where your wheels might be turning more than you're actually moving? Or did you not run into that problem?
1) we went slowly enough that worst case slip was limited.
2) we used closed-loop velocity control on the wheels to ensure that even if one side of the drive train momentarily lost traction, we didn't suddenly lose a ton of encoder ticks.
3) in the end, we didn't need to be that precise - our auto-aim could make the shot from anywhere in the courtyard, and on the way back we either just used a conservative distance (for our one-ball mode) or used a reflective sensor to ensure we didn't cross the center tape (for our two-ball modes).
Reply With Quote
  #7   Spotlight this post!  
Unread 21-10-2016, 15:22
ranlevinstein's Avatar
ranlevinstein ranlevinstein is offline
Registered User
FRC #2230 (General Angels)
Team Role: Programmer
 
Join Date: Oct 2015
Rookie Year: 2014
Location: Israel
Posts: 9
ranlevinstein will become famous soon enough
Re: Team 254 Presents: FRC 2016 Code

Thank you guys for sharing your amazing code!
I have a couple of questions:
Why did you choose to follow a path instead of a trajectory during auto this year?
Why did you choose the adaptive pure pursuit controller instead of other controllers?
Reply With Quote
  #8   Spotlight this post!  
Unread 22-10-2016, 01:05
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,064
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Team 254 Presents: FRC 2016 Code

Quote:
Originally Posted by ranlevinstein View Post
Why did you choose to follow a path instead of a trajectory during auto this year?
Great question! I assume you are referring to (my) definition of path vs. trajectory from the motion profiling talk (these definitions are hardly universal).

Path: An ordered list of states (where we want to go, and in what order). Paths are speed-independent.

Trajectory: A time-indexed list of states (at each time, where we want to be). Because each state needs to be reached at a certain time, we also know get a desired speed implicitly (or explicitly depending on your representation).

In 2014 and 2015, our controllers followed trajectories. In 2016, our drive followed paths (the controller was free to determine its own speed). Why?

Time-indexed trajectories are planned assuming you have a pretty good model of how your robot will behave while executing the plan. This is useful because (if your model is good), your trajectory contains information about velocity, acceleration, etc., that you can feed to your controllers to help follow it closely. This is also nice because your trajectory always takes the same amount of time to execute. But if you end up really far off of the trajectory, you can end up with weird stuff happening...

With a path only, your controller has more freedom to take a bit of extra time to cross a defense, straighten out the robot after it gets cocked sideways, etc. This helps if you don't have a good model of how your robot is going to move - and a pneumatic wheeled robot climbing over various obstacles is certainly hard to model.

Quote:
Originally Posted by ranlevinstein View Post
Why did you choose the adaptive pure pursuit controller instead of other controllers?
Simplicity. A pure pursuit controller is basically a P-only controller on cross track error, but somewhat easier to tune. Adaptive pure pursuit is sort of akin to a PD controller (the only difference is a fudge factor in how far you look ahead). If you only have a day to get auto mode working, and the robot is being repaired up on a table while you are coding, then pure pursuit requires very little time to get tuned once you are back on the floor
Reply With Quote
  #9   Spotlight this post!  
Unread 26-10-2016, 22:15
apache8080 apache8080 is offline
Lead Programmer, Drive Coach, Scout
AKA: Rishi Desai
FRC #5677
Team Role: Programmer
 
Join Date: Jan 2014
Rookie Year: 2013
Location: San Jose, CA
Posts: 36
apache8080 is on a distinguished road
Re: Team 254 Presents: FRC 2016 Code

Thanks for all of the great resources.

I had a few questions on your vision code:

Are you guys calculating distance from the goal to adjust the hood? If so, how?

If you guys would have used the Jetson TX1, would you have considered using the ZED stereocamera from Stereolabs?
__________________
Rishi Desai

Team 5677, 2016-Present
Team 3256, 2013-2016
My GitHub
Reply With Quote
  #10   Spotlight this post!  
Unread 26-10-2016, 23:58
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,064
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Team 254 Presents: FRC 2016 Code

Quote:
Originally Posted by apache8080 View Post
Are you guys calculating distance from the goal to adjust the hood? If so, how?[/url]?
Yep. I'll point you to a few places in the code that help explain how.

First, in the Android app, we find the pixel coordinates corresponding to the center of the goal:
https://github.com/Team254/FRC-2016-...View.java#L131

...and then turn those pixel coordinates into a 3D vector representing the "ray" shooting out of the camera towards the target. The vector has an x component (+x is out towards the goal) that is always set to 1; a y component (+y is to the left in the camera image); and a z component (+z is up). This vector is unit-less, but the ratios between x, y, and z define angles relative to the back of the phone. The math behind how we create this vector is explained here.

The resulting vector is then sent over a network interface to the RoboRIO. The first interesting place it is used is here:
https://github.com/Team254/FRC-2016-...tate.java#L187

In that function, we turn the unit-less 3D vector from the phone into real-world range and bearing. We can measure pitch (angle above the plane of the floor) by using our vector with some simple trig; same thing for yaw (angle left/right). Since we know where the phone is on the robot (from CAD, and from reading the sensors on our turret), we can compensate for the fact that the camera is not mounted level, and the turret may be turned. Finally, we know how tall the goal should be (and how high the camera should be), so we can use more trigonometry to use our pitch and yaw angles to determine distance. We feed these values into a tracker (which smooths out our measurements by averaging recent goal detections that seem to correspond to the same goal).

The final part is to feed our distance measurement (and bearing) into our auto-aiming code. We do this here:
https://github.com/Team254/FRC-2016-...ture.java#L718

Notice that we use a function to convert between distance and hood angle. This function was tuned (many times throughout the season) by putting the robot on the field, shooting a bunch of balls from a bunch of different spots, and manually adjusting hood angle until the shots were optimized for each range. We'd record the angles that worked best, and then interpolate between the two nearest recorded angles for any given distance we want to shoot from.
Reply With Quote
  #11   Spotlight this post!  
Unread 27-10-2016, 00:00
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,064
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Team 254 Presents: FRC 2016 Code

Quote:
Originally Posted by apache8080 View Post
If you guys would have used the Jetson TX1, would you have considered using the ZED stereocamera from Stereolabs?
Probably not. Stereo was totally unnecessary for estimating range to the goal last year; we were able to estimate our distance to within a few inches using only the method described in the previous post.
Reply With Quote
  #12   Spotlight this post!  
Unread 20-10-2016, 12:46
kingca kingca is offline
Registered User
FRC #0108 (SigmaC@ts)
Team Role: Programmer
 
Join Date: Feb 2016
Rookie Year: 2015
Location: Florida
Posts: 16
kingca is an unknown quantity at this point
Re: Team 254 Presents: FRC 2016 Code

oh ok so your "traction control" was making sure that your robot remained straight; by any chance what was the logic behind making the robot stay straight.
Reply With Quote
  #13   Spotlight this post!  
Unread 20-10-2016, 15:26
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,064
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Team 254 Presents: FRC 2016 Code

Quote:
Originally Posted by kingca View Post
oh ok so your "traction control" was making sure that your robot remained straight; by any chance what was the logic behind making the robot stay straight.
Yeah - the logic for staying straight is here. There's a PID controller that compares our actual heading to the desired heading, and adjusts the desired velocities of the left and right sides of the drive accordingly.
Reply With Quote
  #14   Spotlight this post!  
Unread 20-10-2016, 15:35
frcguy's Avatar
frcguy frcguy is offline
Unregistered Unuser
AKA: Nicholas Dal Porto
FRC #5940 (B.R.E.A.D.)
Team Role: Tactician
 
Join Date: Dec 2015
Rookie Year: 2012
Location: Burlingame, California
Posts: 831
frcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond reputefrcguy has a reputation beyond repute
Re: Team 254 Presents: FRC 2016 Code

Quote:
Originally Posted by Jared Russell View Post
I'm not sure what you're referring to? We did have a "traction control" mode that used closed-loop speed feedback along with a gyro to cross defenses while remaining straight, but this didn't require calculating traction.
What gyro did you guys use? I saw the Spartan Board on your bot at Chezy Champs, so I assume that you used the ADXRS453 that is built in to it, but I didn't have a chance to get a closer look.
__________________


2016: Team 5940 (Silicon Valley Regional Rookie All-Star and Quarterfinalist, Curie Quarterfinalist)

Volunteer: 2016 (Chezy Champs Field Reset, Capital City Classic FTA, MadTown ThrowDown FTA)
Reply With Quote
  #15   Spotlight this post!  
Unread 20-10-2016, 15:42
Jared Russell's Avatar
Jared Russell Jared Russell is offline
Taking a year (mostly) off
FRC #0254 (The Cheesy Poofs), FRC #0341 (Miss Daisy)
Team Role: Engineer
 
Join Date: Nov 2002
Rookie Year: 2001
Location: San Francisco, CA
Posts: 3,064
Jared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond reputeJared Russell has a reputation beyond repute
Re: Team 254 Presents: FRC 2016 Code

Quote:
Originally Posted by frcguy View Post
What gyro did you guys use? I saw the Spartan Board on your bot at Chezy Champs, so I assume that you used the ADXRS453 that is built in to it, but I didn't have a chance to get a closer look.
Yes.
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 06:34.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi