Subject:
|
Re: Problems by using VC as a smart sensor
|
Newsgroups:
|
lugnet.robotics.vc
|
Date:
|
Sat, 24 Feb 2001 14:36:07 GMT
|
Viewed:
|
4987 times
|
| |
| |
Hi Maze,
In lugnet.robotics.vc, Mathias Hohm writes:
> Hello everybody,
> I want that my robot goes ahead, ONLY as long as the first region is active.
> and goes left ONLY when the second is active, goes right ONLY when 3th is
> active and goes back ONLY as long as the 4th is active.
> But it dosent functure. I´ve modyfid the spin left macro as discribed
> and wrote programms for the slots . But the motors didn´t stop, after the
> region was inactive.
The software only sends a message if a region gets active and not if a
region gets inactive !
Try something like this:
switch (message) {
case 1 :
OnFwd(Motor_Left);
OnFwd(Motor_Right);
Wait(10); // let the motors turn a while
break;
case 2 :
OnFwd(Motor_Left);
Off(Motor_Right);
Wait(10); // let the motors turn a while
break;
case 3 :
Off(Motor_Left);
OnFwd(Motor_Right);
Wait(10); // let the motors turn a while
break;
default :
Off(Motor_Left);
Off(Motor_Right);
break;
}
that won't bring a smooth driving, but should work.
For that you need to change my litlle task :
task Read_VC_Messages ()
{
ClearMessage();
while (true)
{
global_message = Message();
Wait(10); // don't know if necessary ?!?
ClearMessage();
}
}
This has (different to the task I previous posted) global_message = 0 if no
message was received. That means NONE of the regions is active.
> I´ve tried the programms posted by Rainer, but it was
> the same. I think the problems are the massages sent by VC to the RCX. But
> I´m not sure.
> Is there anybody who can help?
> Please post me the right programming.
> Maze
If you've still got problems, please send me your source, and I'll have a
look at it.
Hope that helps,
Rainer
|
|
Message is in Reply To:
| | Problems by using VC as a smart sensor
|
| Hello everybody, I want that my robot goes ahead, ONLY as long as the first region is active. and goes left ONLY when the second is active, goes right ONLY when 3th is active and goes back ONLY as long as the 4th is active. But it dosent functure. (...) (24 years ago, 24-Feb-01, to lugnet.robotics.vc)
|
2 Messages in This Thread:
- Entire Thread on One Page:
- Nested:
All | Brief | Compact | Dots
Linear:
All | Brief | Compact
|
|
|
|