Go to Post Keep your chin up, your safety glasses on, and don't let the magic smoke out of the electrical components and you'll do just fine :) - rsegrest [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
Thread Tools Rating: Thread Rating: 7 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 29-03-2015, 14:09
WillNess's Avatar
WillNess WillNess is offline
Programmer
AKA: Will Ness
FRC #4944 (The Hi Fives)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: United States
Posts: 90
WillNess is just really niceWillNess is just really niceWillNess is just really niceWillNess is just really nice
Question PID & One Second Delay Between Auto and TeleOp

This year we have a giant arm that sticks behind our robot, with two joints. At the end of an arm is a claw. One of our autonomous modes is that the both parts will drop down, our robot will drive backwards, our claw will close on the bin on the center step, and the arm will then fold up and set the bin so that it is resting on our robot while still grabbing the bin. The problem is, during the one second between autonomous and teleop, our PID is disabled so the arm droops a little and some of the time we drop that bin. I've temporarily fixed the problem by storing the bin in a different position where if the PID disables none of the parts of the arm will droop, but it is vital for our drivers to start in the docked position.
So:
- Is it possible to operate the PID during this 1 second delay?
- Is this delay considered "disabledPeriodic"
- Are there any other fixes?
__________________

Outreach Lead // Lead Programmer // Junior

2014 FRC:
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Utah
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Colorado
2015 FRC:
Creativity In Engineering & Semifinalist @ Arizona West
Reply With Quote
  #2   Spotlight this post!  
Unread 29-03-2015, 14:14
GeeTwo's Avatar
GeeTwo GeeTwo is online now
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,687
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: PID & One Second Delay Between Auto and TeleOp

Something to try:

After the arm has reached the proper position and stabilized, get the voltage setting for the motor, set that voltage and disable the PID (or perhaps swap the order). This setting seems more likely to survive the transition from auto to teleop.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #3   Spotlight this post!  
Unread 29-03-2015, 14:31
MrRoboSteve MrRoboSteve is offline
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 581
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
Re: PID & One Second Delay Between Auto and TeleOp

I believe the robot is in the disabled state during the period between autonomous and teleop, so no commanding will be sent to the motor controllers. Someone with a roboRIO at hand could validate that.

Without seeing your mechanism, it's hard to picture what would work. Bungees or constant force springs are often used in similar scenarios when you need a balancing force.
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
Reply With Quote
  #4   Spotlight this post!  
Unread 29-03-2015, 14:32
WillNess's Avatar
WillNess WillNess is offline
Programmer
AKA: Will Ness
FRC #4944 (The Hi Fives)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: United States
Posts: 90
WillNess is just really niceWillNess is just really niceWillNess is just really niceWillNess is just really nice
Re: PID & One Second Delay Between Auto and TeleOp

GeeTwo:

I tried creating two variables and setting it to the .getAverageVoltage() for each potentiometer on the arm during Auto Periodic and then in TeleOpInit I would set the setPoint for each part of the arm to their respective variable but I didn't seem to get the arm to jump back up to its previous position, and sometimes the first part of the arm had drooped too much and the bin had already fell.
__________________

Outreach Lead // Lead Programmer // Junior

2014 FRC:
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Utah
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Colorado
2015 FRC:
Creativity In Engineering & Semifinalist @ Arizona West
Reply With Quote
  #5   Spotlight this post!  
Unread 29-03-2015, 14:42
GeeTwo's Avatar
GeeTwo GeeTwo is online now
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,687
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: PID & One Second Delay Between Auto and TeleOp

Quote:
Originally Posted by WillNess View Post
GeeTwo:

I tried creating two variables and setting it to the .getAverageVoltage() for each potentiometer on the arm during Auto Periodic and then in TeleOpInit I would set the setPoint for each part of the arm to their respective variable but I didn't seem to get the arm to jump back up to its previous position, and sometimes the first part of the arm had drooped too much and the bin had already fell.
I was referring to the voltage applied to the motor (throttle, PID output value to actuator), not the voltage returned from the potentiometer (PID input value from sensor).
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #6   Spotlight this post!  
Unread 29-03-2015, 14:42
WillNess's Avatar
WillNess WillNess is offline
Programmer
AKA: Will Ness
FRC #4944 (The Hi Fives)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: United States
Posts: 90
WillNess is just really niceWillNess is just really niceWillNess is just really niceWillNess is just really nice
Re: PID & One Second Delay Between Auto and TeleOp


Above is the image of what we call our "Stinger"
It has two parts:
The shoulder and the elbow.
The shoulder is the bottom part and the elbow is the part that is turned, think of it as an actual human arm where the joint is where the elbow starts.
This is our old docked position, now our shoulder is a little farther up so it's not at 0 degrees.
__________________

Outreach Lead // Lead Programmer // Junior

2014 FRC:
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Utah
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Colorado
2015 FRC:
Creativity In Engineering & Semifinalist @ Arizona West
Reply With Quote
  #7   Spotlight this post!  
Unread 29-03-2015, 14:46
GeeTwo's Avatar
GeeTwo GeeTwo is online now
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,687
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: PID & One Second Delay Between Auto and TeleOp

Also, are you using the same motor controller object between auto and tele? Declaring a new motor controller at the beginning of teleop would presumably reset the throttle to zero.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #8   Spotlight this post!  
Unread 29-03-2015, 14:50
WillNess's Avatar
WillNess WillNess is offline
Programmer
AKA: Will Ness
FRC #4944 (The Hi Fives)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: United States
Posts: 90
WillNess is just really niceWillNess is just really niceWillNess is just really niceWillNess is just really nice
Re: PID & One Second Delay Between Auto and TeleOp

Quote:
Originally Posted by GeeTwo View Post
Also, are you using the same motor controller object between auto and tele? Declaring a new motor controller at the beginning of teleop would presumably reset the throttle to zero.

Yes. The only time we declare motor controllers is in robotInit.
__________________

Outreach Lead // Lead Programmer // Junior

2014 FRC:
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Utah
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Colorado
2015 FRC:
Creativity In Engineering & Semifinalist @ Arizona West
Reply With Quote
  #9   Spotlight this post!  
Unread 29-03-2015, 14:54
GeeTwo's Avatar
GeeTwo GeeTwo is online now
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,687
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: PID & One Second Delay Between Auto and TeleOp

Glad to see the picture - not what I hand in mind (I was thinking of an overhead arm). Putting the arm vertical or nearly vertical leaning against the tall frame would presumably handle the temporary "storing the bin in a different position where if the PID disables none of the parts of the arm will droop".

Would it help if you used your temporary solution, then at the beginning of teleop, the robot automatically moved the arm to the "docked" position, without waiting on driver input?
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #10   Spotlight this post!  
Unread 29-03-2015, 15:27
WillNess's Avatar
WillNess WillNess is offline
Programmer
AKA: Will Ness
FRC #4944 (The Hi Fives)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: United States
Posts: 90
WillNess is just really niceWillNess is just really niceWillNess is just really niceWillNess is just really nice
Re: PID & One Second Delay Between Auto and TeleOp

Quote:
Originally Posted by GeeTwo View Post
Glad to see the picture - not what I hand in mind (I was thinking of an overhead arm). Putting the arm vertical or nearly vertical leaning against the tall frame would presumably handle the temporary "storing the bin in a different position where if the PID disables none of the parts of the arm will droop".

Would it help if you used your temporary solution, then at the beginning of teleop, the robot automatically moved the arm to the "docked" position, without waiting on driver input?
That sounds like a good idea.
What I'm doing temporarily is bringing the shoulder back down to 0 degrees, and then making the elbow go to 90 degrees, in which nothing falls.
I guess at teleop init I could set both of the positions to go to docked position.
Which raises another question:
- Is there any way to do something only if the robot is in practice mode or playing an actual match?
__________________

Outreach Lead // Lead Programmer // Junior

2014 FRC:
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Utah
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Colorado
2015 FRC:
Creativity In Engineering & Semifinalist @ Arizona West
Reply With Quote
  #11   Spotlight this post!  
Unread 29-03-2015, 15:45
MrRoboSteve MrRoboSteve is offline
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 581
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
Re: PID & One Second Delay Between Auto and TeleOp

DriverStation::IsFMSAttached() helps you with part of your question.
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
Reply With Quote
  #12   Spotlight this post!  
Unread 29-03-2015, 15:48
Ben Wolsieffer Ben Wolsieffer is offline
Dartmouth 2020
AKA: lopsided98
FRC #2084 (Robots by the C)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2011
Location: Manchester, MA (Hanover, NH)
Posts: 520
Ben Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud ofBen Wolsieffer has much to be proud of
Re: PID & One Second Delay Between Auto and TeleOp

Quote:
Originally Posted by WillNess View Post
- Is there any way to do something only if the robot is in practice mode or playing an actual match?
You could use:
Code:
DriverStation.getInstance().isFMSAttached()
to detect whether the robot is connected to the field, but I don't think this works for practice mode.
__________________



2016 North Shore District - Semifinalists and Excellence in Engineering Award
2015 Northeastern University District - Semifinalists and Creativity Award
2014 Granite State District - Semifinalists and Innovation in Control Award
2012 Boston Regional - Finalists
Reply With Quote
  #13   Spotlight this post!  
Unread 30-03-2015, 02:55
WillNess's Avatar
WillNess WillNess is offline
Programmer
AKA: Will Ness
FRC #4944 (The Hi Fives)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: United States
Posts: 90
WillNess is just really niceWillNess is just really niceWillNess is just really niceWillNess is just really nice
Re: PID & One Second Delay Between Auto and TeleOp

Do you guys think this would work?
Code:
robotInit(){
   boolean = false;
}
autonomousPeriodic(){
   boolean = true;
}
teleopInit(){
   if(boolean == true){
      shoulder.set(shoulderDocked);
      elbow.set(elbowDocked);
   }
   boolean = false;
}
The thing is I'd need to reset the roboRio if I wanted to ever test autonomous and teleop NOT in practice mode.
__________________

Outreach Lead // Lead Programmer // Junior

2014 FRC:
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Utah
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Colorado
2015 FRC:
Creativity In Engineering & Semifinalist @ Arizona West
Reply With Quote
  #14   Spotlight this post!  
Unread 30-03-2015, 03:04
WillNess's Avatar
WillNess WillNess is offline
Programmer
AKA: Will Ness
FRC #4944 (The Hi Fives)
Team Role: Programmer
 
Join Date: Apr 2014
Rookie Year: 2014
Location: United States
Posts: 90
WillNess is just really niceWillNess is just really niceWillNess is just really niceWillNess is just really nice
Re: PID & One Second Delay Between Auto and TeleOp

Or I could add
Code:
disabledInit(){
   Timer.start();
}
teleopInit(){
   if(Timer.getFPGATimestamp > 1.000){
      Timer.stop();
      Timer.reset();
   }else{
      shoulder.set(shoulderDocked);
      elbow.set(elbowDocked);
      Timer.stop();
      Timer.reset();
   }
 
}
Questions: Do I need the .stop() and .reset() or just one? does the .reset() start the timer again?
__________________

Outreach Lead // Lead Programmer // Junior

2014 FRC:
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Utah
Rookie Allstar, Highest Rookie Seed & Semifinalist @ Colorado
2015 FRC:
Creativity In Engineering & Semifinalist @ Arizona West
Reply With Quote
  #15   Spotlight this post!  
Unread 30-03-2015, 07:51
MrRoboSteve MrRoboSteve is offline
Mentor
AKA: Steve Peterson
FRC #3081 (Kennedy RoboEagles)
Team Role: Mentor
 
Join Date: Mar 2012
Rookie Year: 2011
Location: Bloomington, MN
Posts: 581
MrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond reputeMrRoboSteve has a reputation beyond repute
Re: PID & One Second Delay Between Auto and TeleOp

Remember you also have DisabledInit and DisabledPeriodic available.
__________________
2016-17 events: 10000 Lakes Regional, Northern Lights Regional, FTC Burnsville Qualifying Tournament

2011 - present · FRC 3081 Kennedy RoboEagles mentor
2013 - present · event volunteer at 10000 Lakes Regional, Northern Lights Regional, North Star Regional, Lake Superior Regional, Minnesota State Tournament, PNW District 4 Glacier Peak, MN FTC, CMP
http://twitter.com/MrRoboSteve · www.linkedin.com/in/speterson
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 13:06.

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