Hi @Rae_Johnson, there are a few things that could be interfering with the Distance Sensor’s reporting. As you suspected, interference from human players or objects in the environment could definitely be playing a role.
One thing to note about the IQ (1st gen) Distance Sensor is that it operates using sound waves. The sensor calculates distance by using the time it takes for ultrasonic waves to bounce off of an object and return to the sensor. This means that the sensor could be reporting the distance to ANY object - not just a Cube - within it’s ‘field of view’, so to speak. So depending on what is around the Field, it could be picking up something else in the area (like a student or an object further away).
There’s actually a really cool activity you can do to help students better understand the where/how the Distance Sensor can detect objects! Using the Brain and the Distance Sensor, a large piece of paper, a marker, and an object you can actually test and draw out the sensor’s ‘field of view’. Like this:
This is the project I used for this little ‘experiment’:
To set it up make sure the Distance Sensor is on the edge of a large piece of poster paper, facing forward and not getting any interference around it. So when the project is started, it should report ‘No Object Detected’ to start. Then move a Cube in front of the sensor, and you’ll see the reading pop up on the Brain. Slowly move the Cube to the left/right of the sensor, and watch the reading on the Brain. When it reports ‘No Object Detected’ - mark where the Cube is. Keep repeating this process, moving the Cube further away from the sensor, and moving it left and right to get a series of marks where the ‘bounds’ of the sensor’s readings are. Then you can essentially connect the dots and get an approximation of the sensor’s range. Here’s a little wee video to show you what I mean (you’ll see the marks I made before I drew the lines on the paper. Then I video’d it to get a sample to share.)
The really neat thing about this, is that you can then cut out the paper, and give students an actual tangible representation of what the sensor can detect. And they can see how that ‘cone’ shape moves with the robot as it moves. Doing something like this can help students to get a better understanding of how the sensor works and what it reports, so they can mitigate interference a little better, and use the sensor more effectively. For instance, a Cube might start out ‘detected’, and the Cube will stay in the same place, but as the robot moves, it may become ‘undetected’ based on it’s position in relation to the Distance Sensor.
The other thing you’ll notice when you do this, is how quickly the sensor readings change - this can help students to better understand why using a range of values in their projects (like distance < 50 or distance > 30) can work better than using something like distance = 20. It’s very hard to land exactly on a particular value, and only the exact value will report as ‘TRUE’. Using a range of values can be much more reliable. Because then if the Distance Sensor reports 20.5 or 21, or 20.15 it’s still greater than 20, so will report ‘TRUE’, and still be effective.
I hope this is helpful! I’d be happy to walk through this experiment in a 1-on-1 Session with you too