/universal-robot

The Universal Robot project provides a hardware abstraction interface for robots, enabling a single robot control program to work with a wide range of robot hardware.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Universal Robot

The Universal Robot project provides a hardware abstraction interface for robots, enabling a single robot control program to work with a wide range of robot hardware.

This project came out of the robot control programs I was running on a variety of small robots I take to public outreach events to encourage young people's interest in science, technology, electronics and coding. As I made enhancements to the program running on one robot, I wished I had ported the same features to all the other robots. But I never seemed to have time to do that. I realised if I could run the same program on all the robots, then all I had to do was pull the latest revision from git and all the robots could benefit from all the new features. It just needed a common interface to all the different hardware on the each of the robots. Hence the Universal Robot Interface was born.

The Univeral Robot control program imports a robot hardware class which implements the robot interface. Each robot has different hardware, and so has a different robot hardware class to talk to it's hardware control libraries. But these classes all use an identical interface. So the main program does not need to know the specifics of the hardware on the robot it is running on, it just tells the hardware class that it wants the left motor to run at 50% power, or that it wants to turn the LEDs green. The robot hardware class takes the request and does the specifics to make it happen on that robot's hardware. So to make this work on a robot, you need the Universal Robot program, and a hardware class which implements the interface. This hardware class does not need to talk to all the possible hardware the interface supports. If you don't have encoders on your robot, then don't implement the encoder functions. The interface will take the calls from the Universal robot program and just return 0 as the encoder readings. The Universal Robot program needs to be clever enough to work out that encoder readings of zero means there are no encoders to read.

To demonstrate the Universal Robot program in action without you needing an actual robot, the default robot hardware class in this got repo implements a virtual robot, which simulates a robot visually on screen (when I get that part written and checked in!).