You can use your webcam to control your T-Bot using Python, OpenCV and PyGame. You can find the code here. Let me know if you would like a video tutorial for this.
Category: Uncategorized
T-Bot Simulator with Tuning Slide Bars

As usual, you can find the code in the Simulators folder. You will also need TBotTools.
Interactive Pendulum Simulator
The pendulum simulator has been created to accompany a coming series of video tutorials entitled ‘How to Balance a Robot’. The series will cover the following:
- Modelling and Simulating a pendulum using PyGame
- Modelling and simulating a self balancing robot using Pygame
- Build your own PID controller for dynamically stabilising an inverted pendulum
- Dynamically stabilising a real system, namely the T-Bot
You can find the code for the pendulum here.

Simulator
Here is a version of the simulator for those of you who don’t have a joystick. The more experienced of you might already have noticed from the plot that the derivative gain is too high. You can find the code here.

T-Bot Simulator
The T-Bot simulator allows you to stabilise the T-Bot manually or use a cascading PID controller. The program allows you to develop an intuitive understanding of the stabilisation process and tuning of a balancing robot.

Macro Plotter
The macro plotter allows you to display a plot built from the recorded macro commands. This is very useful for exploring open loop control. You can run the T-Bot over a known route and compare the plot to the actual path taken. The rotation rate and speed factor on the slider bars are used to compensate for the real turning rate and speed of the T-Bot. The control values received by the robot are integers ranging from 100 to 300 with 300 corresponding to a maximum speed in one direction and 100 corresponding to a maximum speed in the opposite direction. The speeds are going to be effected by several factors such as trim, surface, slope, tuning, calibration etc.
Macro Recording
Macro recording has been added to the joystick bridge controller. This provides an excellent demonstration of open loop control. You can find it here.

Keyboard and Mouse Controller – Update
Macro recording has now been added.

Keyboard and Mouse Controller
Here is a keyboard and mouse controller for those of you who don’t have a physical joystick. This is simpler than the one found here and is easier to customize. You can find it in our GitHub Repository. Note this version does not have macro recording.

Auto-routing using Python and OpenCV

A convolution function is used to identify each of the tile types. A difference function is used to determine the grid shape. The zebra tile is taken as the starting position then some logic is used to step through neighbouring tiles. The code can be found here.