Go to Post By the end of the year, I have a feeling that I'm going to know much, much more about the intricacies of orbit balls than I ever wanted to. - Jared Russell [more]
Home
Go Back   Chief Delphi > FIRST > General Forum
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 22 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 06-23-2014, 06:46 PM
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,301
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
Team 254 - 2014 FRC Code

Hi everyone,

We would like to share the software that controlled Barrage in its quest for the 2014 FRC Championship.

Our robot ran Java this year as it did in 2013. To develop Barrage, we added a bunch of new features like waypoint navigation that drives smooth splines, an internal web server for debugging controllers and modifying robot constants, Cheesy Vision, single threaded autonomous scripting, and more. Check it out!

https://github.com/Team254/FRC-2014
and
https://github.com/Team254/TrajectoryLib

If you have any questions please do not hesitate to ask... We love talking about our work! Also please feel free to try/learn from/re-use this code as much as you see fit.

Thanks!

Last edited by Tom Bottiglieri : 06-23-2014 at 06:51 PM.
Reply With Quote
  #2   Spotlight this post!  
Unread 06-23-2014, 07:22 PM
Sohaib's Avatar
Sohaib Sohaib is offline
Mechanical + Drive Coach
AKA: Sohaib Nadeem
FRC #5036 (The Robo Devils)
Team Role: Mentor
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Toronto, Ontario
Posts: 168
Sohaib has a reputation beyond reputeSohaib has a reputation beyond reputeSohaib has a reputation beyond reputeSohaib has a reputation beyond reputeSohaib has a reputation beyond reputeSohaib has a reputation beyond reputeSohaib has a reputation beyond reputeSohaib has a reputation beyond reputeSohaib has a reputation beyond reputeSohaib has a reputation beyond reputeSohaib has a reputation beyond repute
Re: Team 254 - 2014 FRC Code

Great work guys for doing this!
__________________
5036 - Drive Coach || 2016-Present
5036 - Student || 2013-2016
Reply With Quote
  #3   Spotlight this post!  
Unread 06-23-2014, 07:35 PM
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 607
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: Team 254 - 2014 FRC Code

Thank you so much for posting these; they're really an inspiration for our programming team. The trajectory generator and spline classes are really, really awesome.

I do have a few questions:

1. What is the negative inertia accumulator in Cheesy Drive? I've seen it in previous code releases, but I have no idea what it does.

2. Why didn't you guys use the included math libraries? I'm not following your code entirely.


BTW, I love the rainbow "Teh Chezy Pofs Deta Lawgr"

Last edited by Jared : 06-23-2014 at 07:57 PM.
Reply With Quote
  #4   Spotlight this post!  
Unread 06-24-2014, 12:49 AM
Eugene Fang's Avatar
Eugene Fang Eugene Fang is offline
The Blue Alliance
FRC #0604 (Quixilver)
Team Role: Alumni
 
Join Date: Jan 2007
Rookie Year: 2000
Location: Bay Area, CA -> Pittsburgh, PA
Posts: 1,048
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 - 2014 FRC Code

Quote:
Originally Posted by Jared View Post
1. What is the negative inertia accumulator in Cheesy Drive? I've seen it in previous code releases, but I have no idea what it does.
Typically when you command a robot to rotate and then let go of the joysticks, it may continue to turn slightly due to inertia. The negative inertia in Cheesy Drive reduces (prevents?) this turning overshoot and makes the robot more intuitive to drive.
__________________
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-Present)
FRC Team 1323 - Mentor/Remote Advisor (2011-2014)

The Blue Alliance | TBA GameDay | TBA Android App | TBA Blog | TBA Swag
Reply With Quote
  #5   Spotlight this post!  
Unread 06-24-2014, 07:40 AM
orangelight's Avatar
orangelight orangelight is offline
Registered User
AKA: Alex
FRC #0548 (Robostangs)
Team Role: Alumni
 
Join Date: Feb 2014
Rookie Year: 2014
Location: Northville
Posts: 192
orangelight has much to be proud oforangelight has much to be proud oforangelight has much to be proud oforangelight has much to be proud oforangelight has much to be proud oforangelight has much to be proud oforangelight has much to be proud oforangelight has much to be proud oforangelight has much to be proud of
Re: Team 254 - 2014 FRC Code

How did the web app help with development?
__________________



Reply With Quote
  #6   Spotlight this post!  
Unread 06-24-2014, 08:52 AM
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 2,148
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Team 254 - 2014 FRC Code

Thanks Tom, I look forward to reading through your code.
Reply With Quote
  #7   Spotlight this post!  
Unread 06-24-2014, 10:56 AM
dougwilliams's Avatar
dougwilliams dougwilliams is offline
Engineer - Controls, Electronics
FRC #2053 (TigerTronics)
Team Role: Mentor
 
Join Date: May 2013
Rookie Year: 2013
Location: Vestal, NY
Posts: 151
dougwilliams is just really nicedougwilliams is just really nicedougwilliams is just really nicedougwilliams is just really nice
Re: Team 254 - 2014 FRC Code

Quote:
Originally Posted by Tom Bottiglieri View Post
...
If you have any questions please do not hesitate to ask...
Do you have any overall documentation on what the code is actually doing, a high level description document? It's not abundantly clear looking through the code how it all works, and what and why it's actually doing it (although in general it looks very well put together, partitioned, and coded).

Some questions:
What are the waypoints referencing and how were/are the derived?
What input is used to select a trajectory?
Are the trajectories/waypoints only used during autonomous or can you somehow pick a way point during teleop and minimize driver work-load?
Reply With Quote
  #8   Spotlight this post!  
Unread 06-24-2014, 01:29 PM
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,301
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
Re: Team 254 - 2014 FRC Code

Quote:
Originally Posted by dougwilliams View Post
Do you have any overall documentation on what the code is actually doing, a high level description document? It's not abundantly clear looking through the code how it all works, and what and why it's actually doing it (although in general it looks very well put together, partitioned, and coded).

Some questions:
What are the waypoints referencing and how were/are the derived?
What input is used to select a trajectory?
Are the trajectories/waypoints only used during autonomous or can you somehow pick a way point during teleop and minimize driver work-load?
Yeah, we can put something together. We really just wanted to get this out before the summer and haven't quite had the bandwidth to put this together yet.

The waypoint system is for autonomous only. Basically, you can specify a list of waypoints where the start of the path is (0,0,0) in (X,Y,Theta). We calculate a spline that intersects each waypoint at the desired angle. From there we generate a set of (Position, Velocity, Accel) for each wheel at 0.01 second time steps along that spline. This calculation is done off board as the spline formation is pretty cpu hungry. We serialize the data and load it on to the crio as a text file which gets deserialized. The trajectory construction happens in the TrajectoryLib project in Main.java. The trajectories get deserialized and stored in memory in AutoPaths.java.

In autonomous, we load a path into the TrajectoryDriveController and set the Drivebase subsystem's active controller to that. (Each subsystem can have one active controller which controls it).

We do some driver off-load things, but mostly for the operation of the intake and shooter subsystems (for example there is a button that deploys the intake and runs automatically until we sense we've picked up the ball, we only shoot for certain presets once the wheel is settled at speed, etc).
Reply With Quote
  #9   Spotlight this post!  
Unread 06-27-2014, 06:53 AM
notmattlythgoe's Avatar
notmattlythgoe notmattlythgoe is offline
Flywheel Police
AKA: Matthew Lythgoe
FRC #2363 (Triple Helix)
Team Role: Mentor
 
Join Date: Feb 2010
Rookie Year: 2009
Location: Newport News, VA
Posts: 2,148
notmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond reputenotmattlythgoe has a reputation beyond repute
Re: Team 254 - 2014 FRC Code

Ok Tom, you're going to have to help me understand some of these negative inertia steps as I really like the idea a lot.

Here you calculate what the negative inertia is between the last turn iteration and the the current one. So if you are turning full left and decide to stop the negInertia is 1 and the old turn value is now 0. Understood so far.
Code:
double negInertia = wheel - oldWheel;
oldWheel = wheel;
Next you determine your negative inertia scaling value based on high or low gear. Understood because you'll be turning faster in a higher gear and the robot is not going to want to slow down as quickly in high gear so more drift meaning a higher scaling value is needed. Still following.
Code:
double negInertiaAccumulator = 0.0;
double negInertiaScalar;
if (isHighGear) {
     negInertiaScalar = 5.0;
     sensitivity = Constants.sensitivityHigh.getDouble();
} else {
     if (wheel * negInertia > 0) {
          negInertiaScalar = 2.5;
      } else {
          if (Math.abs(wheel) > 0.65) {
               negInertiaScalar = 5.0;
          } else {
               negInertiaScalar = 3.0;
          }
      }
      sensitivity = Constants.sensitivityLow.getDouble();
 }
Next you calculate what power you're going to need by multiplying your negative inertia by the scaling value and add this to the accumulator value. Then you add this value to your turn value to counter the inertia. Still following.
Code:
double negInertiaPower = negInertia * negInertiaScalar;
negInertiaAccumulator += negInertiaPower;

wheel = wheel + negInertiaAccumulator;
This is where you lose me. From what I understand from this next bit of code you are increasing/decreasing the inertia accumulator by 1 to get it closer to zero, if it is -1 <= x >= 1 then you set it to 0. This makes sense as you'll want the negative inertia to get smaller as the robot slows down. Where I'm lost is the fact that negInertiaAccumulator is never used again in this method, and it's a local variable so its lost after the method is complete. This means on the next run through of this method all of the negative inertia work is lost and the correction is only done for one iteration. What am I missing?
Code:
if (negInertiaAccumulator > 1) {
      negInertiaAccumulator -= 1;
} else if (negInertiaAccumulator < -1) {
      negInertiaAccumulator += 1;
} else {
      negInertiaAccumulator = 0;
}

Last edited by notmattlythgoe : 06-27-2014 at 06:55 AM.
Reply With Quote
  #10   Spotlight this post!  
Unread 06-28-2014, 09:48 PM
Thad House Thad House is offline
Volunteer, WPILib Contributor
no team (Waiting for 2021)
Team Role: Mentor
 
Join Date: Feb 2011
Rookie Year: 2010
Location: Thousand Oaks, California
Posts: 1,191
Thad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond reputeThad House has a reputation beyond repute
Re: Team 254 - 2014 FRC Code

Quote:
Originally Posted by Tom Bottiglieri View Post
Yeah, we can put something together. We really just wanted to get this out before the summer and haven't quite had the bandwidth to put this together yet.

The waypoint system is for autonomous only. Basically, you can specify a list of waypoints where the start of the path is (0,0,0) in (X,Y,Theta). We calculate a spline that intersects each waypoint at the desired angle. From there we generate a set of (Position, Velocity, Accel) for each wheel at 0.01 second time steps along that spline. This calculation is done off board as the spline formation is pretty cpu hungry. We serialize the data and load it on to the crio as a text file which gets deserialized. The trajectory construction happens in the TrajectoryLib project in Main.java. The trajectories get deserialized and stored in memory in AutoPaths.java.

In autonomous, we load a path into the TrajectoryDriveController and set the Drivebase subsystem's active controller to that. (Each subsystem can have one active controller which controls it).

We do some driver off-load things, but mostly for the operation of the intake and shooter subsystems (for example there is a button that deploys the intake and runs automatically until we sense we've picked up the ball, we only shoot for certain presets once the wheel is settled at speed, etc).
That trajectory stuff is so cool. No wonder you guys are world champions. And it makes the actually robot code so much more simple. We might actually look into doing something similar but even for just straight lines. Should allow much more accurate autos. Plus the simpler the robot code the better.
__________________
All statements made are my own and not the feelings of any of my affiliated teams.
Teams 1510 and 2898 - Student 2010-2012
Team 4488 - Mentor 2013-2016
Co-developer of RobotDotNet, a .NET port of the WPILib.
Reply With Quote
  #11   Spotlight this post!  
Unread 06-28-2014, 09:54 PM
magnets's Avatar
magnets magnets is offline
Registered User
no team
 
Join Date: Jun 2013
Rookie Year: 2012
Location: United States
Posts: 751
magnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond repute
Re: Team 254 - 2014 FRC Code

Quote:
Originally Posted by Jared View Post
2. Why didn't you guys use the included math libraries? I'm not following your code entirely.
I don't know why they didn't use the included math libraries, which AFAIK would return the exact same values as theirs does, but "their" code comes from here.

http://developer.nokia.com/community...acos-asin-atan
Reply With Quote
  #12   Spotlight this post!  
Unread 06-29-2014, 01:05 AM
AustinSchuh AustinSchuh is offline
Registered User
FRC #0971 (Spartan Robotics) #254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Feb 2005
Rookie Year: 1999
Location: Los Altos, CA
Posts: 886
AustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond reputeAustinSchuh has a reputation beyond repute
Re: Team 254 - 2014 FRC Code

Quote:
Originally Posted by notmattlythgoe View Post
Where I'm lost is the fact that negInertiaAccumulator is never used again in this method, and it's a local variable so its lost after the method is complete. This means on the next run through of this method all of the negative inertia work is lost and the correction is only done for one iteration. What am I missing?
Good catch. That's a bug. The original C++ code from 2011 had the accumulator as a member variable.
Reply With Quote
  #13   Spotlight this post!  
Unread 07-03-2014, 08:52 PM
Jared's Avatar
Jared Jared is offline
Registered User
no team
Team Role: Programmer
 
Join Date: Aug 2013
Rookie Year: 2012
Location: Connecticut
Posts: 607
Jared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond reputeJared has a reputation beyond repute
Re: Team 254 - 2014 FRC Code

I've been playing around with the trajectory planning software, and I'm working on an application to quickly input waypoints, visualize output, then FTP to cRIO.

Right now, I'm got it set up so that I can input a bunch of waypoints and have it spit out graphs of robot position, and the trajectories are really amazing. The path is smooth and makes sense, and robot motion is super smooth.

There is one possible bug that I've seen. Sometimes it makes a path that travels the correct x and y distance, but doesn't start at (0,0). Usually it does. Maybe I'm just not understanding it right?

The only thing I haven't been able to make it do is a full 180 degree turn.

See some pictures here:
http://imgur.com/a/Q4RPw

The program-a work in progress- (which is fun to play with):

https://drive.google.com/folderview?...&usp=sha ring

How exactly does the calculation for finding the splines work? Would there be a way to modify it so that you can enter a waypoint that is just a position, and has no heading?

Last edited by Jared : 07-03-2014 at 08:55 PM.
Reply With Quote
  #14   Spotlight this post!  
Unread 07-04-2014, 10:58 AM
Tom Bottiglieri Tom Bottiglieri is offline
Registered User
FRC #0254 (The Cheesy Poofs)
Team Role: Engineer
 
Join Date: Jan 2004
Rookie Year: 2003
Location: San Francisco, CA
Posts: 3,301
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
Re: Team 254 - 2014 FRC Code

Quote:
Originally Posted by Jared View Post
I've been playing around with the trajectory planning software, and I'm working on an application to quickly input waypoints, visualize output, then FTP to cRIO.

Right now, I'm got it set up so that I can input a bunch of waypoints and have it spit out graphs of robot position, and the trajectories are really amazing. The path is smooth and makes sense, and robot motion is super smooth.

There is one possible bug that I've seen. Sometimes it makes a path that travels the correct x and y distance, but doesn't start at (0,0). Usually it does. Maybe I'm just not understanding it right?

The only thing I haven't been able to make it do is a full 180 degree turn.

See some pictures here:
http://imgur.com/a/Q4RPw

The program-a work in progress- (which is fun to play with):

https://drive.google.com/folderview?...&usp=sha ring

How exactly does the calculation for finding the splines work? Would there be a way to modify it so that you can enter a waypoint that is just a position, and has no heading?
So one of the caveats of the Trajectory generator that I forgot to mention is that it does not account for motor saturation. If you try to make a turn too quickly and the motors cannot keep up, it will go off path. We had thought about building something that could fix the cross track error but it was just easier to make safe paths.
Reply With Quote
  #15   Spotlight this post!  
Unread 07-04-2014, 01:02 PM
magnets's Avatar
magnets magnets is offline
Registered User
no team
 
Join Date: Jun 2013
Rookie Year: 2012
Location: United States
Posts: 751
magnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond repute
Re: Team 254 - 2014 FRC Code

Quote:
Originally Posted by Jared View Post
I've been playing around with the trajectory planning software, and I'm working on an application to quickly input waypoints, visualize output, then FTP to cRIO.

Right now, I'm got it set up so that I can input a bunch of waypoints and have it spit out graphs of robot position, and the trajectories are really amazing. The path is smooth and makes sense, and robot motion is super smooth.

There is one possible bug that I've seen. Sometimes it makes a path that travels the correct x and y distance, but doesn't start at (0,0). Usually it does. Maybe I'm just not understanding it right?

The only thing I haven't been able to make it do is a full 180 degree turn.

See some pictures here:
http://imgur.com/a/Q4RPw

The program-a work in progress- (which is fun to play with):

https://drive.google.com/folderview?...&usp=sha ring

How exactly does the calculation for finding the splines work? Would there be a way to modify it so that you can enter a waypoint that is just a position, and has no heading?
I'd like to try your program, but the file linked isn't working for me.

I'm not 100% exactly sure how 254's code works, but I'd be willing to bet it uses something similar to what is described in this article. They can just chain the splines together and end up with a continuous and differentiable (smooth) curve because they can set the slope at the beginning and end of each segment equal.
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 08:24 PM.

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


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