• Ephera@lemmy.ml
    link
    fedilink
    English
    arrow-up
    4
    ·
    15 hours ago

    Well, even at that level of abstraction, it’s a bit weird, because goingToCrashIntoEachOther and dont() both need the information from where a collision is going to take place, so you’d expect something to be passed into dont().

    Well, and it’s easy to dismiss this stuff as implementation details, but that if-statement needs to run as part of a loop. This loop should probably be on a separate thread, so it doesn’t get blocked by other stuff going on. Which means access to the motors needs to be behind some form of mutex, which it needs to be able to acquire fairly quickly. And then, yeah, those implementation details quickly add up to become the part that’s actually complex.

    • Korhaka@sopuli.xyz
      link
      fedilink
      English
      arrow-up
      1
      ·
      2 hours ago

      Couldn’t dont() just be an order to halt and goingToCrashIntoEachOther can be a simple true/false?

      So the drones both stop, then start moving and immediately see they will crash into each other so they halt again. Drone version of you go, no no you go

    • yetAnotherUser@discuss.tchncs.de
      link
      fedilink
      arrow-up
      1
      ·
      3 hours ago

      The functions just store all variables in a globally accessible JSON file. Compartmentalization is for programmers that aren’t capable of writing bug-free code.

      • filcuk@lemmy.zip
        link
        fedilink
        arrow-up
        2
        ·
        2 hours ago

        The only logical way to coordinate multiple drones like this is to store the json on a local nas and have them take turns updating their vectors within

        • yetAnotherUser@discuss.tchncs.de
          link
          fedilink
          arrow-up
          2
          ·
          edit-2
          2 hours ago

          I was thinking the drones would use Bluetooth to send the modified json to each other which negates the need for a NAS.

          Of course, two different drones may have modified the json nearly simultaneously so the json would need to be timestamped and the earlier timestamp overrules the later one in case of merge conflicts.