To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.roboticsOpen lugnet.robotics in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / 26945
26944  |  26946
Subject: 
TachoSpeed.nqc
Newsgroups: 
lugnet.robotics
Date: 
Sat, 10 Mar 2007 16:17:19 GMT
Original-From: 
linmix <LINMIX@GMAIL.COMavoidspam>
Viewed: 
3955 times
  
I'm trying to write a simple routine that uses the TachoSpeed  value to
see if my Cybermaster has run into something.
I'm trying this on tiled floor, by making the bot with tank threads run
into the wall, but only very occasionally does it actually do what it's
supposed to do.

Here's the code:

//tachospeed.nqc

#define reverse(t) OnRev(OUT_L+OUT_R); Wait(t);
#define clockwise(t) OnRev(OUT_R); OnFwd(OUT_L); Wait(t);
#define c_clockwise(t) OnRev(OUT_L); OnFwd(OUT_R); Wait(t);

task main()
     {
     OnFwd (OUT_L+OUT_R);
     Wait (20); //without this the if statement is executed immediately
     if (TachoSpeed(OUT_L) < 64)
        {
        reverse (50);
        clockwise (50);
        OnFwd (OUT_L+OUT_R);
        }
     if (TachoSpeed(OUT_R) < 64) //so default behaviour if both OUT_R
and OUT_L are low is turn clockwise
        {
        reverse (50);
        c_clockwise (50);
        OnFwd (OUT_L+OUT_R);
        }
     }

When the bot hits the wall 'watch the brick' reports tacho speed for
OUT_L & OUT_R <= 60

It appears that even the threshold value given by the program and the
actual value reported by 'watch the brick' are off, or that a variation
of less than 4 or 5 points is not reacted to.
If I increase the values the bot is no longer able to negotiate any
inclination in the floor.
Has anyone had the same problem and maybe a solution?

regards
linmix



Message has 1 Reply:
  Re: TachoSpeed.nqc
 
(...) The problem is almost certainly that your program only runs for about 2 tenths of a second. If you want the program to run forward continuously and execute a special behavior if at some point during the execution of the program the TachoSpeed (...) (18 years ago, 11-Mar-07, to lugnet.robotics)

13 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    
Active threads in Robotics

 
Verified and Trusted Team of Hackers
7 hours ago
Custom Search

©2005 LUGNET. All rights reserved. - hosted by steinbruch.info GbR