This is my first attempt to create a robot with my Raspberry Pi and some other parts. I used the guidance from computers.tutsplus.com/tutorials/controlling-dc-motors-using-python-with-a-raspberry-pi--cms-20051 to get the motors working this morning for the first time. It's all held together with some scotch tape. A temporary arrangement - until I build something better.
There is a robot platform with two DC motors, a raspberry pi, a breadboard with a L293D chip and two battery packs, one for the Pi, one for the motor.
The Pi had a wireless dongle so I can SSH to access the Bash shell on it.
The Pi is running Apache server and the Web2py (web development framework). I created an application using Web2py which is a one-page site with the control panel on it.
The code to drive the robot needs to be run using a root/privileged account. So...
I created a bit of Python on the Pi to listen on port 8081 for 'UDP socket datagram messages. I pinched the code from the Python Cookbook, page 488 to do this. This program is run in a terminal on the Pi. It requires root privileges to drive the robot. It takes messages of the form 'command duration'. Commands are forward, backward, left, right. Durations in seconds.
The web app which runs on the Pi presents a table with text links. Behind each of these is an ajax call to a service called moves (something like mypi/robot/moves/forward/.5 that reads the parameters of the message and sends the UDB message to localhost port 8081.
In principle you could create a simple client (which I did for testing) that sends these UDP messages directly (and from any machine on the same wireless network).
The DC motors clearly don't have the same power as the robot moves in a curved path. Stepper motors/servos would obviously work better...
robots robots robots, and more specifically robot videos.
this is a collection of robot videos selected for viewing by all the family...