View Single Post
  #2   Spotlight this post!  
Unread 20-12-2016, 20:57
kylelanman's Avatar
kylelanman kylelanman is offline
Programming Mentor
AKA: Kyle
FRC #2481 (Roboteers)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Tremont Il
Posts: 185
kylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to all
Re: Confusing Issues with Swerve

That code looks familiar

There is one addition on the end that is likely causing you problems.

Code:
&& angle != 0
In general everything works. If your commanded angle happens to be 0 then regardless of what your current angle is you skip the optimization. In the case of being optimized at 180 and then getting a 0 angle no rotation is required but due to the additional check it thinks a 180 degree rotation is required so it spins 180.

What problem were you trying to solve by adding the additional check?
__________________
"May the coms be with you"

Is this a "programming error" or a "programmer error"?

Reply With Quote