Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize the car to avoid obstacles by ​ matlab

2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the relevant knowledge of "how to achieve matlab to avoid obstacles". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

There are three steps:

Convert sensor data

Convert sensor data from car coordinate system to world coordinate system

Solve the motion parameters of avoiding collision by converting the sensor data.

First open this file.

First of all, in

Get the transformation matrix

START CODE BLOCK

R = [cos (theta)-sin (theta) x; sin (theta) cos (theta) y; 0 01]

END CODE BLOCK

In

Realize the conversion of sensor data, the conversion of sensor data from the car coordinate system to the world coordinate system

START CODE BLOCK

% Apply the transformation to robot frame.

Ir_distances_rf = zeros (3)

For i=1:n_sensors

Xamps = obj.sensor_placement (1BI)

Yizhs = obj.sensor_placement (2BI)

Theta_s = obj.sensor_placement (3BI)

R = obj.get_transformation_matrix (Xerox, Magazine, Thetails)

Ir_distances_rf (:, I) = R * [ir _ distances (I); 0; 1]

End

% Apply the transformation to world frame.

[xmemy _ theta] = state_estimate.unpack ()

R = obj.get_transformation_matrix (xmai y theta)

Ir_distances_wf = R*ir_distances_rf

Ir_distances_wf = ir_distances_wf (1JV 2JI:)

END CODE BLOCK

And then in

To solve the avoidance motion parameters by converting the sensor data.

START CODE BLOCK

% Compute the heading vector

N_sensors = length (robot.ir_array)

Sensor_gains = [1 1 0.5 1 1]

Uzzi = (ir_distances_wf-repmat ([XTINY], 1) * diag (sensor_gains)

U_ao = sum (UpriiPol 2)

% Compute the heading and error for the PID controller

Theta_ao = atan2 (u_ao (2), u_ao (1))

EQuik = theta_ao-theta

ESurek = atan2 (sin (esigk), cos (eBay))

END CODE BLOCK

Last run

This is the end of the content of "how to realize the car to avoid obstacles in matlab". Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report