A bit of prologue background: we're working on rack-and-pinion steering for our robot. As such, I've (supposedly) changed the Default Code to the point where X-axis changes should only be sent to pwm13, the steering motor.
However, it seems that with either of the joysticks sent with the KOP, the x changes are for some reason sent to the drive motors as well as the steering motor and the Y-axis changes are sent to the steering motor as well as the drive motors.
Here's the PWM setup:
pwm16: Right drive motors
pwm15: Left drive motors
pwm13: Steering motor
Here's the steering code (so far, not sure if it works yet!

)
Code:
if (p1_x >= MAXI) {
XDelta = MAXI-Temp;
}
else if (p1_x <= MINI)
{
XDelta = MINI - Temp;
}
if (XDelta < 0 && XDelta < -4) {
XDelta *= -1;
for (i = 0; i<(XDelta/4); i++) {
for (j = 0; j < 10; j++) {
pwm13 = 0;
}
pwm13 = 127;
MAXI -= 4;
MINI -= 4;
}
Temp = p1_x;
}
else if (XDelta > 0 && XDelta > 4)
{
for (i = 0; i<(XDelta/4); i++) {
for (j = 0; j<10; j++) {
pwm13 = 255;
}
pwm13 = 127;
MAXI += 4;
MINI += 4;
}
Temp = p1_x;
}
Temp, MAXI, and MINI are all global variables first initialized in User_Initialization(). XDelta is a local variable unused elsewhere.
Here is the drive motor code (such as it is) :
Code:
if (TempY > p1_y+15)
{
TempTemp = p1_y/2;
pwm15 = Exponential_Grow(TempTemp,0);
pwm16 = Exponential_Grow(TempTemp,0);
TempY = p1_y/2;
}
else if (TempY < p1_y-15)
{
TempTemp = p1_y/2;
pwm15 = Exponential_Grow(TempTemp,0);
pwm16 = Exponential_Grow(TempTemp,0);
TempY = p1_y/2;
}
else
{
pwm15 = Exponential_Grow(p1_y,0);
pwm16 = Exponential_Grow(p1_y,0);
TempY = p1_y;
}
TempY is also a global variable initialized in User_Initialization(). TempTemp is a local variable not used anywhere else.
As far as I can tell, it's displaying behavior similar to that of the basic Default code and trying to do the two-wheeled turning using pwms 13-16.
Any help would be very, very appreciated!