Answered step by step
Verified Expert Solution
Question
1 Approved Answer
pseudocode to C++ code; I have this pseudocode, but what would this code look like in C++? PID Control (pseudocode) 1. Initialise: P_error I_error D_error-
pseudocode to C++ code;
I have this pseudocode, but what would this code look like in C++?
PID Control (pseudocode) 1. Initialise: P_error I_error D_error- prev_error o 2. Update: cur_error - difference between sensors on Arduino 3. Set: P_error cur_error 4. Set: I_error I_error + (cur_error x sampling_time_in_sec) 5. Set: D_error - (cur_error - prev_error)/sampling time_in_sec 6. Set: prev_error cur_error 7. Set: output= KpXP error + K 1x1 error + K d x K error 8. Set: next-speed = cur-speed output 9. sleep(sampling_ time_ in_sec or other units)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started