fork of what I have been writing
Diff: ES_CW2_Starter_STARFISH/MotorControl.h
- Revision:
- 13:f6e37c21d31d
- Parent:
- 12:38afe92e67d0
--- a/ES_CW2_Starter_STARFISH/MotorControl.h Mon Mar 09 15:02:47 2020 +0000 +++ b/ES_CW2_Starter_STARFISH/MotorControl.h Mon Mar 09 17:19:39 2020 +0000 @@ -57,7 +57,6 @@ const float kd_pos = 0; const float pwm_period =0.25f; -int target_velocity = 30; float target_position = 500; // GLOBAL VARIABLES MOTOR // @@ -223,8 +222,9 @@ } } -void motorCtrlFn() +void motorCtrlFn( float* NewSpeed) { + float target_velocity = *NewSpeed; // motor controller variables float current_position = 0; int previous_position = 0; @@ -233,6 +233,7 @@ uint32_t last_time_MtrCtlr; float pos_error_old; int i = 0; + float velocity_integral=0; float velocity_derivative=0;