Control YOZAKURA arm vir USB

Dependencies:   Dynamixel MEMS_Thermal_Sensor SerialHalfDuplex mbed

Files at this revision

API Documentation at this revision

Comitter:
yusuke_kyo
Date:
Thu Apr 23 06:42:01 2015 +0000
Parent:
5:a6d9a1dec391
Commit message:
dynamixel boardrate

Changed in this revision

Dynamixel.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
diff -r a6d9a1dec391 -r fc49395cd7e5 Dynamixel.lib
--- a/Dynamixel.lib	Tue Apr 21 16:08:58 2015 +0000
+++ b/Dynamixel.lib	Thu Apr 23 06:42:01 2015 +0000
@@ -1,1 +1,1 @@
-http://developer.mbed.org/users/yusuke_kyo/code/Dynamixel/#950c4f4f73c6
+http://developer.mbed.org/users/yusuke_kyo/code/Dynamixel/#d0c0d11907e2
diff -r a6d9a1dec391 -r fc49395cd7e5 main.cpp
--- a/main.cpp	Tue Apr 21 16:08:58 2015 +0000
+++ b/main.cpp	Thu Apr 23 06:42:01 2015 +0000
@@ -12,7 +12,7 @@
 #include "AX12.h"
 #include "MX28.h"
 
-DigitalOut low(p19); DigitalOut RelaySwitch(p17);
+DigitalOut low(p16); DigitalOut RelaySwitch(p18);
 
 AX12 linear (p13, p14, 0, 1000000);      //直動Dynamixel
 MX28 pitch (p13, p14, 1, 1000000);       //ピッチDynamixel
@@ -22,7 +22,7 @@
 
 //最小値,最大値,角速度,初期値を指定[unit:degree]
 //MX:MultiTurnモードでは-2520°~2520°(SetGoalの書き換え不要)
-int linear_min = 100; int linear_MAX = 720; float linear_Speed=0.1; int linear_Init = linear_MAX;
+int linear_min = 100; int linear_MAX = 300; float linear_Speed=0.1; int linear_Init = linear_MAX;
 int pitch_min = 172; int pitch_MAX = 334; float pitch_Speed=0.2; int pitch_Init = pitch_MAX;
 int yaw_min = 360; int yaw_MAX = 360; float yaw_Speed=0.2; int yaw_Init = 0; //MultiTurnモード
 
@@ -46,7 +46,7 @@
     
     linear_goal=lP; pitch_goal=pP; yaw_goal=yP; //現在角度を目標値に設定
     
-    sprintf(data,"%f %f %f %f %f %f ",lP,lV,pP,pC,yP,yC);  
+    sprintf(data,"%4f %4f %4f %4f %4f %4f ",lP,lV,pP,pC,yP,yC);  
 }
 
 void Dyna_SetGoal(int linear_mode, int pitch_mode, int yaw_mode) {
@@ -156,7 +156,7 @@
     sensor_v = v * 5.0/3.3; //電圧レベルを合わせる
     CO2 = sensor_v * 1000 + 400;  //データシートより
     
-    if(CO2_DEBUG) printf("\n%4.1f",CO2);
+    if(CO2_DEBUG) printf("\n%4f",CO2);
 
     return(CO2);
 }
@@ -173,16 +173,15 @@
     
     Dyna_init();
     
-    char S_data[200];
-    int R_data;
+    char Send_data[200];
+    int Read_data;
     int Joy_mode, linear_mode, pitch_mode, yaw_mode;
     
     while(1) {
         
-//        sock.receiveFrom(echo_server, R_data, sizeof(R_data)); //オペステからデータを取得
-        R_data=pc.getc();
+        Read_data=pc.getc();
         wait_ms(1);
-        Joy_mode = R_data & 0x03; //ジョイスティックのモード判定
+        Joy_mode = Read_data & 0x03; //ジョイスティックのモード判定
         
         switch(Joy_mode){
             case 0: //通常モード
@@ -217,9 +216,8 @@
             
             //値を送信
                 myled4=1;
-                sprintf(S_data,"%s%s%f",Dyna_data,Thermo_data,CO2_data);
-//                sock.sendTo(echo_server, S_data, sizeof(S_data));
-                printf("%s\n",S_data);
+                sprintf(Send_data,"%s%s%f",Dyna_data,Thermo_data,CO2_data);
+                printf("%s\n",Send_data);
                 myled4=0;           
                 break;