He's got sensors, think gyroscope, to help him keep his bearings. Know which way is up and which is down. And inside he's got a counterweight so his center of gravity stays low, and he's got wheel bearings inside. All the traction comes from inside and that pushes him around. The head is mostly magnetic. It all gives him a lot of freedom in movement, more than the R2 and R4 units.