ROBOTC.net forums
http://www.robotc.net/forums/

Absolute Values for Quadrature Encoder Counts
http://www.robotc.net/forums/viewtopic.php?f=11&t=5818
Page 1 of 1

Author:  omarrh [ Mon May 06, 2013 12:04 pm ]
Post subject:  Absolute Values for Quadrature Encoder Counts

I don't know if I am recalling this correctly; but isn't there a way to retreive the counts from the quadrature encoders as absolute values so that both positive and negative counts are shown as positive? I know that when we use the actual robots we can invert the cable connections at the microcontroller so that all forward movements increase the count (count up) and all backward movements decrease the count (count down), falling into negative numbers if they fall below zero. However, this cannot be done physically in RVW because there are no cable connections.

I've searched the Forum and have not been able to come up with a solution.

Thanks in advance for the help.

Author:  JohnWatson [ Tue May 21, 2013 9:59 am ]
Post subject:  Re: Absolute Values for Quadrature Encoder Counts

You should be able to by using the abs() command:

Code:
abs(SensorValue[rightEncoder])
abs(SensorValue[leftEncoder])


You can find more information on the absolute command (as well as other Math commands used in ROBOTC) on the ROBOTC wiki, found here: http://www.robotc.net/wiki/Math#abs

Page 1 of 1 All times are UTC - 5 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/