Go to Post Remember: "It's not the strongest that survive, but the most adaptable to change" - Daniel_LaFleur [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
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 31-01-2011, 14:41
Ceebs03 Ceebs03 is offline
Registered User
FRC #2621
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Bedford MA
Posts: 8
Ceebs03 is an unknown quantity at this point
CAN, PID, Mecanums

My team is using mecanums and CAN, and I want to use the KOP encoders and the PID on the jags to make sure the wheels spin the right speed.

I believe to do this I need to open each motor individually in speed mode, set the PID values, and then plug them in to a four motor drive of "existing motors"

My questions are:
Do I need to change the holonomic drive VI to make it work with speed mode?

Do I need to use speed mode to do this, or is there a way to do it with Percent
VBus (which should work unmodified with the holonomic drive VI, right?)?

I need to "tune" my PID right? what is the recommended method for doing this? I know trial and error is common, do I need to test with the whole robot, or can I use BDC-COMM?
Reply With Quote
  #2   Spotlight this post!  
Unread 02-02-2011, 13:37
IisMathwizard's Avatar
IisMathwizard IisMathwizard is offline
Programming Mentor
AKA: Mathwizard
FRC #1248 (Titanium Allies)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Berea-Midpark High school
Posts: 60
IisMathwizard is an unknown quantity at this point
Re: CAN, PID, Mecanums

Quote:
Originally Posted by Ceebs03 View Post
I need to "tune" my PID right? what is the recommended method for doing this? I know trial and error is common, do I need to test with the whole robot, or can I use BDC-COMM?
I can help with this...
Im my opinion although you could use the BDC-COMM it is best to do manual calibration because you can set it yourself and make sure you have a working PID.
__________________

jRIO 2013 Project
Reply With Quote
  #3   Spotlight this post!  
Unread 02-02-2011, 15:28
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: CAN, PID, Mecanums

Quote:
Originally Posted by Ceebs03 View Post
My team is using mecanums and CAN, and I want to use the KOP encoders and the PID on the jags to make sure the wheels spin the right speed.

I believe to do this I need to open each motor individually in speed mode, set the PID values, and then plug them in to a four motor drive of "existing motors"
Yes.
Quote:
My questions are:
Do I need to change the holonomic drive VI to make it work with speed mode?
Yes, the Holonomic Drive VI is designed to work with a magnitude of -1 to 1. You can find a "max output speed" parameter in the RobotDrive ref, and multiply this as done in Arcade Drive.

Quote:
Do I need to use speed mode to do this, or is there a way to do it with Percent
VBus (which should work unmodified with the holonomic drive VI, right?)?
I would highly recommend using speed mode. Percent vBus will work with the default VI, but it doesn't provide good low-speed control or repeatability.
Quote:
I need to "tune" my PID right? what is the recommended method for doing this? I know trial and error is common, do I need to test with the whole robot, or can I use BDC-COMM?
Trial and error is probably best, because it will give you an understanding of how the different parameters affect it. You can do this with the BDC-COMM, but be sure to write them down; these parameters are not retained when the Jaguar looses power.
__________________
-- Marshal Horn
Reply With Quote
  #4   Spotlight this post!  
Unread 02-02-2011, 15:40
IisMathwizard's Avatar
IisMathwizard IisMathwizard is offline
Programming Mentor
AKA: Mathwizard
FRC #1248 (Titanium Allies)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2009
Location: Berea-Midpark High school
Posts: 60
IisMathwizard is an unknown quantity at this point
Re: CAN, PID, Mecanums

i don't understand why you have to use speed instead of the regular
__________________

jRIO 2013 Project
Reply With Quote
  #5   Spotlight this post!  
Unread 08-02-2011, 18:59
Ceebs03 Ceebs03 is offline
Registered User
FRC #2621
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Bedford MA
Posts: 8
Ceebs03 is an unknown quantity at this point
Re: CAN, PID, Mecanums

The robot is currently not moving at all when the joysticks are moved.

I know it is either a problem with the encoders or with my code, but I can't be sure which. The robot previously moved when being controlled by different code using percent vbus, so I know the other wiring is correct.

Here's what i'm currently doing in my code:

in begin vi:
i open a can reference to each motor, specifying speed mode, device number, and whether or not it is inverted. then I "set speed ref" using "quad encoder" as the speed reference (correct for KOP encoders?). I "set PID" constants, and then I enable the motors. I currently have my PID constants set as P: 0.1 I: 0.004 D: 0. Are these reasonable for mecanums directly driven by toughboxes? If not, could someone give me an explanation oof the process of manual tuning so I can be sure I did it correctly? The motors are then wired into a 4 motor drive of "existing motors" and the "max output" is set. (this should be the top speed in rpm, right?)

in teleop vi:
x and y axis are wired to x and y of a holonomic drive, and x axis of another joystick is wired to rotation

The robot does not move at all and the colors on the jaguars do not change, even when the joysticks are pushed fully in any direction. I believe the problem is in one of 3 places: wiring of the encoders, logic of my code, or values of my pid constants.
Reply With Quote
  #6   Spotlight this post!  
Unread 08-02-2011, 21:04
kamocat's Avatar
kamocat kamocat is offline
Test Engineer
AKA: Marshal Horn
FRC #3213 (Thunder Tech)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 2008
Location: Tacoma
Posts: 894
kamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nicekamocat is just really nice
Send a message via AIM to kamocat Send a message via MSN to kamocat
Re: CAN, PID, Mecanums

Well, we know that the wiring of your encoders is not the issue right now. If that were the case, the Jaguars would go full-speed FWD when you pushed forward, and full-speed REV when you went reverse.

My first guess would be that you haven't set the "max RPM" in the OpenExistingMotors VI, and that you haven't set the number of lines on the encoder.
If you're on tough boxes with CIMs, the max RPM should be about 4500 / 12.6, which is around 350 RPM. The default is 1.
__________________
-- Marshal Horn
Reply With Quote
  #7   Spotlight this post!  
Unread 09-02-2011, 19:55
Ceebs03 Ceebs03 is offline
Registered User
FRC #2621
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Bedford MA
Posts: 8
Ceebs03 is an unknown quantity at this point
Re: CAN, PID, Mecanums

It was in fact a failure to set the encoder lines in the open vi.

Now I have another mostly unrelated problem. The joysticks we are using no longer spring back perfectly to center, so the robot moves slightly even when the joysticks are not being touched. I looked up the jaguar calibration and found that it appeared to only apply to pwm. Is there a similar process for CAN or a way i can correct for it in the code?
Reply With Quote
  #8   Spotlight this post!  
Unread 09-02-2011, 21:49
Bot190's Avatar
Bot190 Bot190 is offline
Registered User
FRC #0166 (ChopShop)
Team Role: Programmer
 
Join Date: Sep 2009
Rookie Year: 2009
Location: Merrimack NH
Posts: 105
Bot190 will become famous soon enough
Re: CAN, PID, Mecanums

Calibrating the jaguars isn't what you want to do anyway. What you need to do is implement a dead band on your joystick inputs. Basically you take any values less than some value, say 0.02 or something, and set it to 0.00. That way even if the joystick doesn't center itself completely, your robot won't be moving.
__________________

Reply With Quote
  #9   Spotlight this post!  
Unread 14-02-2011, 21:13
Ceebs03 Ceebs03 is offline
Registered User
FRC #2621
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2009
Location: Bedford MA
Posts: 8
Ceebs03 is an unknown quantity at this point
Re: CAN, PID, Mecanums

I tried implementing a dead band, and it didn't work as expected. The robot will not move at all with the dead band in place. I made a VI to handle the dead band so the teleop is cleaner and it can be reusable...

I have attached screen shots and the VI itself. If someone could help me debug it that would be great.

thanks
Attached Thumbnails
Click image for larger version

Name:	deadband_use_screenchot.jpg
Views:	19
Size:	38.3 KB
ID:	10115  Click image for larger version

Name:	deadband_true_screenchot.jpg
Views:	21
Size:	70.6 KB
ID:	10116  Click image for larger version

Name:	deadband_false_screenchot.jpg
Views:	17
Size:	69.7 KB
ID:	10117  
Attached Files
File Type: vi deadband.vi (8.6 KB, 5 views)
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 10:15.

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