systemetric / shepherd-2

A rewrite of shepherd
Apache License 2.0
4 stars 0 forks source link

Simplify `start_settings` #26

Closed shardros closed 2 years ago

shardros commented 2 years ago

Currently we pass in

             {   "mode": "comp",
                "zone": int(config.zone),
                "arena": "A",
            }

To the robot lib do we need all of this?

fenjalien commented 2 years ago

Its information that the usercode needs at the start of a round that may change for each run right? The type of data would then be based on the game so it may be best to have it as a general dictionary that can be changed year on year.

If I remember correctly from previous years mode: comp|dev Changes which visual marker numbers it checks for as we were concerned about someone walking past the arena with markers and distracting the robot. Is this still a concern? If so then it should be kept but otherwise why else should the robot behave differently? zone: 0..=3 Which zone the robot starts in. Yeah pretty essential unless the rules state you can start anywhere in the arena which would be unlikely arena: A|B I think because we had a practice arena as well as an official one? Pretty sure this wasn't used in the end anyway.

shardros commented 2 years ago

Some of these fields are now depricated.

mode: comp|dev Changes which visual marker numbers it checks for as we were concerned about someone walking past the arena with markers and distracting the robot. Is this still a concern? If so then it should be kept but otherwise why else should the robot behave differently?

We've accepted that people may walk past with other markers and its okay. We only ever use the Comp markers so we might as well not bother selecting between dev and comp.

zone: 0..=3 Which zone the robot starts in. Yeah pretty essential unless the rules state you can start anywhere in the arena which would be unlikely

Agree

arena: A|B I think because we had a practice arena as well as an official one? Pretty sure this wasn't used in the end anyway.

You are correct this is never used and there is no way to select it from shepherd-1 we always pass in A. This is dead code which can be removed.

shardros commented 2 years ago
    def _get_start_info(self):
        """Get the start infomation from the fifo which was passed as an arg"""
        f = open(self.startfifo, "r")
        d = f.read()
        f.close()

        self._start_pressed = True

        settings = json.loads(d)

        assert "zone" in settings, "zone must be in startup info"
        if settings["zone"] not in range(4):
            raise ValueError(
                "zone must be in range 0-3 inclusive -- value of %i is invalid"
                % settings["zone"])

        self._start_pressed = True

        return settings

Removed everything else