Git Product home page Git Product logo

Comments (2)

ilpincy avatar ilpincy commented on July 18, 2024

I see your point.

The solution currently in place is, in fact, not a hack. It's meant to prevent media from adding entities that are not enabled (e.g., if you have an LED medium, but some robots do not use LEDs while others do). When you have simulations with hundreds of robots, this kind of feature proves critical for performance and memory efficiency.

Thus, the idea is that the act of adding an actuator or sensor makes it worth adding the entity to the medium. Unfortunately, this can't be checked at entity creation, so it's the actuator's job to do this.

If we follow your proposition, we could still have entities added to media conditionally. However, the critical issue becomes memory efficiency - for every single entity, we need to store the id of every potential medium an entity might be added to. When we want to simulate hundreds of robots, this is a huge waste of memory.

Also, from a design point of view it makes sense for an actuator/sensor to manage the medium. ARGoS allows for multiple versions of actuators and sensors, and media are meant to help simulate those. Improved actuators/sensors with different types of media (or no medium at all) would not be as easy to achieve, or as usable.

from argos3.

allsey87 avatar allsey87 commented on July 18, 2024

From my understanding of the new logic for enabling/disabling that you added in December (fffd3e5), it seems like we could just do the following in the init code for the LED actuator:

if(! m_pcLEDEquippedEntity->IsEnabled()) {
   m_pcLEDEquippedEntity->Enable();
}

And this would trigger adding the contained LED entities to the medium (if they were not already added, e.g., in the case of the box entity) and I don't think there would be any difference in performance. The bit I don't like is how the medium is configured in the actuators, enabling seems ok to me. To make this clean and consistent, however, I think there should be a flag in the actuators such as m_bEntityEnabledBeforeInit or something to that extent which we use when destroying the actuator (i.e. if this flag is true then don't disable the entity when destroying the actuator).

Just food for thought, but I think things like this are important if we want to avoid headaches in the future.

from argos3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.