encoders.h File Reference

Contains functions for reading encoder values. More...

Go to the source code of this file.

Defines

#define LEFT   0
 Left wheel.
#define RIGHT   1
 Right wheel.
#define ENCODER_MAX   1024
 Max value of valid encoder reading.
#define ENCODER_MAGNET_FAILURE   1025
 Magnet misaligned - likely distance from encoder problem.
#define ENCODER_MISALIGNED   1027
 Encoder misaligned - likely on XY plane.
#define ENCODER_DATA_NOT_READY   1026
 Not enough time has passed - encoders not initialized in hardware.
#define ENCODER_DELAY   20
 delay_ms argument after a full read is complete
#define OCF   _BV(4)
#define COF   _BV(3)
#define LIN   _BV(2)
#define MagINCn   _BV(1)
#define MagDECn   _BV(0)
#define BUFFER_SIZE   46
 Buffer size.
#define ERR_VEL   1024

Functions

int encoders_init (void)
 Initialize encoders.
int encoder_read (char encoder)
 Read instantaneous encoder value.
int encoder_get_x (char encoder)
 Get total distance traveled.
int encoder_get_v (char encoder)
 Get instantaneous velocity.
int encoder_get_dx (char encoder)
 Get total distance traveled.
int encoder_rst_dx (char encoder)
 Reset distance counter.
int encoder_get_tc (void)
 Get time count: The number of encoder reads that have occurred.
int encoder_rst_tc (void)
 Reset the time count.
int encoder_wait (int nReadings)
 Waits for the next n encoder reading, then returns.


Detailed Description

Contains functions for reading encoder values.

Copyright (c) 2007 Colony Project

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Contains high and low level functions for reading encoders including reading out total distance covered, and eventually velocity.

Author:
Colony Project, CMU Robotics Club

Generated on Fri Nov 20 21:51:59 2009 for Colony by  doxygen 1.5.8