classdef CHOMPDiagnosticLogger
%CHOMPDiagnosticLogger Output diagnostic information in manipulatorCHOMP/optimize

% Copyright 2022 The MathWorks, Inc.

%#codegen
    properties(SetAccess=immutable)
        %VerbosityLevel Indicating how verbose the diagnostic should be
        VerbosityLevel
    end

    methods
        function obj=CHOMPDiagnosticLogger(verbositylevel)
        %constructor
            obj.VerbosityLevel=verbositylevel;
        end

        function logDiagnostic(obj,iter,objectivefcn,smoothcost,collisioncost)
        %logDiagnostic Log the diagnostic
            switch obj.VerbosityLevel
              case 'concise'
                fprintf('Iter: %d ObjectiveFunction: %d\n',iter,objectivefcn)
              case 'detailed'
                fprintf(...
                    'Iter: %d ObjectiveFunction: %d SmoothnessCost: %d CollisionCost: %d\n', ...
                    iter,objectivefcn,smoothcost,collisioncost)
              otherwise;
            end
        end
    end
end
