Author Topic: need help doing a subroutine on a axon atmega 640  (Read 1559 times)

0 Members and 1 Guest are viewing this topic.

Offline lcabTopic starter

  • Jr. Member
  • **
  • Posts: 20
  • Helpful? 0
need help doing a subroutine on a axon atmega 640
« on: March 23, 2010, 07:21:29 PM »
i am trying to write a subroutine for a line follower sensor called tracker 3.0 made by lynx motion. my problems is that i cant get it to go in a straight line if it goes to one side a little bit more then the other. i added a delay to avoid the blind spot but i can't make it go in straight line
this is the code so far
#include "sys/axon.h"
#include "a2d.h"
#include "servos.h"

// Define two motors

SERVO m2a = MAKE_SERVO(FALSE, E5,1499,453); //left side
SERVO m1a = MAKE_SERVO(TRUE, E4,1500,503);  //right side
SERVO arm = MAKE_SERVO(TRUE, H4,1500,500); //gripper arm
// Create the list - remember to place an & at the start of each servo name
SERVO_LIST servos[] = {&m1a,&m2a,&arm};

// Create a driver for the list of servos


// Global variable that indicates the current state

uint8_t state;

// Initialise the servos

void appInitHardware(void){
TICK_COUNT appInitSoftware(TICK_COUNT loopStart){
    return 0;
TICK_COUNT appControl(LOOP_COUNT loopCount, TICK_COUNT loopStart){

// A3 Left
// A4

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: need help doing a subroutine on a axon atmega 640
« Reply #1 on: March 24, 2010, 09:53:48 PM »
The LynxMotion Tracker has only 3 sensors on it, meaning the resolution is very poor. Poor resolution leads to robot oscillation, in other words, your robot will have trouble going straight.

Two solutions . . . get more sensors, or . . .

Program your robot to go straight more than it turns.

For example, in pseudocode . . .

if(line is on left)
if(line is on right)
else(line is in center)

Your robot will always go forward, because all wheels are going forward always, but your bot will turn just a little when the line goes off center.


Get Your Ad Here