sampleProgram

Dependencies:   QEI accelerator bit_test cyclic_io cyclic_var cylinder event_var limit mbed mecanum motor_drive pid pid_encoder rs422_put sbdbt servo

Fork of 17robo_fuzi by kusano kiyoshige

Revision:
32:f535ace7c529
Parent:
31:285c9898da03
Child:
33:64fd1bd83bac
--- a/main.cpp	Tue Aug 29 02:07:56 2017 +0000
+++ b/main.cpp	Tue Aug 29 03:01:50 2017 +0000
@@ -41,9 +41,9 @@
 #define pin_interrupt_cylinder_min       p23
 #define encoder_A       p25
 #define encoder_B       p26
-#define enc_Kp      0.01
-#define enc_Ki      0.01
-#define enc_Kd      0.01
+#define enc_Kp      0.009
+#define enc_Ki      0.00
+#define enc_Kd      0.00
 #define powerdown   0.6
 #define pin_servo_reload p21 //
 #define pin_interrupt_reload p22 //
@@ -159,7 +159,7 @@
             counter ++;
             break;
         case 2:
-            rs422.put(id[counter], sbdbt.right_y, 0.0);
+            rs422.put(id[counter], enc_cylinder.duty()*-1, 0.0);
             counter ++;
             break;
         case 3:
@@ -213,7 +213,7 @@
 //追記(動作未確認)
 float cylinder_pwm;
 int cylinder_pos_num = 0;
-float cylinder_pos[3] = {0.0,50.0,75.0};
+float cylinder_pos[3] = {0.0,180.0,360.0};
 void cylinder_cal()
 {
     cylinder.cyclic(sbdbt.shikaku);     //cylinder ON/OFF
@@ -226,7 +226,7 @@
     }
     enc_cylinder.cal((float)cylinder_pos[cylinder_pos_num],output_period); //コントローラで数値設定
     
-    pc.printf("terget\t%f\tnow_pulse\t%lo\tnow_rad\t%f\tpwm\t%f\r\n",cylinder_pos[cylinder_pos_num],enc_cylinder.pulse(),enc_cylinder.deg(),enc_cylinder.duty());
+    pc.printf("terget\t%f\tnow_deg\t%f\tnow_rad\t%f\tpwm\t%f\r\n",cylinder_pos[cylinder_pos_num],enc_cylinder.deg(),enc_cylinder.rad(),enc_cylinder.duty());
 
 //リロード機構完成後
     /*