Go to Post My team does what works for my team. Let your team do the same. - Alexa Stott [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

 
Closed Thread
Thread Tools Rating: Thread Rating: 9 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 30-03-2013, 10:33
mkadonoff's Avatar
mkadonoff mkadonoff is offline
Programming Mentor
AKA: Mark Kadonoff
FRC #0620 (Warbots)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Vienna, VA
Posts: 6
mkadonoff is an unknown quantity at this point
RobotBuilder Subsystems with multiple PID loops

We used RobotBuilder to generate CommandRobot java code for Ultimate Ascent 2013, with a gyro in a DriveTrain PIDSubsystem for horizontal angle feedback and a gyro in an Elevator PIDSubsystem for vertical angle feedback.

During build season we also implemented encoder feedback for the drive train, but we couldn't figure out a clean way to include both the encoders and gyro as PIDControllers in one DriveTrain Subsystem.

RobotBuilder only allows one PIDController per subsystem, and no nested Subsystems, so we removed the encoders for this season. However, I'd like to figure out a good way to handle this for next year. Any thoughts on how to implement a CommandRobot Subsystem with multiple PID loops in RobotBuilder?

Mark Kadonoff
Programming Mentor
JMHS Warbots Team 620
__________________
Mark Kadonoff
Programming Mentor
JMHS Warbots Team 620
2009 DC Regional Finalist
2013 Pittsburgh Regional Finalist

Last edited by mkadonoff : 30-03-2013 at 11:04.
  #2   Spotlight this post!  
Unread 30-03-2013, 10:50
Ziv Ziv is offline
Has code to be writing...
FRC #0125 (Nutrons)
Team Role: Alumni
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Boston
Posts: 39
Ziv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of light
Re: RobotBuilder Subsystems with multiple PID loops

Robot Builder is great for quickly coding common patterns. For uncommon patterns (like the one you describe), you'll have to modify the automatically generated Java/C++ code yourself. If your team is new to the language, looking at how one PID controller is implemented by the generated code is very helpful in figuring out how to implement the second.
  #3   Spotlight this post!  
Unread 30-03-2013, 11:09
mkadonoff's Avatar
mkadonoff mkadonoff is offline
Programming Mentor
AKA: Mark Kadonoff
FRC #0620 (Warbots)
Team Role: Mentor
 
Join Date: Jan 2008
Rookie Year: 2007
Location: Vienna, VA
Posts: 6
mkadonoff is an unknown quantity at this point
Ziv, a vehicle with PID loops for translation and rotation seems like a common pattern to me. Maybe RobotBuilder can be enhanced to include additional Subsystems. Thanks.
__________________
Mark Kadonoff
Programming Mentor
JMHS Warbots Team 620
2009 DC Regional Finalist
2013 Pittsburgh Regional Finalist
  #4   Spotlight this post!  
Unread 01-04-2013, 13:47
krieck's Avatar
krieck krieck is offline
Registered User
AKA: Keith
FRC #2846 (Firebears)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Minnesota
Posts: 49
krieck is an unknown quantity at this point
Re: RobotBuilder Subsystems with multiple PID loops

This sounds challenging whether you use Robot Builder or code from scratch.

A PID controller takes an input and an output. In this example, you have two different kinds of inputs (gyro and encoders) feeding to a single output system (the drive train).

Is this really a common task? I'd be very interested how others have combined PID logic within a subsystem.
  #5   Spotlight this post!  
Unread 01-04-2013, 13:56
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: RobotBuilder Subsystems with multiple PID loops

We used RobotBuilder to define the chassis subsystem and the sensors (two encoders and a gyro), but then added the PIDControllers ourselves. You can see more details in the following thread: http://www.chiefdelphi.com/forums/sh...d.php?t=114061
  #6   Spotlight this post!  
Unread 01-04-2013, 14:09
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: RobotBuilder Subsystems with multiple PID loops

Quote:
Originally Posted by krieck View Post
Is this really a common task? I'd be very interested how others have combined PID logic within a subsystem.
We have often implemented drivebase position and heading as feedback-controlled parameters in autonomous. I can only remember one year that we made it available to the driver in teleop, as an optional "bulldog mode". It was occasionally useful when trying to hang tubes on the Rack & Roll spider legs in the presence of strong defense.

The way we did it, the PID computations were separate, and their outputs were mixed to send to the motors in the manner of arcade joystick control. For the RobotBuilder scheme, perhaps the "speed" and "steer" can be considered distinct subsystems that don't actually control motors, but instead just set global variables. The final "chassis" subsystem will have a background command that controls the motors based on reading the variables.
  #7   Spotlight this post!  
Unread 01-04-2013, 14:23
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: RobotBuilder Subsystems with multiple PID loops

If you are seriously limited in your control system design by arbitrary limitations imposed by an autocoding tool or framework, then maybe the autocoding tool or framework is not the correct way to write the code you need.

Basically, you should just write the code manually. The code itself is only a few lines long (including the PID control math) and should be small enough to fit in a single function.

I've always seen the RobotBuilder and command-based frameorks as large inefficient beasts which impose so many design limitations on algorithm code that in almost all cases you are better off without them.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
Closed Thread


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 03:30.

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