To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.nqcOpen lugnet.robotics.rcx.nqc in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / NQC / 1805
1804  |  1806
Subject: 
time sampling under the rcx standard OS
Newsgroups: 
lugnet.robotics.rcx.nqc
Date: 
Sat, 17 Sep 2005 07:59:28 GMT
Viewed: 
5563 times
  
Hi list,

I'm trying to implement a position regulation (using a motor and a rotation
sensor), using for instance a PID (Proportional-Integral-Derivative) regulation.
I tried to code it in NQC, using the standard OS, but it seems that the RCX
loops at very low and unreliable frequency (few Hertz). Please see example at
the end of this post.
I heard that BrickOS might allow a more reliable time control, but I'd
appreciate a solution to keep me using the standard OS and NQC !

- Can the standard RCX OS sample a sensor value at a known and constant rate ?

- Can this rate be higher (at least 50Hz) in order to get a good regulation?

- Or should I get better results using BrickOS ?

As example below is a code for a PWM (Pule Width Modulation), in which a
rotation sensor allows 10 pulse rates to the motor, looping at 0.1 seconds :

task main()
{
SetSensor(SENSOR_2,SENSOR_ROTATION);
SetPower(OUT_A,1);
while(true)
{
int actif=SENSOR_2;
int passif=10-actif;
OnFwd(OUT_A);
Wait(actif);
Off(OUT_A);
Wait(passif);
SetUserDisplay(actif,0);
}
}

The problem is that it doesn't loop at 0.1 seconds, but much slower (~0.5
second)... while I'd like to control time at few ms accuracy.
Any advice to help me keep using the standard OS and NQC ?



Message has 2 Replies:
  Re: time sampling under the rcx standard OS
 
(...) Francois, I think you should be able to get much faster sampling. I can easily get 10-20 Hz, and others have claimed to get down to 3 ms. Whether it can be done at a constant rate, I'm not sure, and think it probably depends on what else is in (...) (19 years ago, 17-Sep-05, to lugnet.robotics.rcx.nqc)
  Re: time sampling under the rcx standard OS
 
(...) From what I've seen, the standard firmware takes about 3ms per command, and the same program will run on BrickOS about 100 times faster. I usually set up my BrickOS programs so they use the internal timer, and only update the motor setting (...) (19 years ago, 17-Sep-05, to lugnet.robotics.rcx.nqc)

10 Messages in This Thread:



Entire Thread on One Page:
Nested:  All | Brief | Compact | Dots
Linear:  All | Brief | Compact
    

Custom Search

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