function exportrobot(robot, varargin)
%

%   Copyright 2023 The MathWorks, Inc.

    p = inputParser;
    addParameter(p, "OutputFileName", [], @(x) validateattributes(convertStringsToChars(x),["char", "string"], ["scalartext","nonempty"], "exportrobot", "OutputFileName"));
    addParameter(p, "RobotName", "Robot", @(x) validateattributes(convertStringsToChars(x),["char", "string"], ["scalartext","nonempty"], "exportrobot", "RobotName"));
    addParameter(p, "ExportMesh", false, @(x) validateattributes(x, ["logical", "numeric"], ["scalar", "binary"], "exportrobot", "ExportMesh"));
    addParameter(p, "AbsoluteTolerance", sqrt(eps), @(x) validateattributes(x, "numeric", ["nonempty", "finite", "nonnan", "real", "positive", "scalar"], "exportrobot", "AbsoluteTolerance"));
    addParameter(p, "VisualMeshFileLocation", "", @(x) validateattributes(convertStringsToChars(x),["char", "string"], ["scalartext","nonempty"], "exportrobot", "VisualMeshFileLocation"));
    addParameter(p, "CollisionMeshFileLocation", "", @(x) validateattributes(convertStringsToChars(x),["char", "string"], ["scalartext","nonempty"], "exportrobot", "CollisionMeshFileLocation"));
    parse(p,varargin{:});

    if isempty(p.Results.OutputFileName)
        outputFileName = robotics.manip.internal.exportRobot.utils.getOutputFileName(inputname(1));
    else
        outputFileName = p.Results.OutputFileName;
    end

    % Create urdfExporter object
    exporter = urdfExporter(robot);

    % Initialize properties
    exporter.OutputFileName = outputFileName;
    exporter.RobotName = p.Results.RobotName;
    exporter.ExportMesh = p.Results.ExportMesh;
    exporter.AbsoluteTolerance = p.Results.AbsoluteTolerance;
    exporter.VisualMeshFileLocation = p.Results.VisualMeshFileLocation;
    exporter.CollisionMeshFileLocation = p.Results.CollisionMeshFileLocation;

    % Generate URDF
    exporter.writefile();

end
