I have finalized on the (initial) framework which we will be using for PC control of Stubby. I have decided to go with Processing. This framework was chosen over other options (most notably Python, which was my first thought) for a few reasons:
- Simplicity for very young children. There is a 'Play' button to run the programs, it is pretty easy to set up, and there is no need to drop to the command line, which can be intimidating to some.
- You have easy access to graphics functions. I am toying with the idea of supporting a simulated Stubby for experimenting when hardware is not available (i.e. a classroom which shares a small number of robots).
- By becoming familiar with this IDE, it is an easy step to move to Arduino (which of course has good and bad points associated with it... see my rant on Arduino if you are interested in some random guy on the Internet's opinion).
Now that the framework has been chosen, I was free to start on the implementation. By following the library basics on the Processing website, I made a simple library project in Eclipse, with stubs for the various commands which are to be supported. As of last night, this compiles and can be successfully added into your local Processing environment. You create the Stubby control object with the code (from the Processing main() method), and can control the robot by calling methods on that object:
Stubby stubby = new Stubby(this); stubby.move(150, Math.PI/4); //Move 150mm at 45 degrees to the right stubby.moveForward(100); //Move 100mm straight forward int distance = stubby.readDistanceSensor(); //Read the distance sensor if (distance < 200){ stubby.rotate(Math.PI/2); //Turn around 180 degrees }
(None of the commands actually work yet... I just have the API partially laid out).
The next step from here is to design the communications protocol between the computer and the robot. This will be similar to the protocol used in Chiindii (my failed Quadcopter experiment). I hope to have the protocol designed with a basic implementation for C++ (Stubby) and Java (Processing) within a week.
Discussions
Become a Hackaday.io Member
Create an account to leave a comment. Already have an account? Log In.