Stirling Robot software
24th December, 2018
Updated 19th September, 2019
In the previous article we looked at the electronics for our robot, Stirling.
In this article we'll cover the software we are writing to control Stirling and, more importantly, to teach Stirling how to control itself.
We'll update the article regularly as we release each module.
We have written a suite of programs for testing initial movement functions. These programs should drive any dual-motor, differential-steer Raspi-operated vehicles.
You can download the RobotMoves suite of modules here. This was updated on the 6th of February, 2019.
Inside the robot_moves folder you'll find robot_moves.py, the movement module for all of Stirling's other programs to control.
It can move a robot in any direction, and features functions for callibrating motor speeds and distances.
You can drive set distances, or start the motors in the background and use the brake() function to stop when required.
You can read the robot_moves tutorial here
Another module in the robot_moves folder is robot_sensors.
At the moment it handles distance sensors and PIR movement sensors, with more sensor-types on the way.
You import this into your program and check any or all of your sensors with single-line commands
You can read the robot_sensors tutorial here
Avoidance is a script that uses the RobotMoves and RobotSensors modules to drive around the house autonomously.
It drives easily in basic rooms, and in more complex areas it can usually go a few minutes without crashing into something or getting stuck. Fortunately, it's improving rapidly.
Avoidance is included in the robot_moves folder. You can read the Avoidance tutorial here
CamBot is a web-interface for RobotMoves that allows you to control a robot remotely, navigating using the live video feed from an Android phone camera mounted on top.
It is ideal for use as an inspection or security robot, or for remotely freaking out your pets.
Cambot is included in the robot_moves folder now. You can read the Cambot tutorial here
RobotWifi (coming soon)
The RobotWifi module monitors and compares signal-strength of surrounding Wi-fi networks.
Your programs can use this data to triangulate the robot's position to aid location awareness. You can designate certain routers you wish to include, or you can use all surrounding routers.
For instance, as well as my own routers and wifi access points, there are about nine other wi-fi networks visible from my home, and some of them are only visible from certain rooms.
My robot can use my routers to triangulate which room it is in, then confirm by checking the other networks that should be visible from that room.
With the right antenna configuration your robot can also use this as a compass by narrowing in on a specific router.
I'm hoping to have this ready in a few days.
CamBot Trainer (coming soon)
CamBot Trainer uses the CamBot GUI but adds powerful tools to test and train your robot.
You can adjust speed, steering and other default RobotMoves settings, and you can also map your home.
From your desk you can drive your robot around your home, marking rooms and room zones as you go. The robot will use its sensors and the new RobotWifi program to scan the room, and collect data for future location awareness.
Robot Map Trainer will be available in a couple of weeks.
Phone Wheel (coming soon)
Phone Wheel is our phone GUI that turns your phone into a steering wheel and throttle.
It's comically erratic at the moment. The accelerometers and gyroscopes in smart phones are a bit fickle, and we need to build methods to detect and ignore irrational readings.
Stirling occasionally takes off on its own wacky paths almost like it did with it's old brain.
This is an issue at the moment because we've included no over-current protections for the motors, meaning getting stuck against a wall or other solid object could quickly fry things.
Phone wheel will be a few weeks away yet.
That's all for today, check back soon.
Previous: Stirling robot electronics