I cant upload my function to jetson nano because it's not supported, how to fix it ? note : that the problem in the function is in (inputParser).
    3 visualizaciones (últimos 30 días)
  
       Mostrar comentarios más antiguos
    
function scan = pc2scannn(ptCloudIn, varargin)
    narginchk(1, 10);
    % Validate inputs
    [tform, scanAngleLimits, scanRangeLimits, elevationAngleTolerance, ...
        scanAngleResolution] = parseAndValidateInputs(ptCloudIn, varargin{:});
    % Remove invalid points from the point cloud
    ptCloudIn = removeInvalidPoints(ptCloudIn);
    if ~isequal(tform.T, eye(4, 'like', tform.T))
        % Transform the point cloud to 2-D lidar sensor coordinate system in
        % case of non-identity transform
        ptCloudIn = pctransform(ptCloudIn, invert(tform));
    end
    % Convert the point cloud to lidar scan
    scan = pointCloudToScan(ptCloudIn, scanAngleLimits, scanRangeLimits, ...
        elevationAngleTolerance, scanAngleResolution);
end
%--------------------------------------------------------------------------
function [tform, scanAngleLimits, scanRangeLimits, elevationAngleTolerance, ...
    scanAngleResolution] = parseAndValidateInputs(ptCloudIn, varargin)
    validateattributes(ptCloudIn, {'pointCloud'}, {'scalar'}, mfilename, ...
        'ptCloudIn', 1);
    p = inputParser;
    % Set default values
    defaultValues = getDefaultOptionalInputs();
    addOptional(p, 'tform', defaultValues.Tform, @checkTform);
    addParameter(p, 'ElevationAngleTolerance', ...
        defaultValues.ElevationAngleTolerance, @checkElevationAngleTolerance);
    addParameter(p, 'ScanAngleResolution', ...
        defaultValues.ScanAngleResolution, @checkScanAngleResolution);
    addParameter(p, 'ScanAngleLimits', ...
        defaultValues.ScanAngleLimits, @checkScanAngleLimits);
    addParameter(p, 'ScanRangeLimits', ...
        defaultValues.ScanRangeLimits, @checkScanRangeLimits);
    % Parse input
    parse(p, varargin{:});
    tform = p.Results.tform;
    elevationAngleTolerance = cast(p.Results.ElevationAngleTolerance, ...
        'like', ptCloudIn.Location);
    scanAngleResolution = cast(p.Results.ScanAngleResolution, ...
        'like', ptCloudIn.Location);
    scanAngleLimits = cast(p.Results.ScanAngleLimits, ...
        'like', ptCloudIn.Location);
    scanRangeLimits = cast(p.Results.ScanRangeLimits, ...
        'like', ptCloudIn.Location);
    if diff(scanAngleLimits) < scanAngleResolution
        error(message('lidar:pc2scan:invalidInput'));
    end
    if isscalar(elevationAngleTolerance)
        elevationAngleTolerance = [-elevationAngleTolerance elevationAngleTolerance];
    end
end
0 comentarios
Respuestas (1)
  Vinayak
      
 el 5 de En. de 2024
        Hi Aly, 
Code generation is not supported for the “inputParser”  in MATLAB Coder or GPU Coder. You may consider creating your own parser. As you are already having check functions, you can call them in a switch-case or if-else before other checks. 
The sample code that can achieve something similar is: 
for i = 1:2:length(varargin) 
    paramName = varargin{i}; 
    paramValue = varargin{i+1}; 
    switch lower(paramName) 
        case 'tform' 
            checkTform(paramValue); 
            tform = paramValue; 
        case 'elevationangletolerance' 
            checkElevationAngleTolerance(paramValue); 
            elevationAngleTolerance = cast(paramValue, 'like', ptCloudIn.Location); 
        case 'scanangleresolution' 
            checkScanAngleResolution(paramValue); 
            scanAngleResolution = cast(paramValue, 'like', ptCloudIn.Location); 
        case 'scananglelimits' 
            checkScanAngleLimits(paramValue); 
            scanAngleLimits = cast(paramValue, 'like', ptCloudIn.Location); 
        case 'scanrangelimits' 
            checkScanRangeLimits(paramValue); 
            scanRangeLimits = cast(paramValue, 'like', ptCloudIn.Location); 
        otherwise 
            error('Unknown parameter name: %s', paramName); 
    end 
end 
0 comentarios
Ver también
Categorías
				Más información sobre Get Started with GPU Coder en Help Center y File Exchange.
			
	Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

