Thanks Jeff, I believe I understand your explanation but I still don't understand why it's necessary. The only angles we deal with are what we calculate (arctan(dy/dx) and last calculated, which can never be more than 180 or less than -180). Once we calculate the absolute direction we should just command the blade to point that way ( perhaps scaling it to 0-360 instead of -180 to 180). If we were accumulating a relative angle change then that might grow and have to be truncated at some point, but we're dealing with absolute angles. (right?) . The reason for saving the last angle is to make sure we don't turn 359 degrees when we could turn 1 deg. the other way. ie; if we were traveling at 359 degrees and our next direction was 1 degree we need to rotate two degrees counter clock wise, not 358 degrees clockwise.
But that raises another question; when you assign an angle to the rotational axis 'commanded position pin', how can you specify whether it proceeds to that position by traveling clockwise or counter clockwise? Negative angle perhaps? thanks for all your help and (I hope) patience as I figure this out. Steve Jeff Epler wrote: > Your output value should be an absolute angle, not a relative one. > > It's because of this that the business with "turns = floor(...)" is > necessary. Imagine that you re always cutting the pattern in a > counterclockwise direction -- the blade will continue turning in one > direction, and its angle number will get larger and larger, eventually > being greater than 360 degrees (or 2*PI radians, since all the standard > math functions work in radians). > > The floor() function returns the integer part of a number, rounded down. > So floor(1.0) is 1.0, floor(0.5) is 0.0, and floor(-0.5) is -1.0. Thus, > turns gets the number of entire revolutions the blade has performed. > Then, that number of revolutions is added back to the angle computed by > atan2() (which is always in the range of -pi to +pi), and finally > figures out whether the resulting angle, or the angle with one turn more > or less, is closer to the current angle. > > Jeff > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Emc-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/emc-users > > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Emc-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/emc-users
