Go to Post I can't believe it someone is talking about next years game rationally! - jamie_1930 [more]
Home
Go Back   Chief Delphi > Technical > Electrical
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rating: Thread Rating: 2 votes, 5.00 average. Display Modes
  #16   Spotlight this post!  
Unread 14-01-2015, 13:41
idahorobot's Avatar
idahorobot idahorobot is offline
Registered User
FRC #2130 (Alpha +)
Team Role: Mentor
 
Join Date: Dec 2006
Rookie Year: 2005
Location: Idaho
Posts: 99
idahorobot is a jewel in the roughidahorobot is a jewel in the roughidahorobot is a jewel in the roughidahorobot is a jewel in the rough
Re: Encoders on mecanum drive?

Quote:
Originally Posted by juchong View Post
If you couple this information with a gyro sensor, you can achieve very accurate field-centric driving! It also has the side effect of making your autonomous very predictable!
Do you or the community have some code sample to illustrate this?
  #17   Spotlight this post!  
Unread 14-01-2015, 13:44
dougwilliams's Avatar
dougwilliams dougwilliams is offline
Engineer - Controls, Electronics
FRC #2053 (TigerTronics)
Team Role: Mentor
 
Join Date: May 2013
Rookie Year: 2013
Location: Vestal, NY
Posts: 109
dougwilliams is on a distinguished road
Re: Encoders on mecanum drive?

Quote:
Originally Posted by Ether View Post
A caster swivels. It's not clear what you mean by orienting a caster in the X (or Y) direction.


True again, I guess in my mind I had imagined the locked/non-swiveling caster-style wheels.

Swiveling caster with an encoder will only track total distance traveled from starting. Unless you track wheel spin and another encoder of the orientation of the caster. Which may, in fact, be what the poster meant originally and I misunderstood.
  #18   Spotlight this post!  
Unread 14-01-2015, 13:46
Whippet's Avatar
Whippet Whippet is offline
MIT Class of 2020
AKA: Luis Trueba
FRC #4301 (New Tech Narcissists)
Team Role: Alumni
 
Join Date: Feb 2011
Rookie Year: 2011
Location: Cambridge, MA
Posts: 1,187
Whippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond reputeWhippet has a reputation beyond repute
Send a message via Yahoo to Whippet
Re: Encoders on mecanum drive?

Quote:
Originally Posted by idahorobot View Post
Do you or the community have some code sample to illustrate this?
Code:
/* 
 * This is the experimental code for the 2015 robot.  DO NOT USE FOR COMPETITION!  
 * All code that is useful will be in  a separate project.
 */
package org.usfirst.frc.team4301.robot;


import edu.wpi.first.wpilibj.SampleRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Joystick;
import edu.wpi.first.wpilibj.Timer;
import edu.wpi.first.wpilibj.Gyro;



public class Robot extends SampleRobot {
    RobotDrive myRobot;
    Joystick DriverStick;
    Joystick OperatorStick;
    Gyro gyro;

    public Robot() {
        myRobot = new RobotDrive(0, 1, 2, 3);
        myRobot.setExpiration(0.1);
        DriverStick = new Joystick(0);
        gyro = new Gyro(0);
    }

    /**
     * Drive left & right motors for 2 seconds then stop
     */
    public void autonomous() {        
    }

    public void operatorControl() {
        myRobot.setSafetyEnabled(true);
        while (isOperatorControl() && isEnabled()) {
        	//set x, y, and z values
        	double x = DriverStick.getX();
        	double y = DriverStick.getY();
        	double z = DriverStick.getZ();
            myRobot.mecanumDrive_Cartesian(x, y, z, gyro.getAngle());
            if(DriverStick.getTrigger() == true) {
            	gyro.reset();
            }
            Timer.delay(0.005);		// wait for a motor update time
            
        }
    }

    /**
     * Runs during test mode
     */
    public void test() {
    }
}
I have bolded the lines to pay attention to. Replace "4301" and all team-related items with your own code.
__________________
2010: FRC 3043, Build Assistant
2011: FRC 3043, Head of Minibot subteam; FLL 12762, Team Captain
2012: FRC 3043, Electrical; FLL 12762, Team Captain; FTC 5670, Team Captain
2013: FRC 4301, Electrical, Team Co-Captain
2014: FRC 4301, Electrical/Programming, Team Co-Captain
2015: FRC 4301, Electrical/Programming, Team Captain
2016: FRC 4301, Chief Technical Officer; FTC 10860, 10861, and 11004: Mentor. Winner, Hub City Regional (3310 & 4063)

Last edited by Whippet : 14-01-2015 at 13:48.
  #19   Spotlight this post!  
Unread 14-01-2015, 13:48
IronicDeadBird's Avatar
IronicDeadBird IronicDeadBird is offline
Theory Crafting Fo days...
AKA: Charles Ives "M" Waldo IV
FRC #1339 (Angelbots)
Team Role: Tactician
 
Join Date: Feb 2014
Rookie Year: 2005
Location: Colorado
Posts: 958
IronicDeadBird has a reputation beyond reputeIronicDeadBird has a reputation beyond reputeIronicDeadBird has a reputation beyond reputeIronicDeadBird has a reputation beyond reputeIronicDeadBird has a reputation beyond reputeIronicDeadBird has a reputation beyond reputeIronicDeadBird has a reputation beyond reputeIronicDeadBird has a reputation beyond reputeIronicDeadBird has a reputation beyond reputeIronicDeadBird has a reputation beyond reputeIronicDeadBird has a reputation beyond repute
Re: Encoders on mecanum drive?

Quote:
Originally Posted by gpetilli View Post
I know one team at the Fingerlakes Regional about 5 years ago won the Innovation in Control award for using a mouse for movement sensing. The last we looked at trying this, the modern mice were too precise (6000 pulses per inch) and the cRIO could not handle the pulse rate.

What we did last year and intend to do again this year is to use two smaller omni-wheels (VEX 2.75in) with encoders mounted orthogonally square to the frame. They directly measure the actual motion, not the intended, wheel slip free, motion. The important thing is to ensure the un-powered follower wheels are always in contact with the floor.
Stay in touch man that sounds like an awesome thing to do. It's like the ABS system on your car minus the annoying noise it makes. I'm interested in seeing how well that works. Albeit this year sensing when your robot is being pushed and getting feedback on that isn't as helpful as last year it would still be a nice off season project for some member.
__________________
HERO 俺を讃える声や 喝采なんて 欲しくはないさ
I liked my team more before they stole my jacket.
Play is for kids this is serious...
  #20   Spotlight this post!  
Unread 14-01-2015, 13:54
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,091
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: Encoders on mecanum drive?

Quote:
Originally Posted by dougwilliams View Post
Unless you track wheel spin and another encoder of the orientation of the caster.
Please read post#8 in this thread.


  #21   Spotlight this post!  
Unread 14-01-2015, 13:54
dougwilliams's Avatar
dougwilliams dougwilliams is offline
Engineer - Controls, Electronics
FRC #2053 (TigerTronics)
Team Role: Mentor
 
Join Date: May 2013
Rookie Year: 2013
Location: Vestal, NY
Posts: 109
dougwilliams is on a distinguished road
Re: Encoders on mecanum drive?

Quote:
Originally Posted by Whippet View Post
.
The posted code performs a field oriented drive. At any point in time we can set the robot to a known orientation on the field (the direction it is facing).

This is different than absolute field position. It would seem in autonomous we are concerned with absolute position of the robot in relation to the field and/or field elements so we know where to make the robot go to in order to pick up a tote or other task.

Field oriented drive (the code posted) does not help with that aspect of the task.
  #22   Spotlight this post!  
Unread 14-01-2015, 14:05
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,091
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: Encoders on mecanum drive?

Quote:
Originally Posted by gpetilli View Post
...use two smaller omni-wheels (VEX 2.75in) with encoders mounted orthogonally square to the frame. They directly measure the actual motion, not the intended, wheel slip free, motion.
The context of this thread is mecanum, which has 3 degrees of freedom.

How do you intend to process 2 encoder signals to detect those 3 motions? (forward, strafe, rotate)?


  #23   Spotlight this post!  
Unread 14-01-2015, 14:49
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Encoders on mecanum drive?

Quote:
Originally Posted by Ether View Post
The context of this thread is mecanum, which has 3 degrees of freedom.

How do you intend to process 2 encoder signals to detect those 3 motions? (forward, strafe, rotate)?


Last year's robot used two omni-wheels plus a compass. We had lots of reliability issues with the compass due to interference from the CIM motors (solved with 4ft distance), and a mounting screw which was evidently magnetized. This year we intend to replace the compass (and gyro) with a second pair of instrumented follower wheels. The two X and two Y wheels will be located one in each of the four corners. A side benefit of this approach is that we can calculate the rotation about a point near the center of the robot without locating the rotational sensor in the center of the robot (middle of a tote).
  #24   Spotlight this post!  
Unread 14-01-2015, 14:53
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,091
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: Encoders on mecanum drive?

Quote:
Originally Posted by gpetilli View Post
...a second pair of instrumented follower wheels
OK. That's a horse of a different color.


  #25   Spotlight this post!  
Unread 14-01-2015, 15:00
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Encoders on mecanum drive?

Quote:
Originally Posted by Ether View Post
OK. That's a horse of a different color.


We had actually discussed this approach last year and you posted a "homework" discussion thread on the topic. I hope you still feel the math will work because I just ordered all the omni-wheels.
  #26   Spotlight this post!  
Unread 14-01-2015, 15:33
jtrv's Avatar
jtrv jtrv is offline
github.com/jhtervay
AKA: Justin
FRC #2791 (Shaker Robotics)
Team Role: College Student
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Latham, NY
Posts: 148
jtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to alljtrv is a name known to all
Re: Encoders on mecanum drive?

Okay, well, I seem to only have gotten one decent solution, that I get encoder values and reverse the mecanumDrive trig functions to get distance.

problem: i still don't understand where they even attach to and what exactly they measure.

Do they still measure distance traveled? How do I even track direction with 1 encoder per wheel? If i go 45 deg to the right of initial orientation, and I move 1m, what would the 4 encoders even read?

as of right now we don't have a base, nor anything to attach mec wheels to, so... until then us programmers are kinda sitting here putting stuff on smartdashboard...
__________________
2791 (2012-2017)
  #27   Spotlight this post!  
Unread 14-01-2015, 15:38
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,091
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: Encoders on mecanum drive?

Quote:
Originally Posted by gpetilli View Post
We had actually discussed this approach last year and you posted a "homework" discussion thread on the topic. I hope you still feel the math will work because I just ordered all the omni-wheels.
That sounds familiar now that you mention it. I'll go take a look :-)


  #28   Spotlight this post!  
Unread 14-01-2015, 16:26
gpetilli gpetilli is offline
Registered User
FRC #1559
 
Join Date: Jan 2009
Location: Victor, NY
Posts: 285
gpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to allgpetilli is a name known to all
Re: Encoders on mecanum drive?

Quote:
Originally Posted by jtrv View Post
Okay, well, I seem to only have gotten one decent solution, that I get encoder values and reverse the mecanumDrive trig functions to get distance.
1) As the robot moves, there are three degrees of freedom; lets call them X (strafe),Y (forward) and R (rotation/orientation). Lets call the starting position (when the robot is powered on) [0,0,0] then if you measure the changes from the starting position, you can know your current X,Y,R. They dont have to be the same kind of sensors but ideally they are "orthogonal"

2) There are several sensors available to us. We need to be careful on units. Encoders measure rotation of a shaft. A quadrature encoder also detects the direction (CW/CCW) the shaft is rotating - VEX has a good writeup on how that works. If you know the circumference of the wheel turning the shaft and divide by the pulses per rev (PPR), you can calculate the distance travelled. If in addition you know the time over which you took the measurement, you can calculate the linear velocity of the wheel. The WPI API code for the encoders will both count the pulses and convert them to velocity.

3) The typical way to (indirectly) measure R is to use a gyroscope. The gyro gives you angular velocity at the physical location of the sensor. If you want the direction you are facing, you need to "integrate" the velocity over time to get degrees from your starting orientation. This is useful for mecanum in that you can use it to drive straight by adjusting the power to the wheels in such a way to maintain a zero angular velocity (not turning) while you move in any combination of X and Y. Gyros are notorious for having "drift" which means that very small errors in the measurement of the angular velocity can create large errors during the integration process to create the current orientation angle. You tend to use velocity for teleop control and angle for autonomous (only 15sec, so drift not an issue).

4) encoders can be used on either the driven wheels or on separate non-driven wheels (which my team calls a pedometer). Most FRC gearboxes have an easy way to mount an encoder. If you are using mecanum wheels, you may need to reverse the trig to separate X and Y.

5) Another way to measure R, is with an electronic compass. This directly measures the sensor orientation with respect to magnetic north of the earth. The issue is that other magnetic fields (motors) can confuse it.

In the end, you need to first decide what you want to control, then how you are going to measure it (and with what sensor). There are lots of example code on how to control a mecanum drive with encoders plus a gyro.

Last edited by gpetilli : 14-01-2015 at 16:29.
  #29   Spotlight this post!  
Unread 14-01-2015, 16:59
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,091
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: Encoders on mecanum drive?

Quote:
Originally Posted by jtrv View Post
Okay, well, I seem to only have gotten one decent solution, that I get encoder values and reverse the mecanumDrive trig functions to get distance.
What you have described is called forward kinematics. If your wheel speeds are not kinematically correct*, you cannot compute a true forward kinematic solution, because there will be wheel scrubbing. You can find a least-squares solution, but there's no guarantee that will describe the vehicle's actual motion.

By the way, there are no "trig functions" required to do mec inverse kinematics.

*due to an incorrect inverse kinematic computation, or differences in motor controller calibration, or differences in performance among the 4 motors, or differences in resistance among the 4 motor wiring circuits, or differences in friction among the 4 gearboxes, or differences in friction of the rollers among the 4 wheels, etc etc etc.

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 06:29.

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