Anth's Computer Cave

Stirling Robot software

24th December, 2018

Updated 6th February, 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.

A Stirling robotic vacuum cleaner with added sensors and a new head. Picture: Anthony Hartup.
Stirling in its current form with its new head

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.

RobotMoves

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


RobotSensors

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

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 now. You can read the Avoidance tutorial here


CamBot (coming soon)

CamBot is a web-interface that allows you to control a robot remotely, navigating using the live video feed from an Android phone camera mounted on top.

This is in the robot_moves folder now, but there is some setup required. The tutorial is on the way.


Robot Map Trainer (coming soon)

Robot Map Trainer is another command-line program that will train Stirling to navigate the Cave. Its a sort of 'learn by doing' program.

First you assign a home-room where the robot will normally live. Then you enter the name of an adjoining room you wish to drive to, then follow the prompts to maually drive the robot there.

The program will log each move, along with the surrounding measurements at each stop. It will also calculate a return path to its original location.

Each room has a map entry for each adjacent room, and there is an overall list that tells the robot which rooms it needs to traverse to reach non-adjacent rooms.

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.

Cheers

Anth


Previous: Stirling robot electronics

Next: RobotMoves movement module

_____________________________________________


Comments

Leave a comment on this article