Further reading
If you use LEGO BOOST's Android mobile app or iPad app, you can use this color sensor as a distance sensor. This will make these activities a lot simpler, as it can detect obstacles at a distance and take actions based on the programming logic that you have set. You can download this app at the following URL:
https://www.lego.com/en-us/kids/games/boost/lego-boost-03c8a71ab07a428fba9fa3b460b387b2
To learn more about this app, visit the following URL: https://www.lego.com/en-us/service/help/products/electronics-robotics/boost/guide-to-lego-boost-programming-blocks-408100000009897.
You can use the same pillars as obstacles and program your robot to stop when an obstacle is detected, then take an action.