Go to Post We started FIRST to achieve a common goal and not only will we leave with more knowledge and wisdom, we will leave as friends and thats what really counts if you ask me. :cool: - Hick18 [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 Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #16   Spotlight this post!  
Unread 24-01-2015, 09:49
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
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: WPILIB mecanum code not working properly

Quote:
Originally Posted by engunneer View Post
It is not asking for field x and y but joystick x and y.
...unless you are using mecanum_Cartesian with a gyro signal connected to the gyro input. Then it is expecting field-centric inputs.


  #17   Spotlight this post!  
Unread 24-01-2015, 10:21
engunneer's Avatar
engunneer engunneer is offline
Alumni turned Mentor
AKA: Branden Gunn
FRC #4761
Team Role: Mentor
 
Join Date: Jan 2007
Rookie Year: 1996
Location: Reading, MA
Posts: 862
engunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond reputeengunneer has a reputation beyond repute
Re: WPILIB mecanum code not working properly

Quote:
Originally Posted by Ether View Post
...unless you are using mecanum_Cartesian with a gyro signal connected to the gyro input. Then it is expecting field-centric inputs.


We were using all of those. The input parameter called x expects the x position of the joystick. The y parameter expects the y joystick position with no inversion. Our robot immediately started driving properly with field centric controls once this was straightened out.
__________________
Student FRC23 (1996-1999), Mentor FRC246 (2000), Mentor FRC1318 (2007-2009), Mentor FRC93 (2011), Mentor FRC2151 (2012), Mentor FRC23 (2013), Mentor FRC4761 (2014-2017)
1998 - National Chairman's Award and Woodie Flowers Award (FRC23, Mike Bastoni ) | 2007 - PNW SF (488, 1595) | 2008 - Oregon RCA - Seattle #2 Seed, SF (488, 1696) | 2009 - Oregon #1 Seed, Winners (1983, 2635) - Seattle SF (945, 2865) - Galileo #2 Seed, SF (973, 25) | 2012 Midwest F (111, 71) | 2014 RIDE Winners (78, 125), Inspector - NEU #24, QF (3479, 3958) - NECMP #35 | 2015 Reading #11, SF (1058, 190), Inspector - RIDE #17, QF(4055, 5494), Inspector - NECMP #57 | 2016 Reading #4, SF (133, 4474), DCA, Inspector - Ride #22, SF (1735, 2067), Creativity, Inspector - NECMP #48, RCA - Archimedes
  #18   Spotlight this post!  
Unread 24-01-2015, 10:23
AWoL's Avatar
AWoL AWoL is offline
Lvl. 225 Dark Code Mage (Java Type)
AKA: Adam Wolnikowski
FRC #0225 (TechFire)
Team Role: Programmer
 
Join Date: Mar 2014
Rookie Year: 2014
Location: York, Pennsylvania
Posts: 116
AWoL has a reputation beyond reputeAWoL has a reputation beyond reputeAWoL has a reputation beyond reputeAWoL has a reputation beyond reputeAWoL has a reputation beyond reputeAWoL has a reputation beyond reputeAWoL has a reputation beyond reputeAWoL has a reputation beyond reputeAWoL has a reputation beyond reputeAWoL has a reputation beyond reputeAWoL has a reputation beyond repute
Re: WPILIB mecanum code not working properly

Quote:
Originally Posted by cad321 View Post
Code:
wheelSpeeds[MotorType.kFrontLeft_val] = xIn + yIn + rotation;
wheelSpeeds[MotorType.kFrontRight_val] = -xIn + yIn - rotation;
wheelSpeeds[MotorType.kRearLeft_val] = -xIn + yIn + rotation;
wheelSpeeds[MotorType.kRearRight_val] = xIn + yIn - rotation;
to the following:

Code:
double mFL = strafe + forward + rotation;
double mFR = strafe + forward - rotation;
double mRL = strafe - forward + rotation;
double mRR = strafe - forward - rotation;
Maybe I missed something here, but may I ask why you changed the signs in the equations?
__________________
2016 Competition Results (Co-captain, Driver, and Lead Programmer; Junior)
Springside-Chestnut Hill District Event - WINNER / #2 Seed, #1 Seed's First Pick / Gracious Professionalism Award
Westtown District Event - WINNER / #1 Seed / Industrial Design Award
MAR District Championship - WINNER / #1 Seed / Industrial Design Award / Dean's List Finalist Award (Me)
World Championship, Carson Subdivision - QUARTERFINALIST / #3 Seed, #2 Seed's First Pick
Indiana Robotics Invitational - FINALIST / #14 Seed, #2 Seed's Second Pick
  #19   Spotlight this post!  
Unread 24-01-2015, 15:00
krieck's Avatar
krieck krieck is offline
Registered User
AKA: Keith
FRC #2846 (Firebears)
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2012
Location: Minnesota
Posts: 49
krieck is an unknown quantity at this point
Re: WPILIB mecanum code not working properly

Looking at the code for RobotDrive, I can see that the gyroAngle is used to rotate the values of xIn and yIn. This is what creates the field-centric driving.

Your code that works appears to put the values of "strafe", "forwards", and "rotation" directly into the motor controllers.

Are you discarding the rotation from the gyroAngle to get driving to work normally? In other words, could you get good normal driving behavior by keeping the gyro angle at a constant zero?
  #20   Spotlight this post!  
Unread 24-01-2015, 16:46
cad321 cad321 is offline
Jack of all trades, Master of none
AKA: Brian Wagg
FRC #2386 (Trojans)
Team Role: Alumni
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Burlington, Ontario
Posts: 333
cad321 is just really nicecad321 is just really nicecad321 is just really nicecad321 is just really nice
Re: WPILIB mecanum code not working properly

Unfortunately I couldn't get my hands on the bot today as I was busy working on mechanical and also it was being used for our driver try out. Hopefully Monday I will be able to map out all off the wheel rotations. I also had two of our mentors go over and double check the wiring and neither could find anything wrong.

Quote:
Originally Posted by TimTheGreat View Post
Is there a reason your robot drive is *10*,1,2,3? did you mean 0? And make sure the order you set the drive motors is frontLeft, rearLeft, frontRight, rearRight.
No I did mean to say 10. The way our electronics are layed out, it was easier to run a short pwm cable to port 10 on the side car rather than 4. Also note that this is our practice bot and it is running the Crio/associated hardware, not the new RoboRIO.

Quote:
Originally Posted by AWoL View Post
Maybe I missed something here, but may I ask why you changed the signs in the equations?
I changed the signs in the equation because earlier on while troubleshooting we realized that, based on the movements of the wheels we were seeing at the time, there would be a chance that if we changed some of the signs around, we might see the movements we were expecting. Sure enough the robot started driving normally when we changed up the signs.

Quote:
Originally Posted by krieck View Post
Your code that works appears to put the values of "strafe", "forwards", and "rotation" directly into the motor controllers.

Are you discarding the rotation from the gyroAngle to get driving to work normally? In other words, could you get good normal driving behavior by keeping the gyro angle at a constant zero?
Originally I didn't even incorporate any gyro code as I just wanted to be sure we had basic functions before going any more complex. After I got the drive functioning properly (using the new equations as seen in my first post), I started working on gyro code. I now have standard mecanum drive working along with proper field centric control (again all using the new equations).

My next step is to try and get a PID loop running that keeps our heading to the desired angle as we are currently experiencing drift in our rotation. I have also been trying to get a velocity PID loop running on our wheels using encoders so that we can ensure that we are getting the desired RPM's out of our wheels.

Last edited by cad321 : 24-01-2015 at 16:49.
  #21   Spotlight this post!  
Unread 24-01-2015, 20:27
TimTheGreat's Avatar
TimTheGreat TimTheGreat is offline
ArchdukeTim
FRC #1418 (Vae Victis)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2011
Location: Falls Church
Posts: 236
TimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura aboutTimTheGreat has a spectacular aura about
Re: WPILIB mecanum code not working properly

And what is the problem of just using RobotDrive.MecanumDrive_Cartesian(joystick.getX(), joystick.getY(), joystick2.getX(), 0)?

That should give you exactly what you want without having to mess with the math of it
__________________
There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.



2012 - Gracious Professionalism - Greater DC
2014 - Regional Finalist - Virginia | Industrial Design - Virginia | Regional Finalist - Greater DC
2015 - Innovation in Control - Greater DC
2016 - District Event Winner - VAHAY | Innovation in Control - VAHAY | District Event Winner - MDBET | Industrial Design - MDBET | District Champion - CHCMP | Innovation in Control - CHCMP
  #22   Spotlight this post!  
Unread 24-01-2015, 20:30
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,089
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: WPILIB mecanum code not working properly

Quote:
Originally Posted by TimTheGreat View Post
And what is the problem of just using RobotDrive.MecanumDrive_Cartesian(joystick.getX(), joystick.getY(), joystick2.getX(), 0)?

That should give you exactly what you want without having to mess with the math of it
... and if it doesn't then do this.


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 12:53.

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