def METHOD_NAME(value, threshold, rotation):
    """
    Move the robot on a straight line or rotates it around itself.
    value: distance in meters or angle in radian depending on the value of
    rotation.
    threshold: the robot will slow down when reaching this value.
    rotation: False to move the robot on a straight line for a certain.
    distance, or True to rotate the robot for a certain angle.
    """
    factor = (ROTATE_FACTOR if rotation else TRANSLATE_FACTOR)
    # recovers the current value of the sensors.
    rightStart = rightWheelSensor.getValue() * factor
    leftStart = leftWheelSensor.getValue() * factor
    # computes the value we want to reach for each wheel.
    rightGoal = rightStart + value
    leftGoal = leftStart + (-value if rotation else value)
    # computes in which direction the robot needs to go.
    if value > 0:
        sign = 1
        absValue = value
    elif value < 0:
        sign = -1
        absValue = -value
    else:
        return
    # loops until the robot has reached the destination.
    while (robot.step(timestep) != -1 and absValue > 0):
        # full speed if threshold hasn't been reached.
        if absValue > threshold:
            speed = MAX_SPEED
        # otherwise we follow a linear decay down to a minimum
        # (so the robot doesn't completely stop before reaching the goal).
        else:
            speed = MAX_SPEED * (absValue / threshold)
        if speed < MIN_SPEED:
            speed = MIN_SPEED
        # applies the velocity to the wheels.
        setMotors(sign * speed, rotation)
        # updates distance remaining using the wheel sensors.
        rightValue = sign * (rightGoal - rightWheelSensor.getValue() * factor)
        leftValue = sign * (leftGoal - leftWheelSensor.getValue() * factor)
        if rotation:
            leftValue = -leftValue
        absValue = (leftValue + rightValue) / 2
    # stops the robot when we are done.
    setMotors(0, False)