Go to Post I then asked if I could use a flux capacitor for power, but that didn't go over too well, either (they did say I could use it for decorative purposes, though). - Kevin Watson [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 12-15-2016, 07:01 PM
minisolarclown minisolarclown is offline
Registered User
FRC #3603
Team Role: Programmer
 
Join Date: Dec 2016
Rookie Year: 2015
Location: Reed City
Posts: 7
minisolarclown is an unknown quantity at this point
Holonomic Drive Issues With Strafing

I'm having issues with holonomic driving with our meccanum robot. Driving forwards and backwards on the y-axis is working, and so is turning left and right with the twist-axis, but moving left and right on the x-axis isn't working. I know that in order to drive sideways, the wheels on one side have to be spinning away from each other, while the wheels on the other side need to spin towards each other. The moving back and forth and turning left and right is working, but when I try strafing, both sets of wheels spin away from each other, which is not correct. Here is my drive code (java):

Code:
double x = -Math.pow(joy1.getRawAxis(0), 3);
	    		double y = -Math.pow(joy1.getRawAxis(1), 3);
	    		double rot = -Math.pow(joy2.getRawAxis(0), 3);
	    		
	    		if(Math.abs(x)>=0.1 || Math.abs(y)>=0.1 || Math.abs(rot)>=0.1) {
	    			mainDrive.mecanumDrive_Cartesian(x, rot, y, gyro.getAngle());
	    		}

The -Math.pow(); statements are for sensitivity, while the if statement is for a threshold. "x" is the x-axis, "y" is the y-axis, and "rot" is rotation. joy1 and joy2 are joysticks. If this is a mechanical problem, how do I fix it? If it is a programming problem, how do I fix it?
Reply With Quote
  #2   Spotlight this post!  
Unread 12-15-2016, 08:40 PM
Christopher149 Christopher149 is offline
Registered User
FRC #0857 (Superior Roboworks) FTC 10723 (SnowBots)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2007
Location: Houghton, MI
Posts: 1,094
Christopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond repute
Re: Holonomic Drive Issues With Strafing

How did you initialize mainDrive? Are the motors in the order (int frontLeftMotor, int rearLeftMotor, int frontRightMotor, int rearRightMotor) (from documentation)?
__________________
2015-present: FTC 10723 mentor
2012-present: 857 mentor
2008-2011: 857 student

2015: Industrial Design, Excellence in Engineering, District Finalist, Archimedes Division (#6 alliance captain)
2014: Judges Award, District Engineering Inspiration, District Finalist, Galileo Division

Reply With Quote
  #3   Spotlight this post!  
Unread 12-15-2016, 09:38 PM
minisolarclown minisolarclown is offline
Registered User
FRC #3603
Team Role: Programmer
 
Join Date: Dec 2016
Rookie Year: 2015
Location: Reed City
Posts: 7
minisolarclown is an unknown quantity at this point
Re: Holonomic Drive Issues With Strafing

Quote:
Originally Posted by Christopher149 View Post
How did you initialize mainDrive? Are the motors in the order (int frontLeftMotor, int rearLeftMotor, int frontRightMotor, int rearRightMotor) (from documentation)?
I initialized it a little differently. I used victors instead of ints, but it still gives the same effect. All of the victors are programmed and wired correctly. The parameters inside Victor(x) is its pin.

Code:
Victor backLeftMotor = new Victor(1);
Victor backRightMotor = new Victor(2);
Victor frontLeftMotor = new Victor(3);
Victor frontRightMotor = new Victor(4);
	
RobotDrive mainDrive = new RobotDrive(frontLeftMotor, backLeftMotor, frontRightMotor, backRightMotor);
Reply With Quote
  #4   Spotlight this post!  
Unread 12-16-2016, 01:13 AM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,997
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: Holonomic Drive Issues With Strafing

Quote:
Originally Posted by minisolarclown View Post
when I try strafing, both sets of wheels spin away from each other
Does this happen when you trying strafing to the right, or to the left?


Reply With Quote
  #5   Spotlight this post!  
Unread 12-16-2016, 07:14 AM
minisolarclown minisolarclown is offline
Registered User
FRC #3603
Team Role: Programmer
 
Join Date: Dec 2016
Rookie Year: 2015
Location: Reed City
Posts: 7
minisolarclown is an unknown quantity at this point
Re: Holonomic Drive Issues With Strafing

Quote:
Originally Posted by Ether View Post
Does this happen when you trying strafing to the right, or to the left?


It does the exact same thing when trying to strafe either direction.
Reply With Quote
  #6   Spotlight this post!  
Unread 12-16-2016, 09:20 AM
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,536
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: Holonomic Drive Issues With Strafing

Quote:
Originally Posted by Ether View Post
Does this happen when you trying strafing to the right, or to the left?
Quote:
Originally Posted by minisolarclown View Post
It does the exact same thing when trying to strafe either direction.
Please double check that - do the spin towards each other when strafing left and away from each other when strafing right, vice versa, or always away from each other?

If either of the first two cases, it sounds like the front and rear wheels on one side are swapped, as for rotation and driving forward/reverse, the two wheels on each side do the same thing.

Edit: The simplest scenario I can think of for the last case is if you are squaring the strafe joystick instead of cubing it. (or some other even power) on top of having one side wheels swapped.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.

Last edited by GeeTwo : 12-16-2016 at 11:57 AM. Reason: fixed quote tag
Reply With Quote
  #7   Spotlight this post!  
Unread 12-16-2016, 05:38 PM
minisolarclown minisolarclown is offline
Registered User
FRC #3603
Team Role: Programmer
 
Join Date: Dec 2016
Rookie Year: 2015
Location: Reed City
Posts: 7
minisolarclown is an unknown quantity at this point
Re: Holonomic Drive Issues With Strafing

When trying to move left and right, the wheel always move towards each other. The exponent is three, so it's not a parabola when you graph it. The exponent is to give more control over the lower speeds. At my next robotics practice, I'll try switching motors around.
Reply With Quote
  #8   Spotlight this post!  
Unread 12-16-2016, 09:08 PM
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,536
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: Holonomic Drive Issues With Strafing

Quote:
Originally Posted by minisolarclown View Post
..when I try strafing, both sets of wheels spin away from each other..
Quote:
Originally Posted by minisolarclown View Post
When trying to move left and right, the wheel always move towards each other.
Both of these conditions will result in no net movement, but they are not the same. Put the robot on blocks and attempt a strafe to the right. The front left wheel and rear right wheels should drive forward, and the other two in reverse. If I'm understanding you at all, two of these will be the opposite of what they should be. Swap these two motors. Whether you do this through declarations in software, swapping of PWM cables, or swapping of power cables from the motor controllers to the motors will not make any functional difference, but you should double check that the wiring and software match each other; hopefully you will find the problem on inspection and fix the "right" thing. If you swap the "wrong" things, it will work for now, but you will be even further confused if you ever encounter another issue, or if someone notices that the documentation and wiring don't match and quietly "fix" the problem by making reality match the documentation.



Quote:
Originally Posted by minisolarclown View Post
The exponent is three, so it's not a parabola when you graph it. The exponent is to give more control over the lower speeds.
Yes, I have seen the "raising to power" solution to enhance sensitivity at the low end. The biggest downside of this seems to be expansion of the deadband. The Victor SSP has a 4% deadband, and the Victor 888 a 5.4% deadband. If the joystick inputs are cubed, this gives the SSP an effective 34% deadband, and the 888 an effective 38% deadband. If, instead, you square the results but preserve sign (e.g. with joy * abs(joy)), the deadbands are only expanded to 20% and 23%, which are still rather large. I recall once writing a "joystick_adj" function which allowed me to tune the amount of gain. On that occasion, I wound up using something like:
Code:
double joystick_adj(double raw)
{
    return raw * pow(abs(raw),0.3);
}
Which would have given a dead band of 8.4% or 10.6% for these victors, but which still resulted in considerably more effective sensitivity at the low end. The neat thing about the form above is that you can modify that 0.3 up or down until your drivers are most happy with it.
__________________

If you can't find time to do it right, how are you going to find time to do it over?
If you don't pass it on, it never happened.
Robots are great, but inspiration is the reason we're here.
Friends don't let friends use master links.
Reply With Quote
  #9   Spotlight this post!  
Unread 12-16-2016, 10:18 PM
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 7,997
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: Holonomic Drive Issues With Strafing

Quote:
Originally Posted by minisolarclown View Post
The exponent is three, so it's not a parabola when you graph it. The exponent is to give more control over the lower speeds.
https://www.chiefdelphi.com/media/papers/2421


Reply With Quote
  #10   Spotlight this post!  
Unread 12-19-2016, 09:16 PM
minisolarclown minisolarclown is offline
Registered User
FRC #3603
Team Role: Programmer
 
Join Date: Dec 2016
Rookie Year: 2015
Location: Reed City
Posts: 7
minisolarclown is an unknown quantity at this point
Re: Holonomic Drive Issues With Strafing

Thank you guys so much for helping me! All I had to do was invert the motors on the right and change some parameters
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 07:30 AM.

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