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: MPU6050 mbed PID
Fork of BLE_MPU6050_test6_challenge_sb by
Revision 20:b0e1fa37856d, committed 2018-05-25
- Comitter:
- c201075
- Date:
- Fri May 25 04:52:06 2018 +0000
- Parent:
- 19:5f1e153ef63e
- Child:
- 21:14cf80622dd5
- Commit message:
- bug fix
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
| wallbotble/wallbotble/wallbotble.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu May 24 04:20:45 2018 +0000
+++ b/main.cpp Fri May 25 04:52:06 2018 +0000
@@ -7,7 +7,7 @@
//#include "Adafruit_GFX.h"
//#include "pictLIB.h"
-#define DEBUG
+//#define DEBUG
Serial pc(USBTX, USBRX);
BLEDevice ble;
@@ -80,7 +80,7 @@
float left_cmd = 0;
memcpy( &right_cmd, params->data , sizeof(right_cmd));
memcpy( &left_cmd, params->data + sizeof(right_cmd), sizeof(left_cmd));
- wb.SetRPM(right_cmd,left_cmd);
+ wb.SetRPM(left_cmd,right_cmd);
#ifdef DEBUG
//割り込みハンドラの中でシリアル通信しないこと。
//printf("SetRPM:%f,%f",left_cmd,right_cmd)
@@ -151,13 +151,15 @@
//pc.printf("auto calibrate start\n\r");
//適当キャリブレーション
+ /*
for(int i = 0 ; i < 4 ; i++)
{
wb._calibratedMinimum[i] = 300;
wb._calibratedMaximum[i] = 900;
}
-
- //wb.auto_calibrate(); //自動キャリブレーション
+ */
+
+ wb.auto_calibrate(); //自動キャリブレーション
#ifdef DEBUG
for(int i = 0 ; i < 4 ; i++)
{
--- a/wallbotble/wallbotble/wallbotble.cpp Thu May 24 04:20:45 2018 +0000
+++ b/wallbotble/wallbotble/wallbotble.cpp Fri May 25 04:52:06 2018 +0000
@@ -98,10 +98,11 @@
_right_motor = -1*_ctrl_r.compute();
else
_right_motor = _ctrl_r.compute();
+
if(_left_back)
_left_motor = -1*_ctrl_l.compute();
else
- _left_motor = _ctrl_r.compute();
+ _left_motor = _ctrl_l.compute();
}
@@ -117,8 +118,8 @@
leftRPM = -1 *leftRPM;
}
+ _ctrl_r.setSetPoint(rightRPM);
_ctrl_l.setSetPoint(leftRPM);
- _ctrl_r.setSetPoint(rightRPM);
}
float wallbotble::get_right_rpm(){
