Code covered by the BSD License
- simiamA MATLAB-based educational bridge between theory and pratice in robotics.
- GetArg(S, Name, Default)
- ParseArgs(Args, varargin)
Check input arguments
- findjobj(container,vararg...findjobj Find java objects contained within a specified java container or Matlab GUI handle
- launch()Copyright (C) 2013 Georgia Tech Research Corporation
- CellPropsHelper class for GridLayout
- GridLayoutMain layout-manager class
- mcodekit.list.dl_listCopyright (C) 2012 Jean-Pierre de la Croix
- mcodekit.list.dl_list_ite...Copyright (C) 2012 Jean-Pierre de la Croix
- mcodekit.list.dl_list_nodeCopyright (C) 2012 Jean-Pierre de la Croix
- simiam.app.ControlAppCopyright (C) 2013, Georgia Tech Research Corporation
- simiam.controller.AOandGTGCopyright (C) 2013, Georgia Tech Research Corporation
- simiam.controller.AvoidOb...Copyright (C) 2013, Georgia Tech Research Corporation
- simiam.controller.ControllerCONTROLLER is a template for all user-defined controllers.
- simiam.controller.FollowWallCopyright (C) 2013, Georgia Tech Research Corporation
- simiam.controller.GoToAngleGOTOANGLE steers the robot towards a angle with a constant velocity using PID
- simiam.controller.GoToGoalGOTOGOAL steers the robot towards a goal with a constant velocity using PID
- simiam.controller.Sliding...Copyright (C) 2013, Georgia Tech Research Corporation
- simiam.controller.Stop
- simiam.controller.SupervisorSUPERVISOR switches between controllers and handles their inputs/outputs.
- simiam.controller.khepera...SUPERVISOR switches between controllers and handles their inputs/outputs.
- simiam.robot.Khepera3Copyright (C) 2013, Georgia Tech Research Corporation
- simiam.robot.RobotCopyright (C) 2013, Georgia Tech Research Corporation
- simiam.robot.dynamics.Dif...Copyright (C) 2013, Georgia Tech Research Corporation
- simiam.robot.dynamics.Dyn...Copyright (C) 2013, Georgia Tech Research Corporation
- simiam.robot.sensor.Proxi...Copyright (C) 2013, Georgia Tech Research Corporation
- simiam.robot.sensor.Wheel...Copyright (C) 2013, Georgia Tech Research Corporation
- simiam.simulator.ObstacleCopyright (C) 2013, Georgia Tech Research Corporation
- simiam.simulator.PhysicsCopyright (C) 2013, Georgia Tech Research Corporation
- simiam.simulator.SimulatorSIMULATOR is responsible for stepping the program through the simulation.
- simiam.simulator.WorldCopyright (C) 2013, Georgia Tech Research Corporation
- simiam.ui.AppWindowCopyright (C) 2013, Georgia Tech Research Corporation
- simiam.ui.DrawableCopyright (C) 2013, Georgia Tech Research Corporation
- simiam.ui.Pose2DCopyright (C) 2013, Georgia Tech Research Corporation
- simiam.ui.Surface2DCopyright (C) 2013, Georgia Tech Research Corporation
- simiam.util.PlotterPLOTTER supports plotting data in 2D with a reference signal.
-
View all files
from
Sim.I.am
by Jean-Pierre de la Croix
A MATLAB-based educational bridge between theory and practice in robotics.
|
| ParseArgs(Args, varargin)
|
function varargout = ParseArgs(Args, varargin)
% Check input arguments
assert(nargin >= 2, ...
'Function takes at least two arguments.');
assert(nargout == nargin-1, ...
'Number of output arguments must be equal with the number of input arguments minus 1.');
assert(iscell(Args) && (isempty(Args) || isvector(Args)), ...
'Args must be a cell vector.');
for i = 1:length(varargin)
assert(iscellstr(varargin{i}) && isvector(varargin{i}), ...
'All input arguments except the first one must be cell vectors of strings.');
end
% Convert Args to structure
if numel(Args) == 1
if isstruct(Args{1})
ArgStruct = Args{1};
else
error('If Args has only one element, that element must be a structure.');
end
else
ArgStruct = NameValue2Struct(Args{:});
end
% Make a cell array with all names in varargin
NumNames = sum(cellfun(@length,varargin));
AllNames = cell([1 NumNames]);
k = 0;
for i = 1:length(varargin)
for j = 1:length(varargin{i})
k = k + 1;
AllNames{k} = varargin{i}{j};
end
end
assert(k == NumNames);
% Check if Args contains only arguments with names that are not among those in varargin
ArgNames = fieldnames(ArgStruct);
for i = 1:length(ArgNames)
if ~any(strcmp(ArgNames{i},AllNames))
error('Unknown parameter: ''%s''',ArgNames{i});
end
end
% Create output structures
for i = 1:nargout
ParamStruct = struct();
for j = 1:length(varargin{i})
ParamName = varargin{i}{j};
if isfield(ArgStruct,ParamName)
ParamStruct.(ParamName) = ArgStruct.(ParamName);
else
ParamStruct.(ParamName) = [];
end
end
varargout{i} = ParamStruct;
end
function Struct = NameValue2Struct(varargin)
for n = 2:2:nargin
if iscell(varargin{n})
% Put cell arrays in another cell array so that we don't get a
% structure vector after the conversion
varargin{n} = {varargin{n}};
end
end
Struct = struct(varargin{:});
end
end
|
|
Contact us