Closed jharwell closed 5 years ago
This is a bit of a hack. I understand what kind of feature you're after, but I'm not very happy about having this done on this sensor only. I think this needs to be something available for all sensors. Right now I have this done on a per-sensor basis, so the "hack" I don't like is already there. I think I will accept this pull request for now, and work on a more general Enable()
/Disable()
mechanism that works for every sensor.
This will have repercussions on how real robots work, though. It is often not possible to Disable()
sensors at will. I guess the standard approach will be to ignore these calls on the real robot when it's not possible?
That seems like a reasonable thing to do for real robots if its not possible to actually disable the sensor/actuator.
After doing some profiling, I've found that having robots have their light sensor updated every timestep was accounting for about 25% of simulation time, when they were only using it to return to the nest occasionally in my use case. So, by making it toggle-able, it can be turned on when needed, and the computation not be wasted when it is not going to be used that timestep by the robot.