Close

Processing Library POC

A project log for Stubby the (Teaching) Hexapod

100% open source robot platform with accessability and affordability in mind: teaching children of all ages about robots & programming

the-big-oneThe Big One 08/28/2014 at 15:530 Comments

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:


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