As second lab assignment we were asked to use OpenFrameworks to work around the concept of space. The Space Explorer is a small robot moved with four servos and equipped with a distance sensor. The robot explores the space in two directions, first it is moving and collecting information from the analogue space where it is located. Second it is an exploration of the digital, virtual space where it also exists as an animated 3d model thanks to OpenFrameworks environment, which, through serial communication, receives information of the position of the robot and the distance sensor.
The robot receives movement command from a remote control puppet, mediated by the virtual space in OpenFrameworks environment, to which the control puppet is also connected.
Robot construction
Control puppet construction
Hacking servo to get potmeter signal
Attaching servos to the wooden structure
Articulation
Woden structure and potmeters
Assembling robot
Potmeters into the structure
Putting all together
Wiring
Code
This is the function to create the robot 3d model in openFrameworks, the complete code can be downloaded at the end of the page:
void ofApp::drawRobot(float rot1, float rot2, float rot3, float rotH, float distS){
ofSetColor(180);
ofFill();
ofSetLineWidth(0.7);
//segment A
ofPushMatrix();
ofTranslate(0,10,0);
ofDrawAxis(1);
ofNoFill();
ofDrawBox(2.75, -1, 0, 4.5, 2, 5.5);
ofDrawBox(5.5, -5, 0, 1, 10, 5.5);
ofDrawBox(2.75, -9.5, 0, 4.5, 1, 5.5);
ofVec3f vbA1;
vbA1.set(0, 0, 0);
ofVec3f vbA2;
vbA2.set(0, 27.5, 0);
vbA2 = vbA2.getRotated(rot1, ofVec3f(1, 0, 0));
ofDrawArrow(vbA1,vbA2,0);
//segment B
ofPushMatrix();
ofTranslate(vbA2);
ofRotate(rot1,1,0,0);
ofDrawAxis(1);
ofNoFill();
ofDrawBox(0, -13.75, 0, 1, 32, 2.7);
ofDrawBox(2.75, -1, 0, 4.5, 5.5, 2);
ofVec3f vbB1;
ofVec3f vbB2;
vbB2.set(0, 27.5, 0);
vbB2 = vbB2.getRotated(rot2, ofVec3f(1, 0, 0));
//ofDrawArrow(vbB1,vbB2,0);
//segment C
ofPushMatrix();
ofTranslate(vbB2);
ofRotate(rot2,1,0,0);
ofDrawAxis(1);
ofNoFill();
ofDrawBox(5.5, -13.75, 0, 1, 32, 2.7);
ofDrawBox(2.75, -1, 0, 4.5, 5.5, 2);
ofVec3f vbC1;
ofVec3f vbC2;
vbC2.set(0, 0.7, 0);
vbC2 = vbC2.getRotated(rot3, ofVec3f(1, 0, 0));
ofDrawArrow(vbC1,vbC2,0);
//segment D
ofPushMatrix();
ofTranslate(vbC2);
ofRotate(rot3,1,0,0);
ofDrawAxis(1);
ofNoFill();
ofDrawBox(0, -0.7, 0, 1, 4, 2.7);
ofVec3f vbD1;
ofVec3f vbD2;
vbD2.set(0, 0, 5);
//vbC2 = vbC2.getRotated(rot3, ofVec3f(1, 0, 0));
ofDrawArrow(vbD1,vbD2,0);
//segment E
ofPushMatrix();
ofTranslate(vbD2);
ofRotate(90,1,0,0);
ofDrawAxis(1);
ofNoFill();
ofDrawBox(0, -1.825, 0, 1, 3.65, 2.5);
ofVec3f vbE1;
ofVec3f vbE2;
vbE2.set(0, 0, -2);
vbE2 = vbE2.getRotated(rotH, ofVec3f(0, 1, 0 ));
ofDrawArrow(vbE1,vbE2,0);
//head sensor
ofPushMatrix();
ofTranslate(vbE2);
ofRotate(rotH,0,1,0);
ofDrawAxis(1);
ofNoFill();
ofDrawBox(0, 0, 1.375, 4, 1, 2.7);
ofVec3f vbF1;
ofVec3f vbF2;
vbF2.set(0, 0, - distS);
//vbF2 = vbF2.getRotated(rot5, ofVec3f(0, 0, 1 ));
ofSetColor(255,255,51);
ofNoFill();
ofSetLineWidth(0.7);
ofDrawArrow(vbF1,vbF2,0);
ofPopMatrix();
ofPopMatrix();
ofPopMatrix();
ofPopMatrix();
ofPopMatrix();
ofPopMatrix();
ofPopMatrix();
}