<commit_before>"""
FieldieSearchDecision
^^^^^^^^^^^^^^^^^^^^

This Module decides if the Fieldie Sould Search or Walk/Turn to Find the Ball

The Search is continued untel someone interrupts it by reevaluate or interrupt

History:
''''''''

* 06.12.14 Created (<NAME>)

"""
import time

from bitbots_body_behaviour.body.actions.plain_walk_action import PlainWalkAction
from bitbots_body_behaviour.body.actions.search import StopAndSearch

from bitbots_common.connector.capsules.walking_capsule import WalkingCapsule
from bitbots_common.connector.connector import BodyConnector
from bitbots_stackmachine.abstract_decision_module import AbstractDecisionModule


class FieldieSearchDecision(AbstractDecisionModule):
    def __init__(self, connector: BodyConnector, _):
        super(FieldieSearchDecision, self).__init__(connector, _)
        self.start_time = time.time()
        self.turn_wait_time = connector.config["Head"]["Search"]["turnWaitTime"]

    def perform(self, connector, reevaluate=False):
        # if we have loked to long in the same direktion without seeing we want to walk
        if time.time() - self.start_time > self.turn_wait_time:
            # reset the timer
            self.start_time = time.time()
            return self.push(PlainWalkAction,
                             [[3, 0, 0, 10]])
        else:
            # Just Search
            return self.push(StopAndSearch)

            # todo run to the middle point of the field after a long while<commit_msg>updated walkingspeed for new walking while searching the ball<commit_after>"""
FieldieSearchDecision
^^^^^^^^^^^^^^^^^^^^

This Module decides if the Fieldie Sould Search or Walk/Turn to Find the Ball

The Search is continued untel someone interrupts it by reevaluate or interrupt

History:
''''''''

* 06.12.14 Created (<NAME>)

"""
import time

from bitbots_body_behaviour.body.actions.plain_walk_action import PlainWalkAction
from bitbots_body_behaviour.body.actions.search import StopAndSearch

from bitbots_common.connector.capsules.walking_capsule import WalkingCapsule
from bitbots_common.connector.connector import BodyConnector
from bitbots_stackmachine.abstract_decision_module import AbstractDecisionModule


class FieldieSearchDecision(AbstractDecisionModule):
    def __init__(self, connector: BodyConnector, _):
        super(FieldieSearchDecision, self).__init__(connector, _)
        self.start_time = time.time()
        self.turn_wait_time = connector.config["Head"]["Search"]["turnWaitTime"]

    def perform(self, connector, reevaluate=False):
        # if we have loked to long in the same direktion without seeing we want to walk
        if time.time() - self.start_time > self.turn_wait_time:
            # reset the timer
            self.start_time = time.time()
            return self.push(PlainWalkAction,
                             [[120, 0, 0, 100]])
        else:
            # Just Search
            return self.push(StopAndSearch)

            # todo run to the middle point of the field after a long while
{'fraction_non_alphanumeric': 0.08704253214638971, 'fraction_numerical': 0.008242664029014177, 'mean_word_length': 3.548725637181409, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2282878', 'n_tokens_mistral': 866, 'n_tokens_neox': 833, 'n_words': 245}