Help CenterHelp Center
Mesh representation of car in driving scenario
mesh = driving.scenario.carMesh
example
mesh= driving.scenario.carMeshcreates a mesh representation of a car as anextendedObjectMeshobject,mesh.
mesh= driving.scenario.carMesh
mesh
extendedObjectMesh
collapse all
Add the prebuilt car mesh to a driving scenario. Then, uselidarPointCloudGeneratorSystem object™ to generate a point cloud of the car mesh.
lidarPointCloudGenerator
Create and show the prebuilt car mesh.
mesh = driving.scenario.carMesh; show(mesh);
Create a driving scenario.
s = drivingScenario;
Add a straight road to the driving scenario. The road has one lane in each direction.
road(s,[0 0 0; 25 0 0],'Lanes',lanespec([1 1]));
Add a car as an ego vehicle and as a non-ego actor.
egoVehicle = vehicle(s,'ClassID',1,'Mesh',mesh); smoothTrajectory(egoVehicle,[1 -2 0; 21.3 -2 0],20); car = vehicle(s,'Position',[15 2 0],'Yaw',180,'ClassID',1,'Mesh',mesh);
Plot the driving scenario. Set name-value pair'Meshes','on'to show the meshes of the actors in the plot.
'Meshes','on'
plot(s,'Meshes','on');
Create alidarPointCloudGeneratorSystem object. Set the actor profiles of the System object to those in the driving scenario.
lidar = lidarPointCloudGenerator; lidar.ActorProfiles = actorProfiles(s);
Generate a lidar point cloud of the driving scenario.
player = pcplayer([-20 20],[-10 10],[0 4]);whileadvance(s) tgts = targetPoses(egoVehicle); rdmesh = roadMesh(egoVehicle); [ptCloud,isValidTime] = lidar(tgts,rdmesh,s.SimulationTime);ifisValidTime view(player,ptCloud);endend
Mesh representation of car, returned as anextendedObjectMesh对象。mes的起源h is located at its geometric center.
You can develop your own meshes by using this prebuilt car mesh as a starting point. At the MATLAB®command line, enter:
edit driving.scenario.carMesh
driving.scenario.bicycleMesh
driving.scenario.pedestrianMesh
driving.scenario.truckMesh
translate
rotate
scale
applyTransform
join
scaleToFit
show
You have a modified version of this example. Do you want to open this example with your edits?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office