Jump to content

Recommended Posts

Posted (edited)

I've posted this over on Mindboards but it seems a bit slow over there atm... I hope it's in the right place here.

I'm trying to do a basic linefollow program which I can do without using variables easily enough but I thought I'd try and be a little more creative and put a calibration routine in, based loosely on the nxtprograms.com smoothfollow program calibration routine. As such I have four variables; White, Black, Grey, and Light. Light is a dynamic variable that is frequently rewritten from the light intensity value (0-100) from a single light sensor. White and Black are measured by scanning to the left (and back again) whilst values are continually fed back so that the max. is set as White and the min. is set as Black. Grey is just (Black + White)/2. This, and the turn on green routine I've made, work but the line follow part based on the light sensors data and the variables don't work.

What I want to do is use these variables to control the duration of a motor block. I want it to move either left or right until it is either greater or less than Grey but nothing I've tried works. So far I've been doing things like this:

nxtfai11.jpg

and

nxtfai10.jpg

These do not work and I can't see why... how can I make this work? Can someone tell me what's wrong with my thinking here?

TIA,

Simon

Edited by TasV
Posted

What exactly is happening? You will need to stop the motors at some point. You turn the motors on for unlimited and there is no block stopping the motors. I don't know if you stop them in some other place in the program, but that could be the problem if your robot is just spinning.

Posted

Spinning around is one of the things it does... it doesn't seem to be sensing the black line. I've backed the power right down while we are getting it right so it doesn't spin out of control... it just doesn't seem to be sensing the line and if it does it does not correct itself... more like a little pause in its motion and on it goes. I've put a motion block after the switch now and set it to all motors stopped to see if that helps.

Posted

A problem I have had with line following programs is the lighting. Often my lighting wasn't strong enough for my sensor to work properly. Try shining a flashlight on the path of your robot. That really helped me.

Posted (edited)

I have LED lights connected to a motor port that is run by a parallel program all the time. This largely overcomes the lighting issues. This is a programming issue, somewhere, and I can't work out where I've made a mistake. Why would I need to convert the sensor values to text? Adding stops to the motors helped it track but it crawled at a snails pace.

Edited by TasV
Posted

I have LED lights connected to a motor port that is run by a parallel program all the time. This largely overcomes the lighting issues. This is a programming issue, somewhere, and I can't work out where I've made a mistake. Why would I need to convert the sensor values to text? Adding stops to the motors helped it track but it crawled at a snails pace.

The nxt recognizes it as text when it comes out.
Posted

That's what I meant... I've actually got this working today. No need to convert anything to text...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...