Modelling of Curved road in order to simulate in Carmaker

조회 수: 6 (최근 30일)
Arsiv
Arsiv 2024년 4월 11일
댓글: Arsiv 2024년 4월 16일
Hello guys,
I need support to model a curved road to simulate the scenario with matlab and IPG Carmaker? Could you support me on how to begin this_

답변 (1개)

Ram Prasanth
Ram Prasanth 2024년 4월 11일
You can try using Driving Scenario Designer application in Matlab which will be useful to make your own scenario's.
Like Building curved roads, Ego's, Actors on the Roads and Ego's Charecteristic on the road while actors are present.
You can refer to the documentation of Driving Scenario Designer here - Design driving scenarios, configure sensors, and generate synthetic data - MATLAB - MathWorks France
  댓글 수: 6
Ram Prasanth
Ram Prasanth 2024년 4월 11일
편집: Ram Prasanth 2024년 4월 11일
Hi. Then there is no other option rather than hardcoding the lane boundaries.
Here is a sample curved scenario which i created for one of my personal project. It might be a starting point for you. You inspire from this code and create your own scenario if needed.
% Define the characteristics of the curved road
lengthOfRoad = 100; % The length of the road in meters
roadWidth = 3.5; % The width of the road in meters
radiusOfCurvature = 50; % The radius of curvature of the road in meters
widthOfLane = 3.5; % The width of each lane in meters
% Generate points to represent the curved road
numberOfPoints = 1000; % The number of points to generate
angles = linspace(0, pi, numberOfPoints); % The range of angles for the curve
xCoordinates = radiusOfCurvature * cos(angles); % The x coordinates of the points
yCoordinates = radiusOfCurvature * sin(angles); % The y coordinates of the points
% Adjust the curve to fit the desired position and orientation
xCoordinates = xCoordinates - radiusOfCurvature; % Shift the center of the curve
yCoordinates = yCoordinates + roadWidth/2; % Adjust the curve vertically
xCoordinates = xCoordinates + lengthOfRoad/2; % Adjust the curve horizontally
% Plot the curved road
plot(xCoordinates, yCoordinates, 'b-', 'LineWidth', 2); % Plot the road curve
% Add lane markings
laneMarkingWidth = 0.1; % The width of lane markings
for lane = 1:2 % For each lane
laneCenterY = (lane - 1) * widthOfLane + widthOfLane/2; % Calculate the y coordinate of the lane center
laneMarkingY = [laneCenterY - widthOfLane/4, laneCenterY + widthOfLane/4]; % Calculate lane marking y coordinates
plot([0, lengthOfRoad], [laneCenterY, laneCenterY], 'w-', 'LineWidth', roadWidth); % Plot lane boundaries
for i = 1:floor(lengthOfRoad/widthOfLane)
plot([i*widthOfLane, i*widthOfLane], laneMarkingY, 'y-', 'LineWidth', laneMarkingWidth); % Plot lane markings
end
end
% Set plot properties
axis equal; % Set equal aspect ratio
xlabel('X (m)'); ylabel('Y (m)'); % Label axes
title('Curved Road Scenario'); % Set title
grid on; % Show grid
I used these codes to display the post processing data from the simulink at an App Created in the Matlab App Designer.
Arsiv
Arsiv 2024년 4월 16일
hey Thankyou for your valuable input, I will work on it and return back if i encounter any problems

댓글을 달려면 로그인하십시오.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by