How to add a "robotPlatform" with cylindrical body mesh to a "robotScenario" object in MATLAB R2025a?

4 visualizaciones (últimos 30 días)
I want to add a "robotPlatform" whose body mesh is cylindrical to my "robotScenario" object in MATLAB R2025a. However, the "robotPlatform" function doesn't allow specifying the body mesh type via a name-value argument, and the generated platform uses a "cuboid" body mesh.
How can I set or change the body mesh type to a "cylinder"?

Respuesta aceptada

MathWorks Support Team
MathWorks Support Team el 24 de Sept. de 2025
Editada: MathWorks Support Team el 24 de Sept. de 2025
By default, the robotPlatform object uses a cuboid body mesh. You can update the body mesh using the updateMesh function. However, this function does not provide a built-in option for a cylindrical mesh. The available options are: "Cuboid", "GroundVehicle", "RigidBodyTree", or "Custom". 
To generate a platform with cylindrical mesh, set the "type" input argument to "Custom" in the "updateMesh" function and specify appropriate values for "Faces" and "Vertices" name-value arguments. You can use the extendedObjectMesh function to generate the "Faces" and "Vertices" values corresponding to a cylinder.
For guidance, refer to the example below:
% Create a Robot Scenario
scenario = robotScenario(UpdateRate=1,StopTime=10);
% Add the ground plane as static mesh
addMesh(scenario,"Plane",Size=[3 3],Color=[0.7 0.7 0.7]);
% Create a cylinder mesh with n equally spaced vertices around its circumference
n = 100;
mesh = extendedObjectMesh('cylinder', n);
mesh = scale(mesh,[0.2,0.2,0.2]); % scale mesh in each dimension
% Create a robot platform with a cylinder mesh
platform2 = robotPlatform("Cylinder",scenario,BaseTrajectory=traj);
updateMesh(platform2,"Custom",Position=[1 1 0.5],Faces=mesh.Faces,Vertices=mesh.Vertices)
% Visualize the scenario
[ax,plotFrames] = show3D(scenario);
axis equal
Note that if you only need a static cylindrical object (not a moving platform), you can add it directly to the robotScenario object using the addMesh function. 

Más respuestas (0)

Productos


Versión

R2025a

Community Treasure Hunt

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

Start Hunting!

Translated by