Implement new controller
Dependencies: mbed-rtos mbed QEI BNO055 MPU6050_DMP_Nucleo-I2Cdev virgo3_imuHandler_Orion_PCB MAX17048 Servo
Fork of Orion_newPCB_test by
Revision 30:44676e1b38f8, committed 2018-03-20
- Comitter:
- ahmed_lv
- Date:
- Tue Mar 20 05:56:22 2018 +0000
- Parent:
- 29:a6a812ee83ea
- Commit message:
- Editted Input Variables to PID
Changed in this revision
01_DriveTrain/pidBearing.cpp | Show annotated file Show diff for this revision Revisions of this file |
orion_main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a6a812ee83ea -r 44676e1b38f8 01_DriveTrain/pidBearing.cpp --- a/01_DriveTrain/pidBearing.cpp Tue Mar 20 03:47:56 2018 +0000 +++ b/01_DriveTrain/pidBearing.cpp Tue Mar 20 05:56:22 2018 +0000 @@ -48,7 +48,7 @@ *k3 = 0.0; else *k3= generalFunctions::abs_f(generalFunctions::map_f(generalFunctions::abs_f(minDist), 0, max_in, 0.0, lGain)); - *k3 = generalFunctions::constrain_f(*k3, 0, 1.25); + *k3 = generalFunctions::constrain_f(*k3, 0, lGain); *wl = -(10 + *speedChange)*(*k3);
diff -r a6a812ee83ea -r 44676e1b38f8 orion_main.cpp --- a/orion_main.cpp Tue Mar 20 03:47:56 2018 +0000 +++ b/orion_main.cpp Tue Mar 20 05:56:22 2018 +0000 @@ -71,10 +71,10 @@ pidBearing PID_B; //PID control for bearing pidControl PID_L, PID_R; //pidcontroller for left and right motors -//**new PID control** +//**new PID control**/*#LV*/ float bearingToWaypoint, robotFrame, prevError, speedChange; float k3, cmdL, cmdR, Error; -//**end of new control ** +//**end of new control **/*#LV*/ Timer motorControl_t; float rpm_cmd[2]; //drive motor rpm command @@ -410,7 +410,7 @@ //if((imu.imu_stabilized[1] ==1) && (go_cmd == 1)) { if(imu.imu_stabilized[1] ==1) { - +/*#LV*/ PID_B.setSpeedChange( &W_l, &W_r, &speedChange, &Error, target_waypoint, localization.position, @@ -419,7 +419,7 @@ waypoints_set[waypoint_index - 2][0], waypoints_set[waypoint_index - 2][1], &k3, 3.5 ); //new controller - +/*#LV*/ if(waypointSetFinish_flag == 0) { @@ -482,12 +482,14 @@ // else // waypointReached_flag = 0; +/*#LV*/ PID_B.findRobotFrameDistance(target_waypoint, localization.position, &robotFrame); if(robotFrame <= waypointZone) waypointReached_flag = 1; else waypointReached_flag = 0; +/*#LV*/ } Thread::wait(imu_UpdatePeriodMS);