For the past couple days our team has tried unsuccessfully at using our joystick in the way we would like to use it. All our experienced programmers left last year and our new programmers, myself included, are new to C++.
Our current issue is when we run our code on our robot, it doesn't respond.
The driver station returns this error:
Quote:
|
ERROR: Joystick axis is out of range: ...in GetStickAxis() in C:/WindRiver/workspace/WPILib/DriverStation.cpp at line 226
|
The file it references is
DriverStaion.cpp. It seems like it's saying that we are trying to access too many axes.
Here is the code we were using to test the joystick. Our team is using mecanum wheels and joystick with a twist axis.
Code:
#include "WPILib.h"
class RobotDemo : public SimpleRobot
{
RobotDrive myRobot;
Joystick stick;
public:
RobotDemo(void):
myRobot(1, 2, 3, 4),
stick(1, 3, 0)
{
myRobot.SetExpiration(0.1);
}
void Autonomous(void)
{
}
void OperatorControl(void)
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl())
{
myRobot.HolonomicDrive(stick.GetMagnitude(), stick.GetDirectionDegrees(), stick.GetTwist());
Wait(0.005);
}
}
};
START_ROBOT_CLASS(RobotDemo);
This appears with two different types of joysticks: the Logitech Extreme 3D Pro, which is the joystick we want to use, and the Logitech Attack 3.
This problem only seems to be an issue when we use commands that call GetStickAxis(). Other commands like GetRawStickAxis() seem to work fine.
If anyone can point us in the right direction, it would be much appreciated.