Skip to content

EV3-G API: Infared sensor #363

Closed
Closed

Description

@dwalton76

Need to get screenshots of the infared sensor blocks

Activity

  1. dlech commented on Sep 20, 2017

    @dlech
    Member

    image

  2. self-assigned this
    on Sep 23, 2017
  3. dwalton76 commented on Sep 23, 2017

    @dwalton76
    CollaboratorAuthor
        def reflected_light_intensity(self):
            """
            Reflected light intensity as a percentage. Light on sensor is red.
            """
    
            if self.auto_mode:
                self.mode = self.MODE_COL_REFLECT
    
            return self.value(0)
    

    Is there a scenario where auto_mode would be False? Doesn't seem like anything would work if it were unless the user also did self.mode = self.MODE_COL_REFLECT so you have the same behavior in the end. I'm scratching my head a bit on why we have this.

  4. dwalton76 commented on Sep 23, 2017

    @dwalton76
    CollaboratorAuthor

    TouchSensor class also has the mysterious self.auto_mode

  5. ddemidov commented on Sep 23, 2017

    @ddemidov
    Member

    Every sensor has auto_mode field. When it is on, the appropriate mode will be selected before reading a value (e.g. when we read RGB from color sensor, it's mode will be set to 'RAW'). When it is off, user have to make sure sensor is in correct mode. This makes sense when user needs as much performance as possible.

  6. dwalton76 commented on Sep 23, 2017

    @dwalton76
    CollaboratorAuthor

    The mode has to be set correctly anyway though...I'm missing how it increases performance by having the user set the mode vs us setting it for them? We could just cache what the current mode is and only update that attribute when it needs to be in a different mode....then we could chop the auto_mode variable.

  7. ddemidov commented on Sep 23, 2017

    @ddemidov
    Member

    User can set the mode once and read the value many times. Caching current mode could work as long as we assume no one will change the mode from under our feet (e.g. another thread or process).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions