In The Force Awakens, we see BB-8 stop on each step as he descends a staircase following Rey as she goes to
Luke Skywalker's light sabre in the basement of Maz Kanata's tavern.
BB-8 literally stops as he lands on each step before starting again to move down to the step below it.
We also see him race and then stop on flat surfaces.
What documentation exists in the Star Wars literature or scripts or interviews of writer's, etc to explain how BB-8 stops himself when he is moving? I imagine that his hardware includes a gyroscope and an accelerometer to measure his movement. But how does he stop himself from falling down the stairs when his instruments tell him he is descending? Or stop himself from rolling onward after he reaches a destination?