roneos
Operating System for the r-one robot
 All Data Structures Files Functions Variables Typedefs Groups
encoder.h File Reference

Deals with who the encoder ticks and its translation to distance. More...

Go to the source code of this file.

Functions

void encoderInit (void)
 Initializes the encoder. More...
 
int32 encoderGetTicks (uint32 enc)
 Initializes the encoder. More...
 
int32 encoderGetDirection (uint32 enc)
 Gets the current rotating direction of the encoder. More...
 
int32 encoderGetVelocity (uint32 enc)
 Gets the current velocity of the specified encoder. More...
 
int32 encoderDeltaTicks (uint32 new, uint32 old)
 Gets the difference between the two input ticks. More...
 
void encoderPoseUpdate (void)
 Updates the encoder's position. More...
 
void encoderPoseClear (void)
 Clears the x, y, theta and odometer values of the encoder. More...
 
void encoderGetPose (Pose *posePtr)
 Gets the pose of the encoder and stores it in variables (x, y, theta) of where posePtr points to. More...
 
void encoderSetPose (Pose *posePtr)
 Sets the pose of the encoder as variables of where posePtr points to. More...
 
uint32 encoderGetOdometer (void)
 Finds and returns the odometer reading in mm. More...
 

Detailed Description

Deals with who the encoder ticks and its translation to distance.

There is an assumption that encoder_pose_update() will be called on a regular basis to ensure accuracy. Keep updating in micrometers. The encoders have a resolution of 0.0625mm. That is, each tick represents a change of 0.0625 mm. Our pose is stored in micrometers and microradians. Each tick corresponds to 62.5 micrometers. Rounding to 63.

x,y coordinates are stored in micrometers theta is represented in microradians

Since
Mar 26, 2011
Author
James McLurkin

Function Documentation

int32 encoderDeltaTicks ( uint32  new,
uint32  old 
)

Gets the difference between the two input ticks.

Parameters
newis the new encoder position
oldis the old encoder position
Returns
the difference between old and new position with rollover protection
int32 encoderGetDirection ( uint32  enc)

Gets the current rotating direction of the encoder.

Parameters
encspecifies which encoder (right or left) to look up
Returns
the current rotating direction
uint32 encoderGetOdometer ( void  )

Finds and returns the odometer reading in mm.

Returns
odometer in mm
void encoderGetPose ( Pose posePtr)

Gets the pose of the encoder and stores it in variables (x, y, theta) of where posePtr points to.

Parameters
posePtrpoints to a Pose structure
Returns
void
int32 encoderGetTicks ( uint32  enc)

Initializes the encoder.

Enables the peripherals. Sets the state of the odometer to 0,0,0.

Returns
void
int32 encoderGetVelocity ( uint32  enc)

Gets the current velocity of the specified encoder.

Parameters
encspecifies which encoder (right or left) to look up
Returns
the current velocity
void encoderInit ( void  )

Initializes the encoder.

Enables the peripherals. Sets the state of the odometer to 0,0,0.

Returns
void
void encoderPoseClear ( void  )

Clears the x, y, theta and odometer values of the encoder.

Returns
void
void encoderPoseUpdate ( void  )

Updates the encoder's position.

Returns
void
void encoderSetPose ( Pose posePtr)

Sets the pose of the encoder as variables of where posePtr points to.

Parameters
posePtrpoints to a Pose structure
Returns
void