Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed M3_CAN_mbed
Revision 4:5878229a7dfa, committed 2018-12-25
- Comitter:
- Keith_N
- Date:
- Tue Dec 25 11:34:30 2018 +0000
- Parent:
- 3:587916e9f3d0
- Commit message:
- changed parameters of a[i]
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Dec 25 08:24:47 2018 +0000
+++ b/main.cpp Tue Dec 25 11:34:30 2018 +0000
@@ -27,7 +27,12 @@
char tmp[4];
//led.period_ms(10);
+ Nin.baud(115200);
+
m3.write(0, RG_SOFT_SRV,RG_DEFAULT, 1);
+ m3.write(0, RG_CYCLE,RG_COMMUNICATE, 500000);
+ m3.write(0, RG_CYCLE,RG_INTERPOLATE, 100);
+ m3.write(0, RG_STATE,RG_DEFAULT, 11);
while(1){
@@ -65,9 +70,9 @@
float k = 0.1;
//a+=(int32_t)(30000*diff);
if(force[i]*k-data[i]>=0){
- a[i]+=3000*(force[i]*k-data[i]);
+ a[i]+=90000*(force[i]*k-data[i]);
}else{
- a[i]-=12000*(data[i]-force[i]*k);
+ a[i]-=810000*(data[i]-force[i]*k);
}
if(a[i]>300000)a[i]=300000;
@@ -79,7 +84,25 @@
if(i==4) pc.printf("\n\r");
//wait(0.001);
- }
+ }
+/* for(int i = 1;i <= 4; i++){
+ float k = 0.1;
+ //a+=(int32_t)(30000*diff);
+ if(force[i]*k-data[i]>=0){
+ a[i]+=90000*(0.5f-data[i]);
+ }else{
+ a[i]-=90000*(data[i]-0.5f);
+ }
+
+ if(a[i]>300000)a[i]=300000;
+ else if(a[i]<0)a[i]=0;
+
+ m3.write(i, RG_REFERENCE,RG_POSITION,a[i]*(-1));
+
+ pc.printf("No.%d, Stroke:%ld mm ", i, a[i]*2/36000);
+ if(i==4) pc.printf("\n\r");
+ } */
+
}
}