Go to Post push for what you think is right... just do it in the right way - Andy Baker [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
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 07-02-2012, 21:17
3rik's Avatar
3rik 3rik is offline
Registered User
FRC #3407 (Mustybots)
Team Role: Programmer
 
Join Date: Feb 2012
Rookie Year: 2012
Location: USA
Posts: 1
3rik has a spectacular aura about3rik has a spectacular aura about
Errors with Our Joystick

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.
Reply With Quote
  #2   Spotlight this post!  
Unread 23-03-2013, 13:17
Halo_Kid_3633's Avatar
Halo_Kid_3633 Halo_Kid_3633 is offline
Registered User
FRC #3633 (Catayst)
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2012
Location: Albert Lea, MN
Posts: 9
Halo_Kid_3633 is an unknown quantity at this point
Re: Errors with Our Joystick

Did you figure it out.
Reply With Quote
  #3   Spotlight this post!  
Unread 23-03-2013, 13:25
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 985
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: Errors with Our Joystick

In case anyone else stumbles across this thread in the future, the issue is that the Joystick initializer "stick (1, 3, 0) is specifying that the joystick has 3 axes. Then stick.GetTwist() is being called, which is axis 4.

The fix should be either changing the initializer to "stick (1, 4, 0)" or just "stick(1)"
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 10:02.

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