Go to Post To go a step further, to be "steam punk", electrics would need to be powered from a steam turbine operated dynamo but electric wiring would still be required to follow all rules as they would apply. - Al Skierkiewicz [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
  #16   Spotlight this post!  
Unread 09-01-2015, 09:04
jszipszky jszipszky is offline
Registered User
FRC #1168 (FriarBot)
Team Role: Programmer
 
Join Date: Jan 2015
Rookie Year: 2014
Location: United States
Posts: 5
jszipszky is an unknown quantity at this point
Re: Mechanum with XBox Controller

Quote:
Originally Posted by Ethan_P View Post
for mechanum wheels, our team also uses a Xbox controller. We have the right joystick axis mapped to the linear movement of the robot, and the the left joystick x axis mapped to the rotation.
Here's a simplified version of our code:

//FLMotor = Front Left Motor
//FRMotor = Front Right Motor
//BLMotor = Back Left Motor
//BRMotor = Back Right Motor
//x = right joystick, x axis
//y = right joystick, y axis
//yaw = left joystick, x axis

FLMotor = y + x + yaw
FRMotor = y - x - yaw
BLMotor = y - x + yaw
BRMotor = y + x - yaw

The values will have to be limited, other-wise it will go beyond the accepted values (-1 to 1). Make sure the wheels are set up properly, and good luck!
We do something very similar to this. I don't want to hijack this thread but how are you limiting the values? Right now in our rough code we have a mess of if-elses determining if the values are over 1. I imagine that there is a better way to do this?

Last edited by jszipszky : 09-01-2015 at 19:10.
Reply With Quote
  #17   Spotlight this post!  
Unread 09-01-2015, 09:06
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: Mechanum with XBox Controller

Okay thanks guys! Ill let you know if I can get it to work
Reply With Quote
  #18   Spotlight this post!  
Unread 10-01-2015, 22:39
Jalerre's Avatar
Jalerre Jalerre is offline
Registered User
FRC #4965 (FIRE)
Team Role: Alumni
 
Join Date: Apr 2014
Rookie Year: 2013
Location: Anderson, SC
Posts: 147
Jalerre is on a distinguished road
Re: Mechanum with XBox Controller

Our team uses mecanum with a Logitech F310 gamepad. The way we map the controls is that we use tank drive with the joysticks to control forwards, backwards, and rotation. For strafing we use the back triggers because they are analog. I believe they translate to twist on the flight sticks. Hope this helps.

Last edited by Jalerre : 10-01-2015 at 22:42.
Reply With Quote
  #19   Spotlight this post!  
Unread 17-01-2015, 13:06
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,102
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: Mechanum with XBox Controller

Quote:
Originally Posted by jszipszky View Post
I don't want to hijack this thread but how are you limiting the values? Right now in our rough code we have a mess of if-elses determining if the values are over 1. I imagine that there is a better way to do this?
You don't need any "elses"

Code:

max=fabs(s1);
if (fabs(s2)>max) max=fabs(s2);
if (fabs(s3)>max) max=fabs(s3);
if (fabs(s4)>max) max=fabs(s4);
if (max>1) {s1/=max; s2/=max; s3/=max; s4/=max;}

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:16.

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