Go to Post "If a student CAN do it, a student SHOULD do it." - Mr. Lim [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 07-02-2015, 17:16
goldenguy00 goldenguy00 is offline
Registered User
FRC #0619
 
Join Date: Feb 2015
Location: Virginia
Posts: 4
goldenguy00 is an unknown quantity at this point
Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

We have the mecanum wheels set up to properly move in the Y (forwards and back) direction and to turn without any problems, but when attempting to strafe, the robot veers off to one side instead of going straight to the side. To fix this, we are using encoders, but we are running into some severe difficulties. Through a bit of troubleshooting, I found that this works...
Code:
public class TalonCan {

    CANTalon talon;

    public TalonCan(int canID){
	talon = new CANTalon(canID);
        talon.changeControlMode(ControlMode.PercentVbus);
    }
}
And this doesn't...
Code:
public class TalonCan {
    
    CANTalon talon;
    
    public TalonCan(int canID){
        talon = new CANTalon(canID);
	talon.changeControlMode(ControlMode.Speed);
	talon.setPID(0.1, 0.001, 1, 0.0001, 100, 36, 0);
	talon.set(0);
	talon.setFeedbackDevice(FeedbackDevice.QuadEncoder);
    }
}
I believe it's from not using the encoders, so my question is, what am I doing wrong in the second example? The robot does not move in autonomous, nor in teleop.

[EDIT]
We have already put the robot on blocks and the wheels are moving in the correct direction and correct speed. It's only on the floor that we have problems, hence the need for encoders.

Last edited by goldenguy00 : 07-02-2015 at 17:26.
  #2   Spotlight this post!  
Unread 07-02-2015, 17:34
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)


I don't do Java/C++ code debugging from afar so I invite Java/C++ gurus to jump in here.

In the meanwhile, it might help if you would post answers to the following questions:

What units are you using for speed commands when in Speed mode?

How did you determine the PID gains?

Have you looked at the encoder values you are getting?

Put the bot up on blocks and command pure strafe right. Observe the 4 wheels and tell us what direction each wheel is spinning, in both PercentVbus and Speed mode. Just saw your edit, so: What direction was each wheel spinning?





Last edited by Ether : 07-02-2015 at 17:47.
  #3   Spotlight this post!  
Unread 07-02-2015, 17:44
goldenguy00 goldenguy00 is offline
Registered User
FRC #0619
 
Join Date: Feb 2015
Location: Virginia
Posts: 4
goldenguy00 is an unknown quantity at this point
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

Quote:
Originally Posted by Ether View Post

What direction was each wheel spinning?

The top left and bottom right rotated counter-clockwise and the opposite for the other wheels.

[<--] [-->]
[-->] [<--]

Like this. It works well enough, except it veers to the right side.

Quote:
Originally Posted by Ether View Post

How did you determine the PID gains?

We just used default values given by a manual. We messed around with them a bit, but no difference to before.

Last edited by goldenguy00 : 07-02-2015 at 17:58.
  #4   Spotlight this post!  
Unread 07-02-2015, 17:49
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

Quote:
Originally Posted by goldenguy00 View Post
The top left and bottom right rotated counter-clockwise and the opposite for the other wheels.

[<--] [-->]
[-->] [<--]

Like this. It works well enough, except it veers to the right side.
I'm sure the diagram makes perfect sense, but not without some explanation. What do the arrows mean? Which wheel is which?


  #5   Spotlight this post!  
Unread 07-02-2015, 17:54
goldenguy00 goldenguy00 is offline
Registered User
FRC #0619
 
Join Date: Feb 2015
Location: Virginia
Posts: 4
goldenguy00 is an unknown quantity at this point
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

I should have added a bit of detail. The arrows are the direction of the wheels from the top down. The movement should be upwards, where the top left is the top left wheel, the top right is the top right wheel, and so on and so forth. This is assuming sliding is up and down according to the diagram.

I have already checked the movement against your explanations, and they checked out. Any errors you see above are my personal errors.

Last edited by goldenguy00 : 07-02-2015 at 17:57.
  #6   Spotlight this post!  
Unread 07-02-2015, 18:04
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

Quote:
Originally Posted by goldenguy00 View Post
It works well enough, except it veers to the right side.
I'm a bit uncertain what the above means. When strafing to the right, the bot should "slide" sideways to the right. How is "veers to the right side" different from that?


  #7   Spotlight this post!  
Unread 07-02-2015, 18:18
goldenguy00 goldenguy00 is offline
Registered User
FRC #0619
 
Join Date: Feb 2015
Location: Virginia
Posts: 4
goldenguy00 is an unknown quantity at this point
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

I'm trying to make things simpler by changing the orientation, but I guess I'm doing the opposite. So to drive forward, the wheels all move in the same direction.

<---- (movement from top down)

Forward (<)
[top right] [bottom right]
[top left] [bottom left]

Sliding right (^)
[<--] [-->]
[-->] [<--]

Sliding left (v)
[-->] [<--]
[<--] [-->]

The problem we are running into is that when sliding, it veers up and down. The right top and bottom output velocity values lower than those on the right top and bottom
  #8   Spotlight this post!  
Unread 07-02-2015, 19:07
lcoreyl's Avatar
lcoreyl lcoreyl is offline
WittyTitleGen can't link to library
AKA: Milner
no team
 
Join Date: Jan 2009
Rookie Year: 2009
Location: Colorado Springs
Posts: 201
lcoreyl has much to be proud oflcoreyl has much to be proud oflcoreyl has much to be proud oflcoreyl has much to be proud oflcoreyl has much to be proud oflcoreyl has much to be proud oflcoreyl has much to be proud oflcoreyl has much to be proud oflcoreyl has much to be proud of
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

Quote:
Originally Posted by goldenguy00 View Post
I'm trying to make things simpler by changing the orientation, but I guess I'm doing the opposite. So to drive forward, the wheels all move in the same direction.

<---- (movement from top down)

Forward (<)
[top right] [bottom right]
[top left] [bottom left]

Sliding right (^)
[<--] [-->]
[-->] [<--]

Sliding left (v)
[-->] [<--]
[<--] [-->]

The problem we are running into is that when sliding, it veers up and down. The right top and bottom output velocity values lower than those on the right top and bottom
First off, your wheel spins look to be backwards for the strafes, unless your wheel rollers are configured in an X (worm's eye view). However, you said you can turn normally, so you are likely configured correctly to be O and just have things backwards here??

Have you checked things mechanically before you go correcting things with sensors?
-can all rollers spin freely?

-what happens when you drive at 45 degree angle?

-I have seen both a bad motor and an incorrectly assembled gearbox cause problems that you can't visually see when you put the robot up on blocks and look at wheel speeds. unplugging 2 PWMs at a time can sometimes help troubleshoot this: unplug front motors then rears and drive forward/back, then sides and strafe both ways. compare how far off course you get in each case.

for that matter, can you try to quantify how far off a perfect strafe you are in the normal configuration? Of course, a VIDEO WOULD GET YOU BETTER HELP!!!
  #9   Spotlight this post!  
Unread 07-02-2015, 20:13
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

Quote:
Originally Posted by goldenguy00 View Post

[top right] [bottom right]
[top left] [bottom left]

Sliding right (^)
[<--] [-->]
[-->] [<--]

Quote:
Originally Posted by lcoreyl View Post

your wheel spins look to be backwards for the strafes

I'd have to agree with lcoreyl here. Your diagram appears to be saying that the right-side wheels are being driven away from each other, and the left-side wheels are being driven toward each other for strafe right. If that's what you meant, it's not correct: that would be the wheel directions for strafe left.

But that's not what's causing your problem. You said in the OP that the robot doesn't move at all when it's on the ground and using ControlMode.Speed. I would recommend checking the status frames to see what the encoders are doing.


  #10   Spotlight this post!  
Unread 07-02-2015, 19:22
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)



There appears to be some confusion interpreting your ASCII art.

Please confirm that your wheel speeds conform to the attached sketches.


Attached Thumbnails
Click image for larger version

Name:	Forward.png
Views:	75
Size:	15.7 KB
ID:	18194  Click image for larger version

Name:	Rotate Right.png
Views:	53
Size:	16.6 KB
ID:	18195  Click image for larger version

Name:	Strafe Right.png
Views:	52
Size:	15.6 KB
ID:	18196  
  #11   Spotlight this post!  
Unread 07-02-2015, 19:49
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: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

For what it's worth, I understood the pictures immediately, and I think they look correct.

How heavy is your robot, and how is the weight distributed? The symptom sounds like the back wheels are slipping a little on the carpet, which suggests that the robot is front-heavy.

The ultimate solution is going to be to recognize that controlling wheel speed precisely isn't good enough to always prevent unwanted rotation of a mecanum drivebase. You're going to have to add some way of measuring the actual robot motion, and in this case I think the appropriate sensor to do that is a gyro.
  #12   Spotlight this post!  
Unread 14-02-2015, 02:35
seg9585's Avatar
seg9585 seg9585 is offline
Registered User
AKA: Eric
FRC #4276 (Surf City Vikings)
Team Role: Engineer
 
Join Date: Feb 2006
Rookie Year: 2001
Location: Boeing (Seal Beach, CA)
Posts: 520
seg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond reputeseg9585 has a reputation beyond repute
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

Quote:
Originally Posted by Alan Anderson View Post
For what it's worth, I understood the pictures immediately, and I think they look correct.

How heavy is your robot, and how is the weight distributed? The symptom sounds like the back wheels are slipping a little on the carpet, which suggests that the robot is front-heavy.

The ultimate solution is going to be to recognize that controlling wheel speed precisely isn't good enough to always prevent unwanted rotation of a mecanum drivebase. You're going to have to add some way of measuring the actual robot motion, and in this case I think the appropriate sensor to do that is a gyro.
If the weight is not distributed evenly, for a given voltage the angular acceleration of the heavier weight on wheels will will be lower relative to the lighter wheel, mecanum roller slippage or not. I think using the PID loop to even out the wheel RPMs is the right stategy.
Having said that, I rarely use the built-in PID controllers WPI provides, usually just write my own control loop. I'm not sure why OP selected values of P=0.1, I=.001, D=1 . Recommend reducing D down to near zero while testing, as this would just produce a damper which could null out your rates to near zero despite your offset.
__________________
My FIRST legacy:

Team 204 Student 2001, 2002 (Voorhees, NJ)
Team 1493 College Mentor 2006 - 2008 (Troy, NY)
Team 2150 Intern/Professional Mentor 2007, 2009 (Palos Verdes)
Team 4123 Lead Engineering Mentor 2012 (Bellflower, CA)
Team 4276 Engineering Mentor 2012-2016 (Huntington Beach, CA)
  #13   Spotlight this post!  
Unread 15-02-2015, 10:27
jhersh jhersh is offline
National Instruments
AKA: Joe Hershberger
FRC #2468 (Appreciate)
Team Role: Mentor
 
Join Date: May 2008
Rookie Year: 1997
Location: Austin, TX
Posts: 1,006
jhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond reputejhersh has a reputation beyond repute
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

Quote:
Originally Posted by Alan Anderson View Post
How heavy is your robot, and how is the weight distributed? The symptom sounds like the back wheels are slipping a little on the carpet, which suggests that the robot is front-heavy.
Another thing to consider that strongly affects mecanum... is your frame square? Perhaps one of the wheels is off the ground or bears too little of the weight.
  #14   Spotlight this post!  
Unread 15-02-2015, 10:51
Toa Circuit's Avatar
Toa Circuit Toa Circuit is offline
Thaddeus Maximus
AKA: Thad Hughes
FRC #4213 (MetalCow Robotics)
Team Role: Leadership
 
Join Date: Nov 2012
Rookie Year: 2012
Location: Shirley, IL
Posts: 131
Toa Circuit is an unknown quantity at this point
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)

My #1 concern in your setup is this:
What is causing the odd strafing? If it's wheel slippage (my main guess), encoders on the drive wheels won't help you. Consider using a gyroscope to get your error. You'll likely be happier anyways.
__________________

2012 Head of Programming and Electrical
2013-14 Overall Team Captain and Programming Head
2012-14 Mentor of FLL Team Power Surge
2014 Dean's List Finalist
2014 CIR Xerox Creativity Award
Webpage
  #15   Spotlight this post!  
Unread 07-02-2015, 18:10
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,077
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: Correcting Mecanum Wheels with Encoders (Ether, We Summon You!)


In case you missed these questions:

Quote:
Originally Posted by Ether View Post
What units are you using for speed commands when in Speed mode?

Have you looked at the encoder values you are getting?

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:42.

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