Subject:
|
New CyberMaster Trick! =:-)
|
Newsgroups:
|
lugnet.robotics
|
Date:
|
Sat, 5 Dec 1998 22:25:13 GMT
|
Original-From:
|
Laurentino Martins <LAU@MAILspamless.TELEPAC.PT>
|
Viewed:
|
1260 times
|
| |
| |
This post is only addressed to CyberMaster users:
I've found out that we can use the Tachos in out favor for a lot of things!
For instants, you can deduce if the vehicle is climbing or going downwards and even if impacted in some object.
This is accomplished by watching the speed of the Tachos and comparing them with the speed you ordered the motor to be. If a motor starts running slower than it should be running, then you can take action.
These numbers where obtained with a vehicle using threads, with light/medium load, and in a carpet. They do not apply to all cases, but if you lower them a bit, they might.
Speed of motor - Speed of Tacho
1 - 11
2 - 28
3 - 37
4 - 43
5 - 48
6 - 50
7 - 52
This was the code in NQCC I used to find these values:
It starts both threads at full speed (7) and stops if something forces the vehicle to slow down.
Lower the number 52 (the Tacho speed) *if* the vehicle stops right after starting. Increase it if your vehicle is very light or it's not in a carpet.
int tl, tr;
task main
{
ClearTachoCounter( OUT_L+OUT_R ); // Dunno if it's necessary, but...
ClearTimer( 0 );
Drive( 7, 7 ); // Full spead ahead!
while(true)
{
// Read current speed
tl = TachoSpeed( OUT_L );
tr = TachoSpeed( OUT_R );
// The timer is only to give some time to the motors accelerate
if( Timer( 0 )>3 && ( tl<52 || tr<52 ) )
{
// Stop!
Drive( 0, 0 );
}
}
}
Also with some stuff from the new (future?) RCX.NQH.
// (c) Laurentino Martins ;-)
#define TachoSpeed(n) @(0x60000 + (n)-1)
#define ClearTachoCounter(m) asm { 0x11, m }
#define Drive(m0, m1) asm { 0x41, DIRSPEED(m0) | DIRSPEED(m1)<<4 }
#define DIRSPEED(v) ((v)&8^8|((v)*(((v)>>3)*2^1))&7)
---
I forgot to test with the motors running backwards to see if the values stand...
Laurentino Martins
[lau@mail.telepac.pt]
[http://www.terravista.pt/Enseada/2808/]
|
|
1 Message in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
Active threads in Robotics
|
|
|
|