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.
Diff: sensors/sensors.cpp
- Revision:
- 37:e1398ff45b12
- Parent:
- 35:04699b49c463
--- a/sensors/sensors.cpp Wed May 15 06:48:23 2019 +0000
+++ b/sensors/sensors.cpp Wed May 15 09:08:31 2019 +0000
@@ -162,18 +162,23 @@
else led4=0;
}
-float Hcsr04BackWithEc(){
+float Hcsr04BackWithEc()
+{
+
hcsr04_val[1] = GetFilteredDist_cm(sensor_back,lowpassfilter[1]);
FileWrite();
- int is_ok = checkUW(hcsr04_val[1], degree0*kDeg2Rad, ec_li.getCount());//ECは内側を一応選んだ
- if(is_ok != 1)
- {
- hcsr04_val[1] = GetFilteredDist_cm(sensor_back,lowpassfilter[1]);
+ int is_ok = checkUW(hcsr04_val[1], degree0*kDeg2Rad, ec_li.getCount());//ECは内側を選んだ.適当
+ if(is_ok != 1) {
+ //もう一度とる
+ sensor_back.start();
+ wait_ms(50);
+ hcsr04_val[1] = sensor_back.get_dist_cm();
FileWrite();
}
return hcsr04_val[1];
}
-int checkUW(double uwdist,double theta,int eccount){ //uwdist[cm],theta[rad],eccount[]
+int checkUW(double uwdist,double theta,int eccount) //uwdist[cm],theta[rad],eccount[]
+{
const double oneloopdist=0.22f;//[m]
const double ecsliprate=0.7f;
const double errrange=0.5;//収束判定[m]