View unanswered posts | View active topics It is currently Fri Oct 30, 2020 7:08 am

Reply to topic  [ 3 posts ] 
Threshold value 
Author Message

Joined: Wed Jul 03, 2013 4:40 pm
Posts: 2
Post Threshold value
Can you please let me know the threshold value I should use for the line tracking on Palm Island?

Wed Jul 03, 2013 4:44 pm

Joined: Mon Oct 04, 2010 2:18 pm
Posts: 196
Post Re: Threshold value
Sure. Here is a program located in the Palm Island sample programs folder

#pragma config(Sensor, S1,     touchSensor,    sensorTouch)
#pragma config(Sensor, S2,     gyroSensor,     sensorI2CHiTechnicGyro)
#pragma config(Sensor, S3,     lineFollower,   sensorLightActive)
#pragma config(Sensor, S4,     sonarSensor,    sensorSONAR)
#pragma config(Motor,  motorA,          gripperMotor,  tmotorNXT, PIDControl, encoder)
#pragma config(Motor,  motorB,          rightMotor,    tmotorNXT, PIDControl, encoder)
#pragma config(Motor,  motorC,          leftMotor,     tmotorNXT, PIDControl, encoder)
//*!!Code automatically generated by 'ROBOTC' configuration wizard               !!*//

/*+++++++++++++++++++++++++++++++++++++++++++++| Notes |++++++++++++++++++++++++++++++++++++++++++++++
Mission 8 - Line Tracking
- This program will cause your robot to follow the line toward the next Starting Point using feedback
   from the light sensor.
- Your robot will wait for 2 seconds before beginning, move forward at half power for 360 encoder
   counts of the right motor encoder, then track the line using the light sensor, for 1800 encoder counts
   of the right motor encoder.
- ROBOTC must be in Natural Language mode for this prsogram to run. You can set this in the top menu
   by going to Robot > Platform Type > LEGO Mindstorms > Natural Language (NXT).
*   Please note that the values in this program were written for Mammalbot using a high-end computer.
   You may need to adjust the values in this program for your computer.

Robot Model: Mammalbot

[I/O Port]          [Name]              [Type]                   [Description]
Motor Port B        rightMotor          Motor w/ Encoder           Right side motor
Motor Port C        leftMotor           Motor w/ Encoder           Left side motor

task main()
   //Wait for 2 seconds before moving forward

   //Move forward at half power for 360 encoder counts, and stop (on the line)
   untilEncoderCounts(360, rightMotor);

   //Wait for 1 second before line tracking

   //Clear the value in the right motor encoder
   nMotorEncoder[rightMotor] = 0;
   //While less than 5 rotations of the encoder have been counted
   while(nMotorEncoder[rightMotor] < 1800)
      //If the light sensor sees the line, swing turn left
      if(SensorValue[lineFollower] > 35)
         swingTurn(left, 80);
      //Else, if it doesn't see the line, swing turn right
         swingTurn(right, 80);

   //Add the rest of your code here!

The program is in Natural Language. You can see that the threshold is 35. To see the threshold values for any of the virtual worlds, you'd want to do the same thing. Use the programs in the sample programs folder as a reference. If there is anything else you have a question about, please don't hesitate to ask.

Wed Jul 03, 2013 5:02 pm

Joined: Wed Jul 03, 2013 4:40 pm
Posts: 2
Post Re: Threshold value

Wed Jul 03, 2013 5:14 pm
Display posts from previous:  Sort by  
Reply to topic   [ 3 posts ] 

Who is online

Users browsing this forum: No registered users and 0 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.