#!/usr/bin/env python

from flexbe_core import EventState, Logger
import rospy
import re
import ros
import math

class processFollowDistance(EventState):
    """
    Calcule la distance  entre deux points donnes.

    ###Params
    --minimum_distance
    --divisor_distance
    --threshold

    ### InputKey
    >#distance_of_target

    ### OutputKey
    #> distance

    ###Outcomes
    <= move
    <= done
    """
    def __init__(self, minimum_distance, divisor_distance,threshold):
        """Constructor"""

        super(GetNumberFromText, self).__init__(outcomes = ['move','done'], input_keys = ['distance_of_target'], output_keys = ['distance'])
        self.minimum_distance=minimum_distance
        self.divisor_distance=divisor_distance
        self.threshold=threshold

    def execute(self, userdata):
        """Determine action to perform and return outcome accordingly"""

        retour = self.minimum_distance
        dis =userdata.distance
        if(dis<self.threshold+self.minimum_distance and dis>minimum_distance):
            return 'done'
        mi_distance = dis/self.divisor_distance
        if(mi_distance>self.minimum_distance):retour =mi_distance
        userdata.distance = retour
        return 'move'

Add processFollowDistance State