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).
조회 수: 1 (최근 30일)
이전 댓글 표시
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
답변 (1개)
Vinayak
2024년 1월 5일
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
참고 항목
카테고리
Help Center 및 File Exchange에서 Convert Image Type에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!