Go to Post Boy was that a sleepless night! - Suneet [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

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #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.
 


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 22:38.

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