|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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] |
|
#2
|
|||
|
|||
|
Re: Joystick issues
Oh and we are using a y splitter for the PWM motors.
|
|
#3
|
|||||
|
|||||
|
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. Last edited by Mark McLeod : 28-01-2015 at 16:26. |
|
#4
|
|||
|
|||
|
Re: Joystick issues
Is there a way to make it so that one joystick controls forward/back and the other joystick controls left/right?
|
|
#5
|
|||||
|
|||||
|
Re: Joystick issues
Quote:
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. |
|
#6
|
|||
|
|||
|
Re: Joystick issues
But we can't use an arcade drive vi with the single motor vi's can we?
|
|
#7
|
|||
|
|||
|
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.
|
|
#8
|
|||
|
|||
|
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.
|
|
#9
|
|||
|
|||
|
Re: Joystick issues
Quote:
[IMG] [/IMG] |
|
#10
|
|||
|
|||
|
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?
|
|
#11
|
|||||
|
|||||
|
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. |
|
#12
|
|||||
|
|||||
|
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. |
|
#13
|
|||
|
|||
|
Re: Joystick issues
Quote:
[IMG] [/IMG] |
|
#14
|
|||||
|
|||||
|
Re: Joystick issues
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). |
|
#15
|
|||
|
|||
|
Re: Joystick issues
The problem with doing that is that we can't use an arcade drive with the robot because we can't use an open two motor, unless you have a way to make it work by assigning the same pwm twice(or some other way around that). We have both of our left motors wired through PWM 0 and both of our right motors wired through pwm 1. Which is what's making it so absolutely frustrating, we had it moving fine back when we weren't using a cable splitter and I could use open 2 motors with an arcade drive, but 2 of our pwm wires messed up so now we have no choice but to use a splitter.
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|