encoder.cpp

00001 /*
00002   エンコーダ出力の観測
00003   Satofumi KAMIMURA
00004   $Id$
00005 */
00006 
00007 #include "runCtrl.h"
00008 #include <stdio.h>
00009 #include <stdlib.h>
00010 
00011 
00012 int main(int argc, char *argv[]) {
00013   RunCtrl run;
00014   if (run.connect(argc, argv) < 0) {
00015     printf("RunCtrl::connect: %s\n", run.what());
00016     exit(1);
00017   }
00018 
00019   unsigned long pre = VXV::GetTicks();
00020   for (int i = 0; i < 20; ++i) {
00021     int enc_vel;
00022     //for (int j = 0; j < 2; ++j) {
00023     //run.setMotorMode(0, 0);
00024     //run.setMotorPwm(0, 0);
00025     //run.getEncoderVel(0, &enc_vel);
00026     //}
00027 
00028     unsigned long now = VXV::GetTicks();
00029     long diff = now - pre;
00030     printf("enc_vel: %d, ticks: %lu (%ld)\n", enc_vel, now, diff);
00031     pre = now;
00032     VXV::Delay(1000);
00033   }
00034 
00035   return 0;
00036 }
00037 

Generated on Mon Apr 13 22:52:02 2009 by  doxygen 1.5.7.1