{"id":5849,"date":"2021-06-22T18:13:48","date_gmt":"2021-06-22T16:13:48","guid":{"rendered":"https:\/\/blogs.mathworks.com\/student-lounge\/?p=5849"},"modified":"2021-06-22T18:13:48","modified_gmt":"2021-06-22T16:13:48","slug":"driving-an-autonomous-vehicle-on-a-track-with-recorded-synthetic-data","status":"publish","type":"post","link":"https:\/\/blogs.mathworks.com\/student-lounge\/2021\/06\/22\/driving-an-autonomous-vehicle-on-a-track-with-recorded-synthetic-data\/","title":{"rendered":"Driving an Autonomous Vehicle on a Track with Recorded Synthetic Data"},"content":{"rendered":"<p><em>Today\u2019s blog post is written by Veer Alakshendra, Education Technical Evangelist on the Student Competition team at MathWorks. <\/em><\/p>\n<p><span data-contrast=\"auto\">With\u00a0advancements in the automotive industry, various student competitions have introduced\u00a0the\u00a0driverless category,\u00a0where the goal of the teams is to\u00a0design and build an autonomous vehicle that can compete\u00a0in different disciplines.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">Using\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/solutions\/automotive\/automated-driving.html\"><span data-contrast=\"none\">MATLAB and Simulink<\/span><\/a><span data-contrast=\"none\">,<\/span><span data-contrast=\"auto\">\u00a0you can design automated driving system functionality including sensing, path planning, sensor fusion,\u00a0and control\u00a0systems.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">In this article, we\u00a0will demonstrate an approach\u00a0to drive\u00a0an autonomous vehicle\u00a0in a closed-loop\u00a0circuit.\u00a0The task here is to drive the car in an unknown environment avoiding collision with the cones ensuring to complete the necessary laps.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"800\" height=\"449\" class=\"aligncenter size-full wp-image-5819\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/GIF.gif\" alt=\"\" \/><\/p>\n<h1 aria-level=\"2\"><span data-contrast=\"none\">Scene Creation<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><span data-contrast=\"auto\">The first step is to create\u00a0a 3D simulation environment consisting\u00a0of a vehicle,\u00a0track, and cones.\u00a0The\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/products\/vehicle-dynamics.html\"><span data-contrast=\"none\">Vehicle Dynamics Blockset<\/span><\/a><span data-contrast=\"auto\">\u00a0Toolbox\u00a0comes installed with prebuilt 3D scenes to simulate and visualize the vehicles\u00a0modeled in Simulink. These 3D scenes are visualized using the\u00a0<\/span><a href=\"https:\/\/www.unrealengine.com\/en-US\/\"><span data-contrast=\"none\">Unreal Engine<\/span><\/a><span data-contrast=\"auto\">\u00a0from Epic Games.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">As the\u00a0current problem requires\u00a0a\u00a0customized scene, we\u00a0used\u00a0the Unreal Editor and\u00a0the\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/matlabcentral\/fileexchange\/65966-vehicle-dynamics-blockset-interface-for-unreal-engine-4-projects\"><span data-contrast=\"none\">Vehicle Dynamics Blockset Interface for Unreal Engine 4 Projects support package<\/span><\/a><span data-contrast=\"auto\">\u00a0to build the scene.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><span data-contrast=\"auto\">To learn how to customize scenes\u00a0(Figure 2), please follow the steps explained in the\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/help\/vdynblks\/ug\/customize-3d-scenes-for-vehicle-dynamics-simulations.html\"><span data-contrast=\"none\">documentation<\/span><\/a><span data-contrast=\"auto\">.\u00a0Alternatively,\u00a0we\u00a0can also use\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/products\/roadrunner.html\"><span data-contrast=\"none\">RoadRunner<\/span><\/a><span data-contrast=\"auto\">\u00a0to design 3D scenes for automated driving simulations.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1157\" height=\"631\" class=\"aligncenter size-full wp-image-5822\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure1.png\" alt=\"\" \/><\/p>\n<p><em><span class=\"TextRun SCXW115632657 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW115632657 BCX0\">Fig 1. Custom scene in Unreal<\/span><\/span><\/em><span class=\"EOP SCXW115632657 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:2,&quot;335551620&quot;:2,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1200\" height=\"544\" class=\"aligncenter size-full wp-image-5825\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure2.png\" alt=\"\" \/><\/p>\n<p><em><span class=\"TextRun SCXW17260960 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW17260960 BCX0\">Fig 2.\u00a0<\/span><span class=\"NormalTextRun SCXW17260960 BCX0\">Steps for creating\u00a0<\/span><span class=\"NormalTextRun SCXW17260960 BCX0\">a\u00a0<\/span><span class=\"NormalTextRun SCXW17260960 BCX0\">custom scene<\/span><\/span><\/em><span class=\"EOP SCXW17260960 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:2,&quot;335551620&quot;:2,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h1><span class=\"TextRun SCXW114005056 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"none\"><span class=\"NormalTextRun SCXW114005056 BCX0\" data-ccp-parastyle=\"heading 2\">Lap1: Environment Mapping<\/span><\/span><span class=\"EOP SCXW114005056 BCX0\" data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1616\" height=\"321\" class=\"aligncenter size-full wp-image-5861\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure3.jpg\" alt=\"\" \/><\/p>\n<p><em>Fig 3. Simulink model for\u00a0environment mapping\u00a0<\/em><\/p>\n<p><span data-contrast=\"auto\">The\u00a0next task\u00a0is to map the environment. As mentioned in the previous section, the\u00a0driverless vehicle is in an\u00a0unknown\u00a0environment\u00a0that\u00a0consists of cones kept on both sides of the track.\u00a0To\u00a0detect the\u00a0cones and generate a reference path for the\u00a0first\u00a0lap, we have built\u00a0a Simulink model as shown in\u00a0Figure\u00a03.\u00a0Figure\u00a04\u00a0shows the steps\u00a0performed by the model\u00a0in the first lap:\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1200\" height=\"237\" class=\"aligncenter size-full wp-image-5828\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure4.png\" alt=\"\" \/><\/p>\n<p><em>Fig 4.\u00a0Block diagram representation of environment mapping\u00a0\u00a0<\/em><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><b><span data-contrast=\"auto\">Lidar\u00a0mounting<\/span><\/b><span data-contrast=\"auto\">: The purpose of the lidar is to measure the distance\u00a0to\u00a0the cones. The\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/help\/driving\/ref\/simulation3dlidar.html\"><span data-contrast=\"none\">Simulation 3D Lidar<\/span><\/a><span data-contrast=\"auto\">\u00a0block provides an interface to the lidar sensor in a 3D simulation environment. The\u00a0environment is rendered using the\u00a0<\/span><a href=\"https:\/\/www.unrealengine.com\/en-US\/\"><span data-contrast=\"none\">Unreal Engine<\/span><\/a><span data-contrast=\"auto\">\u00a0from Epic Games. The block returns a point cloud with the specified field of view and angular resolution.\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><b><span data-contrast=\"auto\">Cone detection\u00a0(Figure 6)<\/span><\/b><span data-contrast=\"auto\">:\u00a0The\u00a0goal of the cone\u00a0detection algorithm is to\u00a0cluster\u00a0all points that belong to one cone and identify the position of the cones.\u00a0\u00a0This is done by calculating the distance between consecutive points in the point cloud.\u00a0The points that belong to the same cone are close to each other, while cones are relatively far apart from each other.\u00a0After clustering, the midpoint of the cone is the mean of the position of\u00a0all\u00a0the points in the\u00a0cone.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"716\" height=\"557\" class=\"aligncenter size-full wp-image-5831\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure5.png\" alt=\"\" \/><\/p>\n<p><em><span class=\"TextRun SCXW213604538 BCX0\" lang=\"EN-US\" xml:lang=\"EN-US\" data-contrast=\"auto\"><span class=\"NormalTextRun SCXW213604538 BCX0\">Fig 5. Lidar processing and controls<\/span><\/span><\/em><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"7985\" height=\"3830\" class=\"aligncenter size-full wp-image-5834\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure6.png\" alt=\"\" \/><\/p>\n<p><em>Fig 6.\u00a0Plot showing cones detected in the\u00a0point cloud\u00a0<\/em><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><b><span data-contrast=\"auto\">Driver controls<\/span><\/b><span data-contrast=\"auto\">:\u00a0\u00a0The driver controller algorithm understands\u00a0the position of the cones in the Lidar Point cloud.\u00a0This algorithm has two objectives:\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<ul>\n<li data-leveltext=\"o\" data-font=\"Courier New\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"2\"><span data-contrast=\"auto\">Identify\u00a0the\u00a0two most significant cones in front of the vehicle\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"o\" data-font=\"Courier New\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"2\"><span data-contrast=\"auto\">Avoid crashing into any of the cones<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><span data-contrast=\"auto\">This is done by finding the two closest cones and calculating the midpoint of those cones. The algorithm\u00a0generates acceleration, steering commands towards this midpoint.\u00a0The algorithm also limits the maximum speed of the vehicle to a pre-set threshold.\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559685&quot;:720,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><b><span data-contrast=\"auto\">Vehicle dynamics\u00a0(Figure 7)<\/span><\/b><span data-contrast=\"auto\">: The vehicle dynamics model consists of a vehicle body, simplified powertrain, driveline, longitudinal wheel, and kinematic steering. The purpose of the model is to\u00a0calculate\u00a0the\u00a0position and orientation of the vehicle based on the steering, acceleration, and deceleration commands. To learn how to simulate longitudinal and lateral vehicle dynamics, refer to this\u00a0<\/span><a href=\"https:\/\/www.youtube.com\/watch?v=WID-MBOIIt8&amp;t\"><span data-contrast=\"none\">video<\/span><\/a><span data-contrast=\"auto\">.\u00a0The\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/help\/vdynblks\/ref\/simulation3dvehiclewithgroundfollowing.html\"><span data-contrast=\"none\">Simulation 3D Vehicle with Ground Following<\/span><\/a><span data-contrast=\"auto\">\u00a0block and the\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/help\/vdynblks\/ref\/simulation3dsceneconfiguration.html\"><span data-contrast=\"none\">Simulation 3D Scene Configuration<\/span><\/a><span data-contrast=\"auto\">\u00a0block\u00a0are\u00a0used for setting up the 3D simulation environment in the\u00a0<\/span><a href=\"https:\/\/www.unrealengine.com\/en-US\/\"><span data-contrast=\"none\">Unreal Engine<\/span><\/a><span data-contrast=\"auto\">.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"560\" height=\"311\" class=\"aligncenter size-full wp-image-5855\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure7.jpg\" alt=\"\" \/><\/p>\n<p><em>Fig\u00a07. Vehicle model\u00a0<\/em><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><b><span data-contrast=\"auto\">Output:\u00a0<\/span><\/b><span data-contrast=\"auto\">Once we run the simulation,\u00a0the\u00a0lidar\u00a0successfully detects the cones.\u00a0Further, the vehicle maps the environment and\u00a0generates\u00a0a\u00a0reference\u00a0trajectory.\u00a0However,\u00a0the vehicle\u00a0moves\u00a0slowly\u00a0at a\u00a0maximum velocity\u00a0of\u00a08 m\/s.\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<h1 aria-level=\"2\"><span data-contrast=\"none\">Lap2: Reference trajectory tracking<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><span data-contrast=\"auto\">In the second lap, the vehicle tracks a reference path obtained from the first lap simulation. Figure\u00a08\u00a0shows the Simulink model. Compared to the last model, in this model, we have removed the lidar block and have added the longitudinal and lateral controllers.<\/span><span data-contrast=\"auto\">\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1755\" height=\"707\" class=\"aligncenter size-full wp-image-5858\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure8.jpg\" alt=\"\" \/><\/p>\n<p><em>Fig\u00a08. Simulink model for\u00a0reference trajectory tracking\u00a0<\/em><\/p>\n<p><span data-contrast=\"auto\">Now, it\u2019s a classical closed-loop\u00a0control\u00a0system problem where the controller\u2019s task is to output\u00a0the\u00a0required steering command, acceleration command, and deceleration command to track the reference path\u00a0with a higher velocity.<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1200\" height=\"317\" class=\"aligncenter size-full wp-image-5837\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure9.png\" alt=\"\" \/><\/p>\n<p><em>Figure 9. Closed-loop block\u00a0diagram for\u00a0the\u00a0second lap\u00a0<\/em><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><b><span data-contrast=\"auto\">Lateral controller<\/span><\/b><span data-contrast=\"auto\">:\u00a0Pure pursuit controller has been used\u00a0for lateral control of the vehicle.\u00a0To implement the controller in Simulink we have used\u00a0a\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/help\/robotics\/ref\/purepursuit.html\"><span data-contrast=\"none\">Pure Pursuit<\/span><\/a><span data-contrast=\"auto\">\u00a0block to measure the\u00a0target direction. Further, the target direction is converted into\u00a0the\u00a0required steering angle using\u00a0wheel steering angle formulation.\u00a0To\u00a0learn more about vehicle path tracking using\u00a0a\u00a0pure pursuit controller,\u00a0please refer to this\u00a0<\/span><a href=\"https:\/\/www.youtube.com\/watch?v=zMdoLO4kRKg&amp;t=0\"><span data-contrast=\"none\">video<\/span><\/a><span data-contrast=\"auto\">.\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1158\" height=\"677\" class=\"aligncenter size-full wp-image-5840\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure10.png\" alt=\"\" \/><\/p>\n<p><em>Figure 10. Pure pursuit controller<\/em><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:2,&quot;335551620&quot;:2,&quot;335559685&quot;:360,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><b><span data-contrast=\"auto\">Longitudinal controller<\/span><\/b><span data-contrast=\"auto\">:\u00a0The\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/help\/vdynblks\/ref\/longitudinaldriver.html\"><span data-contrast=\"none\">Longitudinal\u00a0Driver<\/span><\/a><span data-contrast=\"auto\">\u00a0block is used\u00a0to regulate the speed of the vehicle. Specifically, it is a PI\u00a0controller\u00a0that\u00a0generates the\u00a0actuator signal for the\u00a0reference\u00a0speed.\u00a0<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" width=\"1109\" height=\"404\" class=\"aligncenter size-full wp-image-5843\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure11.png\" alt=\"\" \/><\/p>\n<p><em>Figure\u00a011. Longitudinal driver\u00a0<\/em><\/p>\n<p><span data-contrast=\"auto\">Please note that currently,\u00a0we have\u00a0simplified\u00a0the procedure of developing a speed profile\u00a0by using a\u00a0lookup table to define velocities at different regions. However,\u00a0the\u00a0recommendation would be to use the\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/help\/driving\/ref\/velocityprofiler.html\"><span data-contrast=\"none\">Velocity Profiler<\/span><\/a><span data-contrast=\"auto\">\u00a0block to automate the process of velocity profile generation.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><b><span data-contrast=\"auto\">Result<\/span><\/b><span data-contrast=\"auto\">:\u00a0Figure 12 shows the comparison of the simulated trajectory and the reference trajectory.\u00a0It is evident from the results that the lateral controller successfully tracks the\u00a0reference path.\u00a0In addition to the lateral control action,\u00a0the longitudinal driver\u00a0can\u00a0regulate the desired velocity.<\/span><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p><img decoding=\"async\" loading=\"lazy\" class=\"aligncenter wp-image-5846 size-medium\" src=\"https:\/\/blogs.mathworks.com\/racing-lounge\/files\/2021\/06\/Figure12-300x274.png\" alt=\"\" width=\"300\" height=\"274\" \/><\/p>\n<p><em>Fig 12.\u00a0Vehicle trajectory obtained in\u00a0the\u00a0second lap<\/em><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:2,&quot;335551620&quot;:2,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<h1 aria-level=\"2\"><span data-contrast=\"none\">Summary<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335559738&quot;:40,&quot;335559739&quot;:0,&quot;335559740&quot;:259}\">\u00a0<\/span><\/h1>\n<p><span data-contrast=\"auto\">The\u00a0article showed how MathWorks tools can be used for\u00a0driving a vehicle autonomously on a closed-loop\u00a0track\u00a0in presence of obstacles.\u00a0You can extend this\u00a0approach\u00a0and leverage the examples provided in the\u00a0<\/span><a href=\"https:\/\/www.mathworks.com\/help\/driving\/examples.html\"><span data-contrast=\"none\">documentation<\/span><\/a><span data-contrast=\"auto\">\u00a0to design and simulate your\u00a0autonomous vehicle.\u00a0\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n<p aria-level=\"2\"><strong>Learning Resources:\u00a0<\/strong><\/p>\n<ul>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"1\" data-aria-level=\"1\"><a href=\"https:\/\/www.mathworks.com\/videos\/series\/getting-started-with-roadrunner.html\"><span data-contrast=\"none\">Create scene using RoadRunner<\/span><\/a><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"2\" data-aria-level=\"1\"><a href=\"https:\/\/www.mathworks.com\/help\/driving\/ug\/visualize-depth-semantic-segmentation-3d-simulation.html\"><span data-contrast=\"none\">Depth and Semantic Segmentation Visualization Using Unreal Engine Simulation<\/span><\/a><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"3\" data-aria-level=\"1\"><a href=\"https:\/\/www.mathworks.com\/videos\/series\/autonomous-navigation.html\"><span data-contrast=\"none\">Autonomous Navigation<\/span><\/a><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"4\" data-aria-level=\"1\"><a href=\"https:\/\/www.mathworks.com\/videos\/vehicle-path-tracking-using-pure-pursuit-controller-1595330917925.html\"><span data-contrast=\"none\">Vehicle Path Tracking Using Pure Pursuit Controller<\/span><\/a><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<li data-leveltext=\"\uf0b7\" data-font=\"Symbol\" data-listid=\"7\" aria-setsize=\"-1\" data-aria-posinset=\"5\" data-aria-level=\"1\"><a href=\"https:\/\/www.mathworks.com\/help\/ros\/ug\/ros-automated-valet.html\"><span data-contrast=\"none\">Automated Parking Valet with ROS in MATLAB<\/span><\/a><span data-ccp-props=\"{&quot;134233279&quot;:true,&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/li>\n<\/ul>\n<p aria-level=\"2\"><strong>Contact Us\u00a0<\/strong><\/p>\n<p><span data-contrast=\"auto\">Please feel free to reach out\u00a0to us\u00a0at\u00a0<\/span><a href=\"mailto:racinglounge@mathworks.com\"><span data-contrast=\"none\">racinglounge@mathworks.com<\/span><\/a><span data-contrast=\"auto\">\u00a0in case of any queries. Also, join our MATLAB and Simulink Racing Lounge\u00a0<\/span><a href=\"https:\/\/www.facebook.com\/groups\/racinglounge\/\"><span data-contrast=\"none\">Facebook<\/span><\/a><span data-contrast=\"auto\">\u00a0group for\u00a0the\u00a0latest technical articles, videos, and\u00a0upcoming live sessions.\u00a0<\/span><span data-ccp-props=\"{&quot;201341983&quot;:0,&quot;335551550&quot;:6,&quot;335551620&quot;:6,&quot;335559739&quot;:160,&quot;335559740&quot;:259}\">\u00a0<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<div class=\"overview-image\"><img src=\"https:\/\/blogs.mathworks.com\/student-lounge\/files\/2021\/06\/GIF.gif\" class=\"img-responsive attachment-post-thumbnail size-post-thumbnail wp-post-image\" alt=\"\" decoding=\"async\" loading=\"lazy\" \/><\/div>\n<p>Today\u2019s blog post is written by Veer Alakshendra, Education Technical Evangelist on the Student Competition team at MathWorks.<br \/>\nWith\u00a0advancements in the automotive industry, various student&#8230; <a class=\"read-more\" href=\"https:\/\/blogs.mathworks.com\/student-lounge\/2021\/06\/22\/driving-an-autonomous-vehicle-on-a-track-with-recorded-synthetic-data\/\">read more >><\/a><\/p>\n","protected":false},"author":174,"featured_media":5819,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[287],"tags":[177,512,515,518,355],"_links":{"self":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/5849"}],"collection":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/users\/174"}],"replies":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/comments?post=5849"}],"version-history":[{"count":5,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/5849\/revisions"}],"predecessor-version":[{"id":5882,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/posts\/5849\/revisions\/5882"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media\/5819"}],"wp:attachment":[{"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/media?parent=5849"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/categories?post=5849"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogs.mathworks.com\/student-lounge\/wp-json\/wp\/v2\/tags?post=5849"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}