ObjectFollower
Dependencies: TPixy-Interface
Fork of PlayBack by
Diff: PiControlThread.cpp
- Revision:
- 21:7fee709bb063
- Parent:
- 20:9118203f7c9c
- Child:
- 22:c09acff62e6a
diff -r 9118203f7c9c -r 7fee709bb063 PiControlThread.cpp --- a/PiControlThread.cpp Fri Mar 23 22:10:38 2018 +0000 +++ b/PiControlThread.cpp Fri Mar 23 22:32:38 2018 +0000 @@ -34,8 +34,6 @@ sensors_t sensors; -int time_passed = 0; - void PiControlThread(void const *); void PeriodicInterruptISR(void); @@ -65,8 +63,6 @@ Ticker PeriodicInt; // Declare a timer interrupt: PeriodicInt -DigitalOut led3(LED3); - /******************************************************************************* * @brief function that creates a thread for the PI controller. It initializes * the PI controller's gains and initializes the DC Motor. It also @@ -77,8 +73,8 @@ void PiControlThreadInit() { DE0_init(); // initialize FPGA - motorDriver_R_init(); // initialize motorDriver - motorDriver_L_init(); // initialize motorDriver + motorDriver_R_init(); // initialize motorDriver + motorDriver_L_init(); // initialize motorDriver // Kp,Ki PiController_init(1,0.4); // initialize the PI Controller gains and initialize variables @@ -86,7 +82,7 @@ // Specify address of the PeriodicInt ISR as PiControllerISR, specify the interval // in seconds between interrupts, and start interrupt generation: - PeriodicInt.attach(&PeriodicInterruptISR, 0.010); // 10ms sampling period -> 100Hz + PeriodicInt.attach(&PeriodicInterruptISR, 0.010); // 10ms sampling period -> 100Hz freq } @@ -110,10 +106,10 @@ sensors.dp_right = SaturateValue(sensors.dp_right, 112); sensors.dp_left = SaturateValue(sensors.dp_left, 112); - // Maximum velocity at dPostition = 560 is vel = 703 + // Maximum angular velocity @ dPostition = 112 is vel = 703 rad/sec velR = (float)((6135.92 * sensors.dp_right) / sensors.dt_right) ; - // Maximum velocity at dPostition = 560 is vel = 703 + // Maximum angular velocity @ dPostition = 112 is vel = 703 rad/sec velL = (float)((6135.92 * sensors.dp_left) / sensors.dt_left) ; /********************Manual Setpoint and Steering**********************/