ステッピングモーター動作
早稲田さん宅に行ってRAMPSとA4988でステッピングモーターを
動作させることができるようになりました
先週と同じやり方なのになぜ・・・
(考えられる原因はピンの初期化順序くらいなんですが関係あるのでせうかね
トルクも十分にあるので問題なさそうです
ただ、アームの固定方法は考え直さないとダメな可能性有
http://www.powers-rainbow.com/cgi-bin/tkxcgi/shop/goods_detail.cgi?CategoryID=000005&GoodsID=00000037
詳しくは今度書くとして、諸悪の根源は改行文字でしたとさ
メディア技術基礎(3Dプログラミング)最終課題
ある程度形になったのでとりあえず貼っておく
import SimpleOpenNI.*;
import ddf.minim.*;
SimpleOpenNI kinect;
HashMap<Integer, PVector>hands=new HashMap<Integer, PVector>();
PVector posLeft =new PVector(0, 0);
PVector posRight =new PVector(0, 640);
boolean flag=false;
Minim minim;
AudioPlayer hajime;
AudioPlayer ok1;
AudioPlayer ok2;
AudioPlayer count;
AudioPlayer bluescreen;
void setup () {
minim=new Minim(this);
ok1=minim.loadFile("ok1.wav");
ok2=minim.loadFile("ok2.wav");
hajime=minim.loadFile("hajime.wav");
hajime.play();
kinect=new SimpleOpenNI(this);
kinect.enableDepth();
kinect.setMirror(true);
kinect.enableRGB();
kinect.alternativeViewPointDepthToImage();
kinect.enableGesture();
kinect.addGesture("Wave");
kinect.addGesture("RaiseHand");
kinect.enableHands();
size(kinect.depthWidth(), kinect.depthHeight());
}
void draw() {
kinect.update();
//tint(128, 128, 128, 255);
image(kinect.rgbImage(), 0, 0);
drawHands();
strokeWeight(1);
line(posLeft.x, 0, posLeft.x, kinect.depthHeight());
line(posRight.x, 0, posRight.x, kinect.depthHeight());
}
void drawHands() {
for (Map.Entry entry:hands.entrySet()) {
int id=(Integer)entry.getKey();
PVector pos3d=(PVector)entry.getValue();
PVector posScreen =new PVector();
kinect.convertRealWorldToProjective(pos3d, posScreen);
}
}
void onRecognizeGesture(String strGesture, PVector idPosition, PVector endPosition) {
println("ジェスチャー名:"+strGesture);
kinect.startTrackingHands(endPosition);
if (strGesture.equals("Wave")==true) {
if(flag==false){
bluescreen=minim.loadFile("bluescreen.wav");
bluescreen.play();
flag=true;
}else{
count=minim.loadFile("count.wav");
count.play();
}
delay(3000);
PImage img1;
img1=createImage(int(posRight.x-posLeft.x-1),kinect.rgbHeight(),RGB);
img1=kinect.rgbImage().get(int(posLeft.x),0,int(posRight.x-posLeft.x-1),kinect.rgbHeight());
img1.save("img1.jpg");
save("img.jpg");
}
else if(strGesture.equals("RaiseHand")==true){
for (Map.Entry entry:hands.entrySet()) {
int id=(Integer)entry.getKey();
PVector pos3d=(PVector)entry.getValue();
PVector posScreen =new PVector();
kinect.convertRealWorldToProjective(pos3d, posScreen);
if (posScreen.x<kinect.depthWidth()/3) {
posLeft=posScreen;
println("Left:"+posLeft.x+","+posLeft.y);
ok1.play();
}
else if(posScreen.x>kinect.depthWidth()/3*2) {
posRight=posScreen;
println("Right:"+posRight.x+","+posRight.y);
ok2.play();
}
}
}
}
void onUpdateHands(int handId, PVector pos, float time) {
hands.put(handId, pos);
}
void onDestroyHands(int handId, float time) {
hands.remove(handId);
}
パーツ到着
ステッピングモーターに続いて
・ArduinoMEGA
・RAMPS(1.4)
・A4988
と一通り部品が揃いました
RAMPSやステッピングモータードライバの使い方がはじめはさっぱりだったのですが
データシートやらwebで他のステッピングモータードライバの使い方を調べて、
念のため早稲田さんにメールで確認もとれたので近日中にまずはモーターを動かします
以下、進捗があれば追記していきます@1/11
RAMPSとドライバを使わず、前回と同じやり方で
ArduinoからのHIGH/LOWだけで制御することは可能@1/14
ドライバのみ、RAMPS+ドライバでは相変わらず動かず@1/17
http://reprap.org/wiki/RAMPS_1.4
http://www.pololu.com/file/download/a4988_DMOS_microstepping_driver_with_translator.pdf?file_id=0J450
Z様のRAIDボリューム破損
突然の青ゲロの後に、RAID破損のエラーが出たのでメーカー送りになりましたとさ・・・
アキバでデータ復旧してくれるところに相談したけど
SSDのRAIDの場合はやっぱり桁違いに高くなるのね
Z様がもう一台買えちまうわ・・・
最終課題のコードとスライドが一式消えたのを復旧せねば