Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   Java (http://www.chiefdelphi.com/forums/forumdisplay.php?f=184)
-   -   How to Program Mecanum (http://www.chiefdelphi.com/forums/showthread.php?t=133904)

LFRobotics 03-02-2015 11:32

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!!

Joe Ross 03-02-2015 11:37

Re: How to Program Mecanum
 
Quote:

Originally Posted by LFRobotics (Post 1437644)
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.

GeeTwo 03-02-2015 11:56

Re: How to Program Mecanum
 
Quote:

Originally Posted by Joe Ross (Post 1437647)
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.

LFRobotics 03-02-2015 12:46

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?

GeeTwo 03-02-2015 13:55

Re: How to Program Mecanum
 
Quote:

Originally Posted by LFRobotics (Post 1437672)
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

3786KRRobotics 03-02-2015 13:57

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.

Ether 03-02-2015 14:02

Re: How to Program Mecanum
 
Quote:

Originally Posted by 3786KRRobotics (Post 1437698)
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.



GeeTwo 03-02-2015 14:10

Re: How to Program Mecanum
 
Quote:

Originally Posted by 3786KRRobotics (Post 1437698)
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 (Post 1437703)
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".

LFRobotics 03-02-2015 14:22

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

GeeTwo 03-02-2015 14:36

Re: How to Program Mecanum
 
Quote:

Originally Posted by LFRobotics (Post 1437715)
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?

3786KRRobotics 03-02-2015 14:44

Re: How to Program Mecanum
 
Quote:

Originally Posted by GeeTwo (Post 1437709)
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.

Ether 03-02-2015 15:38

Re: How to Program Mecanum
 
Quote:

Originally Posted by 3786KRRobotics (Post 1437698)
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 (Post 1437698)
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.



3786KRRobotics 03-02-2015 16:10

Re: How to Program Mecanum
 
Yes, you are correct. I was mistaken.

LFRobotics 03-02-2015 18:30

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!

LFRobotics 05-02-2015 11:20

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!


All times are GMT -5. The time now is 13:05.

Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi