Use this guide to configure your Marty V2's infrared (IR) foot sensor and use its ground and obstacle readings in Blocks.
The IR foot sensor detects nearby objects in front of the foot and a surface underneath it. You can use these readings to make your program react to Marty's surroundings.
This is reflected-light sensing, not a physical contact switch or a precise distance measurement. The surface and lighting can affect the result, so check the readings on the surface where you will use Marty.
Use the current Robotical app to check the sensor's name and connection:
The screenshot shows RightIRFoot expanded. The grey LeftColorSensor (Not Connected) row is a saved configuration for a sensor that is not currently detected; it does not mean that RightIRFoot is disconnected.
Restore Add-on Names is optional. It restores the standard names RightIRFoot and LeftColorSensor, and removes disconnected saved entries. If you use custom names or multiple sensors of the same type, name them individually with Update Name instead.
If the sensor is missing or marked Not Connected, check its cable and reconnect Marty before continuing. If you have removed the sensor, follow this video to fit it again. Turn Marty off before changing sensor wiring.
With a connected sensor selected, Foot sensor on the ground reports true when a surface is detected beneath that sensor and false when it is not. Foot Obstacle Sensed is the separate block for detecting an object in front of the sensor.
The sensor dropdown can include both IR foot sensors and colour sensors because both support these readings. Choose the sensor whose reading you intend to use. A missing sensor or unavailable reading can also produce false, so check the connection before treating false as an edge.
Build this stack, then select your IR sensor in the dropdown:
The screenshot uses coloursensor_0F. To try this example with the infrared sensor, change that dropdown to your IRFoot sensor's name, such as RightIRFoot.
The stack does the following:
Click the stack to run it. It checks the sensor at the start of each repetition; it does not continuously recheck the ground during a walking command. The stack shown has no green-flag start block, so clicking the green flag alone will not start it.
Try the sensing block on a safe, flat surface before running the walking example. Test changes in the reading by supporting Marty and raising the sensor clear of the surface. Keep the walking example on the floor with room to move; it is not a guarantee that Marty will stop before a table edge.