Go to Post FIRST is a life lesson on steroids. - JohnBoucher [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 08-15-2016, 10:06 PM
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 232
cpapplefamily has a spectacular aura aboutcpapplefamily has a spectacular aura about
PID onTarget() Updated

We been working with PIDcommands and through some searches came to the understanding that the onTarget() method had bugs and was unuseable this year. We came across a thread that mentioned it was repaired in an update to the wpilib so we ran the install new software in Eclips "FRC Plugins - http://first.wpi.edu/FRC/roborio/release/eclipse/"
Two things happened on didn't
First one of our subsystems that
Code:
extends PIDSubsystem implements SpeedController
found errors and needed to add unimplemented methods. It was:
Code:
@Override
	public void stopMotor() {
		// TODO Auto-generated method stub
		
	}
The second was we are getting an error on the console
Code:
ERROR 1 Robot Drive... Output Not updated often enough. java.lag.Thread.run(Thread.hava:745)
Error at java.lang.Thread.run(Thread.java:745): Robot Drive... Output Not updated often enough. 
Finnaly onTarget() still not worky

Any direction you can point us?
Reply With Quote
  #2   Spotlight this post!  
Unread 08-16-2016, 01:39 AM
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 298
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: PID onTarget() Updated

Could we get your full robot code please?
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #3   Spotlight this post!  
Unread 08-16-2016, 06:41 PM
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 232
cpapplefamily has a spectacular aura aboutcpapplefamily has a spectacular aura about
Re: PID onTarget() Updated

Here is a link to our Github. Enjoy the read

The working file is named SirAntsABot_Summer. If you brows up the tree there are progressive copies of the program of the summer "Copy SirAntsABot_Summer_YYYY_MM_DD_HHMM"
https://github.com/GraniteCiyGearhea...ntsABot_Summer

Last edited by cpapplefamily : 08-16-2016 at 06:43 PM.
Reply With Quote
  #4   Spotlight this post!  
Unread 08-16-2016, 10:23 PM
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 298
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: PID onTarget() Updated

Just a few notes with git:

- don't put binary files on git. That means you should add bin, build, and dist to your .gitignore
- don't manually version files. That's what git is for. Instead of "SirAntsABot_Summer_YYYY_MM_DD_HHMM", you can use branches or tags to keep track of the versions.
​ ​ ​ ​- use branches if you have several different versions of the code that you'd like to develop independently of each other
​ ​ ​ ​- use tags if there are previous versions of the code that you'd like to name for easy reference

Now looking at NordicSpeedController, I'm confused as to why you are extending SpeedController yourself. You shouldn't be doing that when you're just wrapping a CANTalon. Second, the Talons have built-in PID control which has a much faster update loop since it's internal to the Talon itself. Just connect the encoder directly to the Talon and call PID methods on the CANTalon object - see section 10 of the software manual and section 1.4 of the user's guide. The Talon's own PID also isn't subject to WPILib bugs (such as the one with onTarget()) so it's more reliable to use.
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #5   Spotlight this post!  
Unread 08-17-2016, 06:39 AM
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 232
cpapplefamily has a spectacular aura aboutcpapplefamily has a spectacular aura about
Re: PID onTarget() Updated

Thanks for the feed back and all really great points. This was my first year with competition robotics and the first year for the team with a full time technical mentor (Me). I personally never used a repository and the team specially. I understood the idea as you pointed out and likely should start now vs. latter using it properly.
Your right on the CANTalons but again as a new member my voice didn't have a vote in the correct way to use the controls properly. Just a matter of the dynamics of our team. (Lots of not enough time to do it right the first time so lets try a second) Anyhow I've been given the position of lead mentor so now we/I can try to figure out and demonstrate how to use the controls to their fullest ability and hopefully get some breakout boards to the team to test with.

Are you thinking its the "SeaLegs" drivetrain that is causing the error? Or is it the fact that we have two RobotDrive type objects.
Code:
RobotDrive robotDrive41 = RobotMap.driveTrainRobotDrive41

and

RobotDrive seaLegeDrive21 = RobotMap.seaLegsSeaLeg_Drive;
The robotDrive41 is our primary drive train (Wheels) the SeaLegs are a set of CAM'ed legs that walk the bot over obstacles.

The NorticSpeedControler was a bit of code team NorticStorm shared with us just after RecylingRush. It help a lot with that years drive train with driving low speed control of the robot. With this years WPILIB something broke even they said it reacted differently so the main drive went back to a more traditional configuration but with our "SeaLegs" it still seem to help with the control of the subsystem.
Reply With Quote
  #6   Spotlight this post!  
Unread 08-17-2016, 01:43 PM
euhlmann's Avatar
euhlmann euhlmann is offline
CTO, Programmer
AKA: Erik Uhlmann
FRC #2877 (LigerBots)
Team Role: Leadership
 
Join Date: Dec 2015
Rookie Year: 2015
Location: United States
Posts: 298
euhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud ofeuhlmann has much to be proud of
Re: PID onTarget() Updated

Quote:
Originally Posted by cpapplefamily View Post
The robotDrive41 is our primary drive train (Wheels) the SeaLegs are a set of CAM'ed legs that walk the bot over obstacles.
I see.

The second error you're getting kind of tells you what it is. You need to update the output of a RobotDrive on every iteration, unless you set it to 0. Your codebase is quite large so I can't find why updates aren't happening at the moment, but check to make sure your joystick commands are running at all times during teleop, etc.
__________________
Creator of SmartDashboard.js, an extensible nodejs/webkit replacement for SmartDashboard


https://ligerbots.org
Reply With Quote
  #7   Spotlight this post!  
Unread 08-17-2016, 07:22 PM
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 232
cpapplefamily has a spectacular aura aboutcpapplefamily has a spectacular aura about
Re: PID onTarget() Updated

Yep Lots to mill through. It could likely use some clean up clearing out old commented out lines and commands that are not used. Anyhow through this conversation I been Looking deeper into what maybe happening. I see the "Sealegs" subsystem has

Code:
 setDefaultCommand(new SeaLegs_Jog_FWD());
That Command never finishes and is constantly getting the joystick values and updating the SeaLegs motors. We do have other commands that requires the SeaLegs subsystem but they finnish and the default regains control.

Plus in the RobotMap when the RobotDrive object is created we set the Safety false
Code:
 seaLegsSeaLegDrive.setSafetyEnabled(false);
So I'm looking at the driveTrainRobotDrive41 created in the RobotMap. Robotbuilder generated this code.

Code:
driveTrainRobotDrive41.setSafetyEnabled(true);
        driveTrainRobotDrive41.setExpiration(0.1);
        driveTrainRobotDrive41.setSensitivity(0.5);
        driveTrainRobotDrive41.setMaxOutput(1.0);
Should we look at the .setExpiration(0.1) value? Specially if we are controlling the Subsystem in the temporary PID command " Drive_Spin_In_Place_PID_TrackTarget"?

Thanks for listening and being a sounding board.
Reply With Quote
  #8   Spotlight this post!  
Unread 08-17-2016, 07:35 PM
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 232
cpapplefamily has a spectacular aura aboutcpapplefamily has a spectacular aura about
Re: PID onTarget() Updated

Wait .1 or 100ms should have 5 code scans.
Reply With Quote
  #9   Spotlight this post!  
Unread 08-17-2016, 08:02 PM
cpapplefamily cpapplefamily is offline
Registered User
FRC #3244 (Granite City Gearheads)
Team Role: Mentor
 
Join Date: May 2015
Rookie Year: 2015
Location: Minnesota
Posts: 232
cpapplefamily has a spectacular aura aboutcpapplefamily has a spectacular aura about
Re: PID onTarget() Updated

I think I'm going to run these parts in the execute method to see if there is a part that is taking too long
Code:
private double t_loopstart, t_loopend, t_getCX, t_getSpin, t_setSetpoint;
Code:
// Called repeatedly when this Command is scheduled to run
    protected void execute() {
    	t_loopstart = timeSinceInitialized(); // seconds since startup
    	double cX = Robot.vision.my_Get_Xcenter();
    	t_getCX = timeSinceInitialized(); // seconds since startup
    	double spin = Robot.vision.my_SpinToTarget_Lookup(cX);
    	t_getSpin = timeSinceInitialized(); // seconds since startup
    	m_setpoint = Robot.driveTrain.my_Get_Gyro() + (spin*-1);
    	t_setSetpoint = timeSinceInitialized(); // seconds since startup
    	//getPIDController().setSetpointRelative(spin*-1);
    	getPIDController().setSetpoint(m_setpoint);
    	t_loopend = timeSinceInitialized(); // seconds since startup

        SmartDashboard.putNumber("t_loopstart", t_loopstart);
    	SmartDashboard.putNumber("t_getCX", t_getCX);
    	SmartDashboard.putNumber("t_getSpin", t_getSpin);
    	SmartDashboard.putNumber("t_setSetpoint", t_setSetpoint);
    	SmartDashboard.putNumber("t_loopend", t_loopend);
}
Then plot on line graphs
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:22 AM.

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