if(notself._firstPointSeen):#If you were previously moving straight without obstacles
ifnot(self._firstPointSeen)andxandy:#If you were previously moving straight without obstacles
self._firstPointSeen=(x,y)
self._firstPointSeen=(x,y)
velocity=Twist()
velocity=Twist()
...
@@ -123,6 +123,10 @@ class ReactiveMove(Node):
...
@@ -123,6 +123,10 @@ class ReactiveMove(Node):
velocity.linear.x=0.0#If the wall is too close, don't go forward, only rotate
velocity.linear.x=0.0#If the wall is too close, don't go forward, only rotate
else:
else:
coefficient=(x-self.paramDouble('MIN_DIST_MOVE_FORWARD'))/(self.paramDouble('MAX_DIST_MOVE_FORWARD')-self.paramDouble('MIN_DIST_MOVE_FORWARD'))#linear between 0 (MIN_DIST_MOVE_FORWARD) and 1 (MAX_DIST_MOVE_FORWARD)
coefficient=(x-self.paramDouble('MIN_DIST_MOVE_FORWARD'))/(self.paramDouble('MAX_DIST_MOVE_FORWARD')-self.paramDouble('MIN_DIST_MOVE_FORWARD'))#linear between 0 (MIN_DIST_MOVE_FORWARD) and 1 (MAX_DIST_MOVE_FORWARD)