View Single Post
  #8   Spotlight this post!  
Unread 22-09-2013, 15:14
magnets's Avatar
magnets magnets is offline
Registered User
no team
 
Join Date: Jun 2013
Rookie Year: 2012
Location: United States
Posts: 748
magnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond reputemagnets has a reputation beyond repute
Re: Converting Two joystick values into a vector

It really depends on what you are looking for. The getTheta method I posted doesn't really do what you want.

This might
Code:
 public static double getTheta(double x, double y){
        double z = Math.atan2(y,x);
        double degrees = z * (180.0 / Math.PI); // convert to degrees
        degrees = (degrees > 0.0 ? degrees : (360.0 + degrees)); // correct discontinuity
        System.out.println(degrees+"t");
        return degrees;
    }
The problem is that the joysticks don't give a robot an x and y component, they give a forward rate and turning rate components, which are different. I'm not really sure what you want.