To LUGNET HomepageTo LUGNET News HomepageTo LUGNET Guide Homepage
 Help on Searching
 
Post new message to lugnet.robotics.rcx.javaOpen lugnet.robotics.rcx.java in your NNTP NewsreaderTo LUGNET News Traffic PageSign In (Members)
 Robotics / RCX / Java / 320
319  |  321
Subject: 
RotationNavigator again, does it have a bug?
Newsgroups: 
lugnet.robotics.rcx.java
Date: 
Thu, 5 Feb 2004 16:27:10 GMT
Viewed: 
5224 times
  
I have another problem with the RotationNavigator class.
I try to program a navigating, behavior controlled robot.

At the moment it has two behaviors:
   behavior1 (b1): moving to a specific point with gotoPoint(...) and
back to  the starting point with gotoPoint(0,0)
   behavior2 (b2): obstacle avoidance with moving backwards with
travel(-....), turning with rotate() etc.

Both behaviors operate with the same navigator object, of course.
With suppress() of b1 I stop() the navigator to interrupt gotoPoint()
and b2 becomes active.
When b2 is ready, b1 becomes active again and starts gotoPoint() again.

But b1 now operates with wrong XY coordinates. I displayed the
coordinates with getX()  getY() and it seems, that these values are
twice as in reality.  For instance, the robot moved with
gotoPoint(200,0) 50 cm, then it is interrupted with stop() from the
suppress() method and the calculated XY coordinates are x=100, y=0! Next
time, the robot tries to reach (200,0), it starts with these wrong
values. It always doubles the values after a  while.

public void suppress(){
   navigator.stop();
   LCD.showNumber((int)getX());        ->25  (accurate)
   try{Thread.sleep(500);}catch ...;
   LCD.showNumber((int)getX());        ->50  (wrong!)
}

The robot is not moving beetween the readings of X.
This is only for demonstration, but if I remove showNumber() etc., both
behaviors operate with the wrong values, too.
So it is impossible to program a navigating robot, which avoids obstacles.

Do you have an idea, what the reason for this bug is and how to fix it?
Perhaps it is an error in my code, but I couldn't find one.

Regards
Michael



1 Message 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