In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces "matlab how to achieve PID to control the car to the designated position". In the daily operation, I believe that many people have doubts about how to achieve matlab to control the car to the designated position. The editor consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful for everyone to answer the question of "how to achieve PID to control the car to advance to the designated position". Next, please follow the editor to study!
There are three steps:
Determine the forward direction of the car according to the target position
Calculate the difference between the target direction and the current direction
Select appropriate PID parameters to drive the left and right wheels
First open this file.
In
Realize PID to control the car to move forward to the designated position.
START CODE BLOCK
1. Calculate the heading (angle) to the goal.
% distance between goal and robot in x-direction
Uplix = x_g-x
% distance between goal and robot in y-direction
Upliy = y_g-y
% angle from robot to goal. Hint: use ATAN2, u_x, u_y here.
Theta_g = atan2 (upright _
2. Calculate the heading error.
% error between the goal angle and robot's angle
% Hint: Use ATAN2 to make sure this stays in [- pi,pi].
EReck = atan2 (sin (theta_g-theta), cos (theta_g-theta))
3. Calculate PID for the steering angle
% error for the proportional term
Ethereal P = estrangk
% error for the integral term. Hint: Approximate the integral using
% the accumulated error, obj.E_k, and the error for
% this time step, eQuik.
EBay I = obj.E_k + e_k*dt
% error for the derivative term. Hint: Approximate the derivative
% using the previous error, obj.e_k_1, and the
% error for this time step, eQuik.
EBay D = (e_k-obj.e_k_1) / dt
END CODE BLOCK
Last run
At this point, the study on "how to achieve matlab PID to control the car to the designated position" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.