Go to Post its kind of a bad idea to implement traction control when you have no traction in the first place. - Uberbots [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
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 28-01-2015, 15:56
RoboBucs RoboBucs is offline
Registered User
FRC #5005
 
Join Date: Jan 2015
Location: Chattanooga, TN
Posts: 72
RoboBucs is an unknown quantity at this point
Joystick issues

Ok so whenever we run the robot, the robot moves forward and backward if we move the joystick left and right, and if we move the joystick forward and backward, nothing happens. Here's our code
[IMG][/IMG]
[IMG][/IMG]
Reply With Quote
  #2   Spotlight this post!  
Unread 28-01-2015, 15:57
RoboBucs RoboBucs is offline
Registered User
FRC #5005
 
Join Date: Jan 2015
Location: Chattanooga, TN
Posts: 72
RoboBucs is an unknown quantity at this point
Re: Joystick issues

Oh and we are using a y splitter for the PWM motors.
Reply With Quote
  #3   Spotlight this post!  
Unread 28-01-2015, 15:59
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Joystick issues

You have both motors wired to the x axis of a single joystick. The first output of Index Array unless overridden by an explicit index is Axis 0 or the x axis on a flight stick.
You probably want to use the normal y axis instead.
Either wire from the second output (y-axis), rather than the first output on the Index Array, or add a constant on the left side of both Index Arrays of "1"

Since you are only using one joystick, but using it for tank drive, your robot will only ever go forwards and backwards.
You don't have anything to turn.
It's more common to use two joysticks or at least two different sticks on an xBox-like controller to control the two sides separately.

If you want arcade drive, then you'll have to mix the x/y of the single joystick yourself, since you're avoiding 2 Motor Drive/Arcade.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle

Last edited by Mark McLeod : 28-01-2015 at 16:26.
Reply With Quote
  #4   Spotlight this post!  
Unread 28-01-2015, 16:24
RoboBucs RoboBucs is offline
Registered User
FRC #5005
 
Join Date: Jan 2015
Location: Chattanooga, TN
Posts: 72
RoboBucs is an unknown quantity at this point
Re: Joystick issues

Is there a way to make it so that one joystick controls forward/back and the other joystick controls left/right?
Reply With Quote
  #5   Spotlight this post!  
Unread 28-01-2015, 16:25
Donjoe's Avatar
Donjoe Donjoe is offline
Registered User
FRC #1610
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: Franklin, VA
Posts: 3
Donjoe is an unknown quantity at this point
Re: Joystick issues

Everything Mark said, and just FYI, you don't need to keep calling the same joystick multiple times (the RefNum Registry Get and JoystickGetValues). You can just branch off the array wires and go to the other places you want to use the joystick...similar to how they branched off to send the values to the Smart Dashboard.
Reply With Quote
  #6   Spotlight this post!  
Unread 28-01-2015, 16:29
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Joystick issues

Quote:
Originally Posted by RoboBucs View Post
Is there a way to make it so that one joystick controls forward/back and the other joystick controls left/right?
We call that Arcade drive.
You can look inside the Arcade drive vi to see what it does to mix the x and y of a single joystick in order to get it to turn.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #7   Spotlight this post!  
Unread 28-01-2015, 16:33
RoboBucs RoboBucs is offline
Registered User
FRC #5005
 
Join Date: Jan 2015
Location: Chattanooga, TN
Posts: 72
RoboBucs is an unknown quantity at this point
Re: Joystick issues

Quote:
Originally Posted by Mark McLeod View Post
We call that Arcade drive.
You can look inside the Arcade drive vi to see what it does to mix the x and y of a single joystick in order to get it to turn.
But we can't use an arcade drive vi with the single motor vi's can we?
Reply With Quote
  #8   Spotlight this post!  
Unread 28-01-2015, 16:38
RoboBucs RoboBucs is offline
Registered User
FRC #5005
 
Join Date: Jan 2015
Location: Chattanooga, TN
Posts: 72
RoboBucs is an unknown quantity at this point
Re: Joystick issues

Like, the way I have it now, each joystick controls one set of wheels at a time, but never both at the same time.
Reply With Quote
  #9   Spotlight this post!  
Unread 28-01-2015, 16:46
RoboBucs RoboBucs is offline
Registered User
FRC #5005
 
Join Date: Jan 2015
Location: Chattanooga, TN
Posts: 72
RoboBucs is an unknown quantity at this point
Re: Joystick issues

Man I just can't think of what to do here, every now and then when I change something the motors sound like a gear is loose and make this grinding noise, but other times they dont, but I dont see why I can't get this to work by having one joystick go forward/backward and the other handle left/right.
Reply With Quote
  #10   Spotlight this post!  
Unread 28-01-2015, 16:50
RoboBucs RoboBucs is offline
Registered User
FRC #5005
 
Join Date: Jan 2015
Location: Chattanooga, TN
Posts: 72
RoboBucs is an unknown quantity at this point
Re: Joystick issues

Quote:
Originally Posted by Mark McLeod View Post
We call that Arcade drive.
You can look inside the Arcade drive vi to see what it does to mix the x and y of a single joystick in order to get it to turn.
Like here's what I have now
[IMG][/IMG]
Reply With Quote
  #11   Spotlight this post!  
Unread 28-01-2015, 17:15
RoboBucs RoboBucs is offline
Registered User
FRC #5005
 
Join Date: Jan 2015
Location: Chattanooga, TN
Posts: 72
RoboBucs is an unknown quantity at this point
Re: Joystick issues

Ok now, and this makes no sense whatsoever, when I code it some ways, it sounds like gears are stripping in the motor, but sometimes it doesnt. Any ideas?
Reply With Quote
  #12   Spotlight this post!  
Unread 28-01-2015, 17:21
Mark McLeod's Avatar
Mark McLeod Mark McLeod is online now
Just Itinerant
AKA: Hey dad...Father...MARK
FRC #0358 (Robotic Eagles)
Team Role: Engineer
 
Join Date: Mar 2003
Rookie Year: 2002
Location: Hauppauge, Long Island, NY
Posts: 8,833
Mark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond reputeMark McLeod has a reputation beyond repute
Re: Joystick issues

You cannot have more than one Motor Set Output per motor.
Your code is always giving conflicting orders to the motors.
One joystick is telling the motors to do one thing while the other joystick is contradicting those orders and telling them to do something completely different.
They are fighting each other.

I really suggest you try doing it the normal way until you understand a bit more about how motors work.
__________________
"Rationality is our distinguishing characteristic - it's what sets us apart from the beasts." - Aristotle
Reply With Quote
  #13   Spotlight this post!  
Unread 28-01-2015, 17:35
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Joystick issues

You're obviously thrashing around without a good idea of what the original robot program did or where you need to end up.

Stop.

Save your work and set it aside.

Start over with a fresh default robot project. Don't change anything except to make sure the Open 2 Motor Drive function is using the same PWM outputs the left and right motors are connected to. Invert either the left or the right motor if the robot doesn't drive forward when you push the joystick forward.

If you aren't able to make it drive properly by just defining those few things, ask for help again.

Only after you have the drive motors working the way you want them to should you start adding other things like additional motors, solenoids, etc.
Reply With Quote
  #14   Spotlight this post!  
Unread 28-01-2015, 18:08
RoboBucs RoboBucs is offline
Registered User
FRC #5005
 
Join Date: Jan 2015
Location: Chattanooga, TN
Posts: 72
RoboBucs is an unknown quantity at this point
Re: Joystick issues

Quote:
Originally Posted by Alan Anderson View Post
You're obviously thrashing around without a good idea of what the original robot program did or where you need to end up.

Stop.

Save your work and set it aside.

Start over with a fresh default robot project. Don't change anything except to make sure the Open 2 Motor Drive function is using the same PWM outputs the left and right motors are connected to. Invert either the left or the right motor if the robot doesn't drive forward when you push the joystick forward.

If you aren't able to make it drive properly by just defining those few things, ask for help again.

Only after you have the drive motors working the way you want them to should you start adding other things like additional motors, solenoids, etc.
Alright, well I can't test it until tomorrow, but would something like this work?
[IMG][/IMG]
Reply With Quote
  #15   Spotlight this post!  
Unread 28-01-2015, 18:22
Alan Anderson's Avatar
Alan Anderson Alan Anderson is offline
Software Architect
FRC #0045 (TechnoKats)
Team Role: Mentor
 
Join Date: Feb 2004
Rookie Year: 2004
Location: Kokomo, Indiana
Posts: 9,113
Alan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond reputeAlan Anderson has a reputation beyond repute
Re: Joystick issues

Quote:
Originally Posted by RoboBucs View Post
...would something like this work?
I'm afraid not. You're still sending different commands to each motor in multiple places. You're "using" the Arcade Drive function in a completely inappropriate way. It won't run anyway, because you haven't given it the inputs it requires.

I'm serious -- it's going to be much, much easier to throw away what you have and start over than it would be to try to correct it. Really. Just make a new Arcade Drive robot project, make sure the left and right motors are defined with the proper PWM channels, and be prepared to invert the right motor (or perhaps the left motor, depending on your gearboxes).
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 20:08.

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