|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Single Joystick Tank Drive
Yup
|
|
#2
|
||||
|
||||
|
Re: Single Joystick Tank Drive
Try a different joystick.
|
|
#3
|
||||
|
||||
|
Re: Single Joystick Tank Drive
I believe you can also go into the windows control panel, find the Game Controllers adapter and use it to center the joystick (ie, the joystick reads 0,0 when centered).
|
|
#4
|
|||
|
|||
|
Re: Single Joystick Tank Drive
It does say 0.0 at the beginning, but after driving it for a bit then letting go, it doesn't always center perfectly.
Both of our joysticks do that :\ |
|
#5
|
||||
|
||||
|
Re: Single Joystick Tank Drive
Quote:
|
|
#6
|
|||
|
|||
|
Re: Single Joystick Tank Drive
They're clean outta the box ones... :'(
|
|
#7
|
||||
|
||||
|
Re: Single Joystick Tank Drive
Maybe there's an error in your software?
Try loading the default code that came with the LabVIEW installation and run it and see if it does the same thing. |
|
#8
|
|||
|
|||
|
Re: Single Joystick Tank Drive
After updating and running stuff again, joysticks center within 0.05 from center. Still not a perfect 0.
However, after playing around with various types of if statements, I'm starting to get the impression that the default way is the only way of making it operate smoothly. If you look at the http://web.goodrobot.com/blog/wp-con.../tankdrive.png diagram clockwise, by default we get the "motor forward x3, motor off, motor backward x3, motor off" pattern.. That way there is never a situation where the motor has to abruptly switch directions. If swapping the reverse directions, we get "motor forward x3, motor backward x3, motor off, motor backward, motor off". That way at some point there's an abrupt change in motors from going backwards to forward. That is the issue I've been having and at this point I see no way of avoiding it. If I'm wrong, please correct me. |
|
#9
|
||||
|
||||
|
Re: Single Joystick Tank Drive
Quote:
I believe the pseudo-code below implements the behavior shown in the diagram you referenced: Code:
float Xj, Yj, L, R;
float max, sum, dif;
max = abs(Xj); if (abs(Yj)>max) max = abs(Yj);
sum = Xj+Yj; dif = Xj-Yj;
if(Yj<=0)
{
if(Xj>=0)
{
// first quadrant
L = max;
R = -sum;
}
else
{
// second quadrant
L = dif;
R = max;
}
}
else
{
if(Xj>=0)
{
// fourth quadrant
L = dif;
R = -max;
}
else
{
// third quadrant
L = -max;
R = -sum;
}
}
Code:
float Xj, Yj, L, R;
float max, sum, dif, deadband;
if (Yj>-deadband)&&(Yj<deadband) Yj=0;
max = abs(Xj); if (abs(Yj)>max) max = abs(Yj);
sum = Xj+Yj; dif = Xj-Yj;
if(Yj<=0)
{
if(Xj>=0)
{
// first quadrant
L = max;
R = -sum;
}
else
{
// second quadrant
L = dif;
R = max;
}
}
else
{
if(Xj>=0)
{
// fourth quadrant
L = -max;
R = dif;
}
else
{
// third quadrant
L = -sum;
R = -max;
}
}
*if using Jaguars, you may want to experiment with putting the jumper in the "coast" setting to avoid abrupt motor braking when transitioning into/out_of the deadband zone Last edited by Ether : 05-02-2011 at 14:54. Reason: added footnote; corrected modified code |
|
#10
|
|||
|
|||
|
Re: Single Joystick Tank Drive
I've tried having a dead zone, treating everything within 0.1 from the axis, as 0.
Then problem is that when you move the joystick all the way right to turn on the spot, then move it slightly forward, then slightly backwards, you can hear the motors clicking as they're going from "left forward right backwards" to "left backwards right forward". I tried to play around with giving it more of a dead zone when turning on the spot Code:
//x, y = joystick position
if (abs(x) > 0.5){
if (abs(y) < 0.3)
y = 0;}
I think my driver will have to get used to driving the way it was originally, with swapped reverses. |
|
#11
|
||||
|
||||
|
Re: Single Joystick Tank Drive
Quote:
You could install the gyro and use it so that the driver interface would allow the driver to issue field-centric commands. The driver points the joystick, and the vehicle turns and goes in that direction at a speed determined by the magnitude of the joystick displacement. Last edited by Ether : 06-02-2011 at 09:35. |
|
#12
|
|||
|
|||
|
Re: Single Joystick Tank Drive
I love the concept, but it's a little bit more advanced than I can manage at the moment :\ This is our rookie year, and there's a lot more to figure out. Maybe in the future!
Thanks so much for your help ![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|