Subject:
|
Re: Speed control of motors
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Thu, 30 Mar 2000 22:07:55 GMT
|
Viewed:
|
2095 times
|
| |
 | |
Philippe Jadin wrote in message <38E37D1D.41AE5F3A@skynet.be>...
> You should turn on and off the motor output and vary the ratio between
> on and off. I'm not sure if it will works though.
It works wonders! I've used that on just about all of my cartesian robots.
Really smooths things out. An example for a simple linear axis set up like
this:
|O|
|O|
|O|] b
|O|
|O| ____
|O| | |
|O| <| a |
|O| |____|
|O|
|O|
|O|]
|O|
|O|
where "a" is a touch sensor and "b" is a bump on the axis to activate the
touch switch... Do this code in NQC for smooth acceleration and
deceleration! This assumes the driving motor is connected to port A and the
touch-sensor is on port 1.
task main()
{
SetSensorType(SENSOR_1, SENSOR_TYPE_TOUCH);
while(true)
{
Wait(100);
smooth_axis_up();
Wait(100);
smooth_axis_dn();
}
}
sub smooth_axis_up()
{
OnFwd(OUT_A);
while(SENSOR_1 = 0);
{
Off(OUT_A);
Wait(2);
On(OUT_A);
Wait(1);
}
while(SENSOR_1 = 1);
{
Off(OUT_A);
Wait(1);
On(OUT_A);
Wait(1);
}
until(SENSOR_1 = 1);
while(SENSOR_1 = 1);
{
Off(OUT_A);
Wait(2);
On(OUT_A);
Wait(1);
}
Off(OUT_A);
}
sub smooth_axis_dn()
{
OnRev(OUT_A);
while(SENSOR_1 = 0);
{
Off(OUT_A);
Wait(2);
On(OUT_A);
Wait(1);
}
while(SENSOR_1 = 1);
{
Off(OUT_A);
Wait(1);
On(OUT_A);
Wait(1);
}
until(SENSOR_1 = 1);
while(SENSOR_1 = 1);
{
Off(OUT_A);
Wait(2);
On(OUT_A);
Wait(1);
}
Off(OUT_A);
}
This should merrily bounce the axis up and down (^:
Iain
--
tokama http://www.oxford.net/~hendryjr
ICQ UIN 5362826
AIM Linjerflyg
h e n d r y j r AT o x f o r d DOT n e t
(Remove bibiphoque to reply)
|
|
Message is in Reply To:
 | | Re: Speed control of motors
|
| You should turn on and off the motor output and vary the ratio between on and off. I'm not sure if it will works though. Philippe Skye Sweeney a écrit : (...) (25 years ago, 30-Mar-00, to lugnet.robotics)
|
4 Messages in This Thread:     
  
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|