Go to Post Lawyers find loopholes. Engineers find solutions. For which would you rather be known? - dlavery [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 03-02-2015, 11:32
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
How to Program Mecanum

Okay I have posted multiple posts and tried hours worth of useless troubleshooting and I still do not have a working program. I have gotten code from other people, but that code never works. I have gotten suggestions here but none of them seem to fix it. Our team is about to give up and redesign our chassis to put normal wheels in. In a last ditch effort I made this program. In Robot.java under autonomous you will see a lot of commented out mecanumDrive(value, value, value, value) those were used for testing when the mecanumDrive method used to be located there. They all worked for the intended direction in autonomous. I simply can't get our XBox controller to work with it. I want buttons LB and RB to control straffing and the left joystick to control forward/backward and turning. So I programmed it for that - using if statements in drivetele - thats because none of the built in polar or cartesian commands worked(everything was messed up) - and none of the buttons or joysticks on the controller make the robot do anything. I know my XBox class works because we used it for tank drive last year. I am lost and have no idea what to do so PLEASE help!

Here is the code: https://github.com/MrSTUDofCODE/NewM...team4623/robot

THANKS!!
Reply With Quote
  #2   Spotlight this post!  
Unread 03-02-2015, 11:37
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,572
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: How to Program Mecanum

Quote:
Originally Posted by LFRobotics View Post
I know my XBox class works because we used it for tank drive last year.
Given the changes to the driver station this year, that is not a correct assumption. The xBox controller mapping changed.
Reply With Quote
  #3   Spotlight this post!  
Unread 03-02-2015, 11:56
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: How to Program Mecanum

Quote:
Originally Posted by Joe Ross View Post
Given the changes to the driver station this year, that is not a correct assumption. The xBox controller mapping changed.
Agreed. As a quick test, try loading last year's tank drive software and see how it drives with mecanum. While you won't get anywhere near the performance that you would with rubber tires, tank mode commands on a mecanum platform shall produce the desired results for forward, reverse, spin left, and spin right.
Reply With Quote
  #4   Spotlight this post!  
Unread 03-02-2015, 12:46
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
Re: How to Program Mecanum

Okay - that would explain the problems I was having - the wrong joysticks were running the wrong things - what are the new mappings?
Reply With Quote
  #5   Spotlight this post!  
Unread 03-02-2015, 13:55
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: How to Program Mecanum

Quote:
Originally Posted by LFRobotics View Post
Okay - that would explain the problems I was having - the wrong joysticks were running the wrong things - what are the new mappings?
I googled "WPI xbox controller mapping 2015" and followed it to the following image on the team358 page:

http://team358.org/files/programming...rolMapping.jpg
Reply With Quote
  #6   Spotlight this post!  
Unread 03-02-2015, 13:57
3786KRRobotics 3786KRRobotics is offline
Registered User
FRC #3786
 
Join Date: Feb 2015
Location: Kent, Washington
Posts: 4
3786KRRobotics is an unknown quantity at this point
Re: How to Program Mecanum

If you are using the SmartDashboard, you can display the values of each axis and play around with the controller to determine which axis is altered by what. Our team has gotten mecanum wheels working on a test chassis successfully using a sidewinder joystick. We are currently in the process of implementing an XBox controller system as well. We are, however, also working with field orientation which may not be helpful for you. If you would like, here is our drive code though it is still in the works.

After taking a quick glance at your code, you may also run into issues with strafing.

If you want to strafe to the left, you want to drive the front left forward and rear left backwards while driving the front right backwards and the back right forwards. This creates a vector in only the left direction.

You are currently, with this line:
Code:
CommandBase.mecanum.mecanumDrive(-.3, .3, -.3, .3);
driving your front left backwards and rear left forwards. This will result in your end vector heading towards the middle of your robot causing it to spin it's wheels and get nowhere.

A similar approach is required for strafing right, with the wheels driving the opposite direction of strafing left.
Reply With Quote
  #7   Spotlight this post!  
Unread 03-02-2015, 14:02
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: How to Program Mecanum

Quote:
Originally Posted by 3786KRRobotics View Post
If you want to strafe to the left, you want to drive the front left forward and rear left backwards while driving the front right backwards and the back right forwards. This creates a vector in only the left direction.
Not. The wheel speeds described above are all the reverse of what they should be.


Reply With Quote
  #8   Spotlight this post!  
Unread 03-02-2015, 14:10
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: How to Program Mecanum

Quote:
Originally Posted by 3786KRRobotics View Post
If you want to strafe to the left, you want to drive the front left forward and rear left backwards while driving the front right backwards and the back right forwards. This creates a vector in only the left direction.
.
Quote:
Originally Posted by Ether View Post
Not. The wheel speeds described above are all the reverse of what they should be.
Or perhaps team 3786 has their wheels mounted incorrectly? The rollers should form an "X" when viewed from above, and a diamond when viewed from below.

This is supported by the following observation, which shouldn't ever happen with properly oriented mecanums; if the torques add up to zero, and the translation adds up to zero, and the wheels are spinning, something's wrong.


Quote:
This will result in your end vector heading towards the middle of your robot causing it to spin it's wheels and get nowhere.
Correction: this is possible, with the front wheels spinning backwards and the rear wheels forwards (or vice versa), but the force doesn't putsh "towards the middle".

Last edited by GeeTwo : 03-02-2015 at 14:35. Reason: Added last paraagraph and end quote, then correction
Reply With Quote
  #9   Spotlight this post!  
Unread 03-02-2015, 14:22
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
Re: How to Program Mecanum

Those values are not the ones that are supposed to work - the ones that were suggested didn't work and I had to play around with them to make them work - all of that was already tested in autonomous and works
Reply With Quote
  #10   Spotlight this post!  
Unread 03-02-2015, 14:36
GeeTwo's Avatar
GeeTwo GeeTwo is offline
Technical Director
AKA: Gus Michel II
FRC #3946 (Tiger Robotics)
Team Role: Mentor
 
Join Date: Jan 2014
Rookie Year: 2013
Location: Slidell, LA
Posts: 3,654
GeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond reputeGeeTwo has a reputation beyond repute
Re: How to Program Mecanum

Quote:
Originally Posted by LFRobotics View Post
Those values are not the ones that are supposed to work - the ones that were suggested didn't work and I had to play around with them to make them work - all of that was already tested in autonomous and works
Do your rollers form an X when viewed from above? Are you able to rotate?
Reply With Quote
  #11   Spotlight this post!  
Unread 03-02-2015, 14:44
3786KRRobotics 3786KRRobotics is offline
Registered User
FRC #3786
 
Join Date: Feb 2015
Location: Kent, Washington
Posts: 4
3786KRRobotics is an unknown quantity at this point
Re: How to Program Mecanum

Quote:
Originally Posted by GeeTwo View Post
Or perhaps team 3786 has their wheels mounted incorrectly? The rollers should form an "X" when viewed from above, and a diamond when viewed from below.
Our wheels are mounted correctly and form an "X", perhaps I was just thinking wrong at the time as I did not have access to view our chassis. At any rate, when strafing, one side should have the wheels rotating towards the outside when viewed side on, and the other side should be rotating inwards.
Reply With Quote
  #12   Spotlight this post!  
Unread 03-02-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,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: How to Program Mecanum

Quote:
Originally Posted by 3786KRRobotics View Post
when strafing, one side should have the wheels rotating towards the outside when viewed side on, and the other side should be rotating inwards.
Just to be clear:

Assuming your wheels are mounted correctly,

Strafe Left:
- Left wheels rotate "inward"
- Right wheels rotate "outward"

Strafe Right:
- Left wheels rotate "outward"
- Right wheels rotate "inward"

... which is not the same as this:

Quote:
Originally Posted by 3786KRRobotics View Post
If you want to strafe to the left, you want to drive the front left forward and rear left backwards while driving the front right backwards and the back right forwards. This creates a vector in only the left direction.

Reply With Quote
  #13   Spotlight this post!  
Unread 03-02-2015, 16:10
3786KRRobotics 3786KRRobotics is offline
Registered User
FRC #3786
 
Join Date: Feb 2015
Location: Kent, Washington
Posts: 4
3786KRRobotics is an unknown quantity at this point
Re: How to Program Mecanum

Yes, you are correct. I was mistaken.
Reply With Quote
  #14   Spotlight this post!  
Unread 03-02-2015, 18:30
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
Re: How to Program Mecanum

Okay I redid the program again and will test everything again tomorrow and get back to you - hopefully it works this time!

THANKS!
Reply With Quote
  #15   Spotlight this post!  
Unread 05-02-2015, 11:20
LFRobotics's Avatar
LFRobotics LFRobotics is offline
Registered User
FRC #4623
 
Join Date: Jan 2014
Location: Little Falls, MN
Posts: 95
LFRobotics is on a distinguished road
Re: How to Program Mecanum

Okay that didn't work either. Nothing works. The program uploads - the DS doesn't through any errors - it shows all green lights - but nothing happens with the Joysticks - I can press anything on the XBox controller and nothing happens. I can still make the robot move using ,my preassigned values in autonomous.

Here is the upload for Eclipse:

Code:
Buildfile: C:\Users\Kristen\Documents\GitHub\Copy of Copy of Getting Started\build.xml
Trying to override old definition of task classloader
clean:
   [delete] Deleting directory C:\Users\Kristen\Documents\GitHub\Copy of Copy of Getting Started\build
   [delete] Deleting directory C:\Users\Kristen\Documents\GitHub\Copy of Copy of Getting Started\dist
compile:
    [mkdir] Created dir: C:\Users\Kristen\Documents\GitHub\Copy of Copy of Getting Started\build
     [echo] [athena-compile] Compiling src with classpath=C:\Users\Kristen/wpilib/java/current/lib/WPILib.jar:C:\Users\Kristen/wpilib/java/current/lib/NetworkTables.jar to build
    [javac] Compiling 8 source files to C:\Users\Kristen\Documents\GitHub\Copy of Copy of Getting Started\build
jar:
     [echo] [athena-jar] Making jar dist/FRCUserProgram.jar.
    [mkdir] Created dir: C:\Users\Kristen\Documents\GitHub\Copy of Copy of Getting Started\dist
    [mkdir] Created dir: C:\Users\Kristen\Documents\GitHub\Copy of Copy of Getting Started\build\jars
     [echo] [athena-jar] Copying jars from C:\Users\Kristen/wpilib/java/current/lib/WPILib.jar:C:\Users\Kristen/wpilib/java/current/lib/NetworkTables.jar to build/jars.
     [copy] Copying 2 files to C:\Users\Kristen\Documents\GitHub\Copy of Copy of Getting Started\build\jars
      [jar] Building jar: C:\Users\Kristen\Documents\GitHub\Copy of Copy of Getting Started\dist\FRCUserProgram.jar
get-target-ip:
     [echo] Trying Target: roboRIO-4623.local
     [echo] roboRIO found via mDNS
dependencies:
     [echo] roboRIO image version validated
     [echo] Checking for JRE. If this fails install the JRE using these instructions: https://wpilib.screenstepslive.com/s/4485/m/13503/l/288822-installing-java-8-on-the-roborio-using-the-frc-roborio-java-installer-java-only
  [sshexec] Connecting to roboRIO-4623.local:22
  [sshexec] cmd : test -d /usr/local/frc/JRE
deploy:
     [echo] [athena-deploy] Copying code over.
      [scp] Connecting to roboRIO-4623.local:22
      [scp] done.
      [scp] Connecting to roboRIO-4623.local:22
      [scp] done.
     [echo] [athena-deploy] Starting program.
  [sshexec] Connecting to roboRIO-4623.local:22
  [sshexec] cmd : . /etc/profile.d/natinst-path.sh; /usr/local/frc/bin/frcKillRobot.sh -t -r;
  [sshexec] stopped process in pidfile '/var/run/natinst/FRC_UserProgram.pid' (pid 4205)
BUILD SUCCESSFUL
Total time: 13 seconds
Here is the link to the updated code:

https://github.com/MrSTUDofCODE/NewM...team4623/robot

Also we have another person programming in labview - so I went into the web interface and checked disable RT startup - which should have switched it back to JAVA

PLEASE help - THANKS!

Last edited by LFRobotics : 05-02-2015 at 11:23.
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 13:05.

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