View Single Post
  #12   Spotlight this post!  
Unread 05-05-2012, 05:50 PM
Ziv Ziv is offline
Has code to be writing...
FRC #0125 (Nutrons)
Team Role: Alumni
 
Join Date: Mar 2010
Rookie Year: 2009
Location: Boston
Posts: 39
Ziv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of lightZiv is a glorious beacon of light
Re: paper: Team 341 Vision System Code

Quote:
Originally Posted by sebflippers View Post
Thanks for the code. I believe lines 322-334 [snipped] could be replaced with
Code:
private double boundAngle0to360Degrees(double angle)
    {
        return(abs(angle)%360.0);
    }
Consider the angle -90. Daisy's code returns 270, but yours returns 90. I think you're looking for something more like this:

Code:
private double boundAngle0to360Degrees(double angle)
    {
        double ret = abs(angle)%360.0;
        if(angle < 0.0)
        {
            ret = -ret;
        }
        return(ret);
    }
Reply With Quote