For those who attended mine and my daughter Chloe’s presentation on mind-controlled robots, today, here are some details about the tech we used.
Magabot Arduino+laptop-based robot: http://magabot.cc/
Emotiv EPOC neuroheadset: http://emotiv.com/
Mind Your OSCs: http://sourceforge.net/projects/mindyouroscs/
oscP5 library for Processing: http://www.sojamo.de/libraries/oscP5/
Here is the Processing code I used to read the OSC data from the EPOC and send serial signals to the Arduino:
/**
* NeuroMagabot
* by Joshua Madara, hyperritual.com
*
* Transforms data from the Emotiv EPOC neuroheadset
* to control data for the Magabot, via OSC.
*/
import processing.serial.*;
import oscP5.*;
import netP5.*;
Serial port;
OscP5 oscP5;
float thresh = 0.25; // one threshold for all Cognitiv values
void setup() {
size(200, 200);
println(Serial.list());
port = new Serial(this, Serial.list()[0], 9600);
//start oscP5, listening for incoming messages at port 7400
//make sure this matches the port in Mind Your OSCs
oscP5 = new OscP5(this, 7400);
// plug the messages for the Cognitiv values
oscP5.plug(this,"sendW","/COG/PUSH");
oscP5.plug(this,"sendS","/COG/PULL");
oscP5.plug(this,"sendA","/COG/LEFT");
oscP5.plug(this,"sendD","/COG/RIGHT");
}
void draw() {
// here you could graph the EPOC data, draw an animated face on the laptop screen, etc.
}
public void sendW(float val) {
if (val >= thresh) {
port.write('w'); // send move-forward command to Arduino
} else {
port.write('p'); // send stop command
}
}
public void sendS(float val) {
if (val >= thresh) {
port.write('s'); // send move-reverse command to Arduino
} else {
port.write('p');
}
}
public void sendA(float val) {
if (val >= thresh) {
port.write('a'); // send turn-left command to Arduino
} else {
port.write('p');
}
}
public void sendD(float val) {
if (val >= thresh) {
port.write('d'); // send turn-right command to Arduino
} else {
port.write('p');
}
}
The Arduino code is the Magabot_SerialControl sketch for Magabot (protocol = ‘H’).
port.write(‘d’); // send turn-right command to Arduino
Mipregunta es que trata de decir la d entre comillas, nola veo que este declarada en instruciones anteriores ene le programa o a que me hace referencia. Gracias