control YOZAKURA ARM with keyboard
Dependencies: Dynamixel MEMS_Thermal_Sensor SerialHalfDuplex mbed
Revision 3:7a30251664f0, committed 2015-04-24
- Comitter:
- yusuke_kyo
- Date:
- Fri Apr 24 03:21:58 2015 +0000
- Parent:
- 2:b46156a5c6a5
- Commit message:
- uparrow,downarrow,rightarrow
Changed in this revision
--- a/Dynamixel.lib Wed Apr 22 18:10:04 2015 +0000 +++ b/Dynamixel.lib Fri Apr 24 03:21:58 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/yusuke_kyo/code/Dynamixel/#5ce46b6748fd +http://developer.mbed.org/users/yusuke_kyo/code/Dynamixel/#4b2c48ab30fe
--- a/MEMS_Thermal_Sensor.lib Wed Apr 22 18:10:04 2015 +0000 +++ b/MEMS_Thermal_Sensor.lib Fri Apr 24 03:21:58 2015 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/yusuke_kyo/code/MEMS_Thermal_Sensor/#c7d3279ba305 +http://developer.mbed.org/users/yusuke_kyo/code/MEMS_Thermal_Sensor/#6a5ab8af56a4
--- a/main.cpp Wed Apr 22 18:10:04 2015 +0000
+++ b/main.cpp Fri Apr 24 03:21:58 2015 +0000
@@ -45,31 +45,31 @@
yP = yaw.GetPosition(); yC = yaw.GetCurrent();
linear_goal=lP; pitch_goal=pP; yaw_goal=yP; //現在角度を目標値に設定
- printf("linearPosition : %4f[degree]\n",lP); printf("Voltage : %4f[V]\n",lV);
- printf("pitchPosition : %4f[degree]\n",pP); printf("pitchCurrent : %4f[A]\n",pC);
- printf("yawPosition : %4f[degree]\n",yP); printf("yawCurrent : %4f[A]\n",yC);
- sprintf(data,"%4f %4f %4f %4f %4f %4f ",lP,lV,pP,pC,yP,yC);
+ printf("linearPosition : %4.1f[degree]\n",lP); printf("Voltage : %4.1f[V]\n",lV);
+ printf("pitchPosition : %4.1f[degree]\n",pP); printf("pitchCurrent : %4.1f[A]\n",pC);
+ printf("yawPosition : %4.1f[degree]\n",yP); printf("yawCurrent : %4.1f[A]\n",yC);
+ sprintf(data,"%4.1f %4.1f %4.1f %4.1f %4.1f %4.1f ",lP,lV,pP,pC,yP,yC);
}
void Dyna_SetGoal(int linear_mode, int pitch_mode, int yaw_mode) {
switch(linear_mode){
- case 0: break;
- case 1: linear.SetTorqueLimit(1); linear_goal+=5; break;
- case 2: linear.SetTorqueLimit(1); linear_goal-=5; break;
+ case 29: break;
+ case 30: linear.SetTorqueLimit(1); linear_goal+=5; break;
+ case 31: linear.SetTorqueLimit(1); linear_goal-=5; break;
}
linear.SetGoal(linear_goal);
switch(pitch_mode){
- case 0: break;
- case 1: pitch_goal+=5; break;
- case 2: pitch_goal-=5; break;
+ case 29: break;
+ case 30: pitch_goal+=5; break;
+ case 31: pitch_goal-=5; break;
}
pitch.SetGoal(pitch_goal);
switch(yaw_mode){
- case 0: break;
- case 1: yaw_goal+=5; break;
- case 2: yaw_goal-=5; break;
+ case 29: break;
+ case 30: yaw_goal+=5; break;
+ case 31: yaw_goal-=5; break;
}
yaw.SetGoal(yaw_goal);
}
@@ -104,6 +104,7 @@
if(i%4==0) printf("\n");
printf("%3.1f ",ThD1[i]);
}
+ printf("\n");
}
for(int i=0;i<16;i++){
@@ -117,6 +118,7 @@
if(i%4==0) printf("\n");
printf("%3.1f ",ThD2[i]);
}
+ printf("\n");
}
}
/*--Thermal_Sensor:end------------------------------------------------------------------------------------*/
@@ -140,7 +142,7 @@
sensor_v = v * 5.0/3.3; //電圧レベルを合わせる
CO2 = sensor_v * 1000 + 400; //データシートより
- if(CO2_DEBUG) printf("\n%4f",CO2);
+ if(CO2_DEBUG) printf("\nCO2:%4f\n",CO2);
return(CO2);
}
@@ -175,12 +177,15 @@
printf("%s\n",Dyna_data);
myled1=0;
- printf("linear_mode : \n");
+ printf("linear_mode : ");
linear_mode=pc.getc();
- printf("pitch_mode : \n");
+ printf("%d\n",linear_mode);
+ printf("pitch_mode : ");
pitch_mode=pc.getc();
- printf("yaw_mode : \n");
+ printf("%d\n",pitch_mode);
+ printf("yaw_mode : ");
yaw_mode=pc.getc();
+ printf("%d\n",yaw_mode);
//目標角度を変更
myled2=1;
@@ -188,23 +193,23 @@
myled2=0;
/*--Dynamixel:end------------------------------------------------------------------*/
- /*--Thermal_Sensor:begin-----------------------------------------------------------*/
- //値を取得
- myled3=1;
- GetThermo(Thermo_data);
- /*--Thermal_Sensor:end-------------------------------------------------------------*/
-
- /*--CO2_Sensor:begin---------------------------------------------------------------*/
- //値を取得
- CO2_data=GetCO2();
- myled3=0;
- /*--CO2_Sensor:end-----------------------------------------------------------------*/
-
- //値を送信
- myled4=1;
- sprintf(Send_data,"%s%s%f",Dyna_data,Thermo_data,CO2_data);
- printf("%s\n",Send_data);
- myled4=0;
+// /*--Thermal_Sensor:begin-----------------------------------------------------------*/
+// //値を取得
+// myled3=1;
+// GetThermo(Thermo_data);
+// /*--Thermal_Sensor:end-------------------------------------------------------------*/
+//
+// /*--CO2_Sensor:begin---------------------------------------------------------------*/
+// //値を取得
+// CO2_data=GetCO2();
+// myled3=0;
+// /*--CO2_Sensor:end-----------------------------------------------------------------*/
+//
+// //値を送信
+// myled4=1;
+// sprintf(Send_data,"%s%s%f",Dyna_data,Thermo_data,CO2_data);
+// printf("\n%s\n",Send_data);
+// myled4=0;
}
}
\ No newline at end of file