NEX Robotics
0
Total pulses in 360
= Number of slots on the encoder disc / Number of wheel rotations of in 360
= 30 x 5.882
= 176.46 (approximately 176)
Position Encoder Resolution in Degrees = 360 /176
4.2.2 Interrupt service routine for position encoder
4.2.2.1 ISR for right position encoder
//ISR for right position encoder
ISR(INT5_vect)
{
ShaftCountRight++;
}
4.2.2.2 ISR for left position encoder
//ISR for left position encoder
ISR(INT4_vect)
{
ShaftCountLeft++;
}
4.2.3 Functions for robot position control
4.2.3.1 Function for rotating robot by specific degrees
//Function used for turning robot by specified degrees
void angle_rotate(unsigned int
{
float
ReqdShaftCount = 0;
unsigned long int
ReqdShaftCountInt = 0;
ReqdShaftCount = (float) Degrees/ 4.090;
ReqdShaftCountInt =
ShaftCountRight = 0;
ShaftCountLeft = 0;
while (1)
{
if((ShaftCountRight >= ReqdShaftCountInt) | (ShaftCountLeft >= ReqdShaftCountInt))
break;
}
stop();
//Stop robot
}
www.nex-robotics.com
Rotation of Robot
= 2.045 degrees per count
//increment right shaft position count
//increment left shaft position count
Degrees)
// division by resolution to get shaft count
(unsigned
int) ReqdShaftCount;
Fire Bird V Software Manual
0
rotation of robot
70
Need help?
Do you have a question about the Fire Bird V ATMEGA2560 and is the answer not in the manual?