Go to Post I love you ChiefDelphi times! - Amanda Morrison [more]
Home
Go Back   Chief Delphi > Technical > Control System > Sensors
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 28-01-2015, 17:55
jojoguy10's Avatar
jojoguy10 jojoguy10 is offline
Programming/Controls Mentor
AKA: Joe Kelly
FRC #0997 (Spartan Robotics) and FRC #2990 (Hotwire Robotics)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Stayton, OR
Posts: 283
jojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of light
NavX Field-Centric drive (LabView)

Hello,

I noticed, after playing with the NavX from KuaiLabs a bit, that the GetYaw has a range from -180 to +180. My teams is planning to use field-centric driving.

From a LabView perspective (using the Holonomic drive VI), will it take an input of -180 to +180? Also, how is the best way to "zero" the yaw? In other words, how can I let the robot which way North is (field-centrically)?

Also, I looked at this example: https://code.google.com/p/navx-mxp/w...dOrientedDrive And it doesn't look like they compensated for the -180 to +180 range at all (we just added 180 to the output to get a 0-360 range)

Thanks!
__________________


Reply With Quote
  #2   Spotlight this post!  
Unread 28-01-2015, 18:30
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,034
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: NavX Field-Centric drive (LabView)

Quote:
Originally Posted by jojoguy10 View Post
From a LabView perspective (using the Holonomic drive VI), will it take an input of -180 to +180?
The Java WPILib code will. There's a good chance the LabVIEW will too.

It's a very simple vector rotation.
Code:
    /**
     * Rotate a vector in Cartesian space.
     */
    protected static double[] rotateVector(double x, double y, double angle) {
        double cosA = Math.cos(angle * (3.14159 / 180.0));
        double sinA = Math.sin(angle * (3.14159 / 180.0));
        double out[] = new double[2];
        out[0] = x * cosA - y * sinA;
        out[1] = x * sinA + y * cosA;
        return out;
    }
What's important is that the gyro angle is increasing in the clockwise direction.


Reply With Quote
  #3   Spotlight this post!  
Unread 28-01-2015, 19:00
jojoguy10's Avatar
jojoguy10 jojoguy10 is offline
Programming/Controls Mentor
AKA: Joe Kelly
FRC #0997 (Spartan Robotics) and FRC #2990 (Hotwire Robotics)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Stayton, OR
Posts: 283
jojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of light
Re: NavX Field-Centric drive (LabView)

Quote:
Originally Posted by Ether View Post
The Java WPILib code will. There's a good chance the LabVIEW will too.

It's a very simple vector rotation.
Code:
    /**
     * Rotate a vector in Cartesian space.
     */
    protected static double[] rotateVector(double x, double y, double angle) {
        double cosA = Math.cos(angle * (3.14159 / 180.0));
        double sinA = Math.sin(angle * (3.14159 / 180.0));
        double out[] = new double[2];
        out[0] = x * cosA - y * sinA;
        out[1] = x * sinA + y * cosA;
        return out;
    }
What's important is that the gyro angle is increasing in the clockwise direction.


Right, inside the Holonomic VI, this calculation is going on. Will it handle negative inputs?
__________________


Reply With Quote
  #4   Spotlight this post!  
Unread 28-01-2015, 19:15
Ether's Avatar
Ether Ether is offline
systems engineer (retired)
no team
 
Join Date: Nov 2009
Rookie Year: 1969
Location: US
Posts: 8,034
Ether has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond reputeEther has a reputation beyond repute
Re: NavX Field-Centric drive (LabView)

Quote:
Originally Posted by jojoguy10 View Post
Right, inside the Holonomic VI, this calculation is going on. Will it handle negative inputs?
Sin(-pi/2) gives the same value as Sin(+3pi/2).

Same with Cosine.

Try it in Excel or on your calculator.

Or better yet, try it in a little LabVIEW program.


Reply With Quote
  #5   Spotlight this post!  
Unread 29-01-2015, 00:32
jojoguy10's Avatar
jojoguy10 jojoguy10 is offline
Programming/Controls Mentor
AKA: Joe Kelly
FRC #0997 (Spartan Robotics) and FRC #2990 (Hotwire Robotics)
Team Role: Mentor
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Stayton, OR
Posts: 283
jojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of lightjojoguy10 is a glorious beacon of light
Re: NavX Field-Centric drive (LabView)

Quote:
Originally Posted by Ether View Post
Sin(-pi/2) gives the same value as Sin(+3pi/2).

Same with Cosine.

Try it in Excel or on your calculator.

Or better yet, try it in a little LabVIEW program.


Duh! You're right. We'll try it out next time.
__________________


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

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