Go to Post Please forgive any possible profound language. - PortugazD.Ace [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 Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 13-02-2016, 17:11
powster powster is offline
Registered User
FRC #1148
Team Role: Leadership
 
Join Date: Jan 2016
Rookie Year: 2013
Location: LA
Posts: 19
powster is an unknown quantity at this point
How to display motor speed for PID Tuning

Hi guys. I'm trying to tune my PID system for my shooter and I want to use SmartDashboard to find the right values. However, in the PIDTestSystem, while I can change the values and see the result in the motor, I can't see the speed of the motor. I put the PID type as Rate, but it still won't show. Any ideas how I can view the speed of how fast the motor shaft is spinning? I can't seem to write it to smartdashboard either.
  #2   Spotlight this post!  
Unread 13-02-2016, 17:33
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: 395
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: How to display motor speed for PID Tuning

You can see the current motor voltage set by your motor controller if you're using CAN. Use the GetOutputVoltage method on your motor controller object and send it to SmartDashboard.

If you want to see actual speed, you'll need an encoder on your drive. Then, you'll need to periodically read the encoder and convert the value into rotations, degrees, or whatever you need. Then divide the amount that it has changed by the time since your last read the value (typically 1/50 sec if nothing is bogging down your program loop). That should give you the velocity.
  #3   Spotlight this post!  
Unread 13-02-2016, 17:36
powster powster is offline
Registered User
FRC #1148
Team Role: Leadership
 
Join Date: Jan 2016
Rookie Year: 2013
Location: LA
Posts: 19
powster is an unknown quantity at this point
Re: How to display motor speed for PID Tuning

I have an encoder on the motor shaft, but it won't put the ReturnPIDInput value (which is supposed to be the value I need) to SmartDashboard. It just returns 0.000
  #4   Spotlight this post!  
Unread 13-02-2016, 18:54
dlsmith dlsmith is offline
Registered User
FRC #5268
 
Join Date: Feb 2016
Location: BioMech Falcons
Posts: 15
dlsmith is an unknown quantity at this point
Re: How to display motor speed for PID Tuning

You can read the speed controller values also. For instance, our team's code does this in c++

SmartDashboard:: PutNumber("Speed Controller 1", speedController1->Get());

It's not the true PID speed of the encoder but gives you a general idea what it's doing.

Last edited by dlsmith : 13-02-2016 at 18:56. Reason: Didn't mean to show emoji.
  #5   Spotlight this post!  
Unread 13-02-2016, 19:08
powster powster is offline
Registered User
FRC #1148
Team Role: Leadership
 
Join Date: Jan 2016
Rookie Year: 2013
Location: LA
Posts: 19
powster is an unknown quantity at this point
Re: How to display motor speed for PID Tuning

Thanks for that tip. However, when I tried it it just gave me .5 the entire time, which was simply the set point value I was trying to achieve. I don't think this estimate will work for me since I'm just trying to reach this setpoint though

I worry that the smartdashboard values just aren't updating as I go along and that's why they all only give me 0...
  #6   Spotlight this post!  
Unread 13-02-2016, 19:37
dlsmith dlsmith is offline
Registered User
FRC #5268
 
Join Date: Feb 2016
Location: BioMech Falcons
Posts: 15
dlsmith is an unknown quantity at this point
Re: How to display motor speed for PID Tuning

Yeah, our bot uses some older non-CAN Talons so the fancy PID modes on yours probably don't work the same way. I'm sure there is a way to get there but would have to check the wpilib to find out. Good luck!
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 01:32.

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