Go to Post I've had parents tell me I'm a great role model for their daughters, because I was a female leader. It's a great feeling to hear something like that. - Liz Smith [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 18-02-2014, 20:24
danebouchie danebouchie is offline
Registered User
FRC #5018
 
Join Date: Jan 2014
Location: Windermere
Posts: 8
danebouchie is an unknown quantity at this point
Data Range on Joystick.getRawAxis

I couldn't find what the range goes to. Is it mesaured in angles (0-360), radians (0-2pi) or -1 to 1? (Java)

Last edited by danebouchie : 18-02-2014 at 20:29.
  #2   Spotlight this post!  
Unread 18-02-2014, 20:36
NWChen's Avatar
NWChen NWChen is offline
Alum
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: New York City
Posts: 205
NWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to behold
Re: Data Range on Joystick.getRawAxis

getRawAxis() returns a double in the range -1.0 to 1.0. As a default (joystick centered) the method returns 0.0.

For more information look at the WPILib API courtesy of 2168.
  #3   Spotlight this post!  
Unread 19-02-2014, 04:36
Joe Ross's Avatar Unsung FIRST Hero
Joe Ross Joe Ross is offline
Registered User
FRC #0330 (Beachbots)
Team Role: Engineer
 
Join Date: Jun 2001
Rookie Year: 1997
Location: Los Angeles, CA
Posts: 8,600
Joe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond reputeJoe Ross has a reputation beyond repute
Re: Data Range on Joystick.getRawAxis

Quote:
Originally Posted by Signet View Post
getRawAxis() returns a double in the range -1.0 to 1.0. As a default (joystick centered) the method returns 0.0.

For more information look at the WPILib API courtesy of 2168.
I'm curious where you found that information in the javadocs. I couldn't find it.
  #4   Spotlight this post!  
Unread 19-02-2014, 08:58
NWChen's Avatar
NWChen NWChen is offline
Alum
no team
 
Join Date: Oct 2012
Rookie Year: 2012
Location: New York City
Posts: 205
NWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to beholdNWChen is a splendid one to behold
Re: Data Range on Joystick.getRawAxis

Quote:
Originally Posted by Joe Ross View Post
I'm curious where you found that information in the javadocs. I couldn't find it.
The method summary of getRawAxis() in Joystick links to this source code:
Code:
public double getRawAxis(final int axis) {
    return m_ds.getStickAxis(m_port, axis);
}
getStickAxis() is a method of DriverStation:
Code:
private DriverStation m_ds;
and in the DriverStation class the getStickAxis() method used with m_ds earlier is as follows:
Code:
public double getStickAxis(int stick, int axis) {
       if (axis < 1 || axis > kJoystickAxes) {
           return 0.0;
       }
   
           int value;
           switch (stick) {
                    ...
           default:
               return 0.0;
       }
   
       double result;
       if (value < 0) {
           result = ((double) value) / 128.0;
       } else {
           result = ((double) value) / 127.0;
       }
   
       // wpi_assert(result <= 1.0 && result >= -1.0);
       if (result > 1.0) {
           result = 1.0;
       } else if (result < -1.0) {
           result = -1.0;
       }
    return result;
}
  #5   Spotlight this post!  
Unread 19-02-2014, 09:03
gluxon's Avatar
gluxon gluxon is offline
\n
AKA: Brandon Cheng
FRC #0178 (The 2nd Law Enforcers)
Team Role: Leadership
 
Join Date: Apr 2012
Rookie Year: 2011
Location: Connecticut
Posts: 65
gluxon has a spectacular aura aboutgluxon has a spectacular aura aboutgluxon has a spectacular aura about
Re: Data Range on Joystick.getRawAxis

Quote:
Originally Posted by Signet View Post
The method summary of getRawAxis() in Joystick links to this source code:
Code:
       double result;
       if (value < 0) {
           result = ((double) value) / 128.0;
       } else {
           result = ((double) value) / 127.0;
       }
}
Interesting. I wonder if positive joystick values are expanded (more sensitive) than negative ones looking at this code.
  #6   Spotlight this post!  
Unread 19-02-2014, 09:54
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Data Range on Joystick.getRawAxis

Quote:
Originally Posted by gluxon View Post
Interesting. I wonder if positive joystick values are expanded (more sensitive) than negative ones looking at this code.
Not really.

The JS is sent as a signed int (two's compliment) in the UDP packet.

A signed int has a range of -128 to +127. This is because there is no 'negative zero', so there is 1 'extra' count on the negative side since zero is considered a positive number.
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
Closed Thread


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 02:45.

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