Skip to content

Commit

Permalink
SPOT 4.1.0 Pre-Release 1
Browse files Browse the repository at this point in the history
- See SPOT_Software_Version_4_1_Patch_Notes.pdf under Template_Files for a detailed breakdown of the changes in this version.
  • Loading branch information
TheElectricDream committed Sep 21, 2024
1 parent a0545a9 commit 3f725b1
Show file tree
Hide file tree
Showing 137 changed files with 1,105,668 additions and 92 deletions.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void initialize_dynamixel()

dxl_comm_result = packetHandler->write1ByteTxRx(portHandler, 3, ADDR_MX_OPERATING_MODE, 3, &dxl_error);
dxl_comm_result = packetHandler->write1ByteTxRx(portHandler, 3, ADDR_MX_DRIVE_MODE, 4, &dxl_error); // Velocity_profile yields the time required to reach goal position
dxl_comm_result = packetHandler->write2ByteTxRx(portHandler, 3, ADDR_MX_POSITION_P_GAIN, POSITION_P_GAIN, &dxl_error);
dxl_comm_result = packetHandler->write2ByteTxRx(portHandler, 3, ADDR_MX_POSITION_P_GAIN, POSITION_P_GAIN, &dxl_error); // Manually set to 800 for the combined experiment!!!
dxl_comm_result = packetHandler->write2ByteTxRx(portHandler, 3, ADDR_MX_POSITION_I_GAIN, POSITION_I_GAIN, &dxl_error);
dxl_comm_result = packetHandler->write2ByteTxRx(portHandler, 3, ADDR_MX_POSITION_D_GAIN, POSITION_D_GAIN, &dxl_error);
dxl_comm_result = packetHandler->write4ByteTxRx(portHandler, 3, ADDR_MX_MAX_POSITION, MAX_POSITION, &dxl_error);
Expand Down
16 changes: 8 additions & 8 deletions Custom_Library/NVIDIA_Jetson/GPIO_Write.m
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,14 @@ function validateInputsImpl(~, u)
['This block allows you to control the GPIO pins on the NVIDIA Jetson Xavier NX Development board.' ...
' It is important to be aware that the pin numbers needed for this block do not correspond to the pin numbers used in most'...
' online resources. Here is the list of pin numbers and what they control:' newline newline ...
'445: Thruster #1' newline...
'480: Thruster #2' newline...
'268: Thruster #3' newline...
'436: Thruster #4' newline...
'483: Thruster #5' newline...
'493: Thruster #6' newline...
'492: Thruster #7' newline...
'481: Thruster #8' newline...
'436: Thruster #1' newline...
'445: Thruster #2' newline...
'480: Thruster #3' newline...
'268: Thruster #4' newline...
'484: Thruster #5' newline...
'483: Thruster #6' newline...
'481: Thruster #7' newline...
'491: Thruster #8' newline...
'428: Pucks' newline newline ...
'For a complete list of all GPIO pin numbers available and their alternate functions, refer to this online resource:' newline newline ...
'https://jetsonhacks.com/nvidia-jetson-xavier-nx-gpio-header-pinout/']);
Expand Down
204 changes: 204 additions & 0 deletions Custom_Library/Phasespace Cameras/PhaseSpace_ALL.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,204 @@
classdef PhaseSpace_ALL < realtime.internal.SourceSampleTime ...
& coder.ExternalDependency ...
& matlab.system.mixin.Propagates ...
& matlab.system.mixin.CustomIcon
%
% System object template for a source block.
%
% This template includes most, but not all, possible properties,
% attributes, and methods that you can implement for a System object in
% Simulink.
%
% NOTE: When renaming the class name Source, the file name and
% constructor name must be updated to use the class name.
%

% Copyright 2016 The MathWorks, Inc.
%#codegen
%#ok<*EMCA>

properties
% Platform Selection
platformSelection = 3;
sampleRate = 0.1;
end

properties (Nontunable)
% Public, non-tunable properties.
end

properties (Access = private)
% Pre-computed constants.
end

methods
% Constructor
function obj = PhaseSpace_ALL(varargin)
% Support name-value pair arguments when constructing the object.
setProperties(obj,nargin,varargin{:});
end
end


methods (Access=protected)
function setupImpl(obj)
if isempty(coder.target)
% Place simulation setup code here
else
% Call C-function implementing device initialization
coder.cinclude('owl.hpp');
coder.cinclude('phasespace_headers.h');
coder.ceval('initialize_phasespace',obj.platformSelection, obj.sampleRate);
end
end

function y = stepImpl(obj)

y1 = double(0);
y2 = double(0);
y3 = double(0);
y4 = double(0);
y5 = double(0);
y6 = double(0);
y7 = double(0);
y8 = double(0);
y9 = double(0);
y10 = double(0);
y11 = double(0);
y12 = double(0);

y = zeros(1,12,'double');

if isempty(coder.target)
% Place simulation output code here
else

coder.ceval('stream_phasespace',coder.ref(y1),...
coder.ref(y2),coder.ref(y3),coder.ref(y4),...
coder.ref(y5),coder.ref(y6),coder.ref(y7),...
coder.ref(y8),coder.ref(y9),coder.ref(y10),...
coder.ref(y11),coder.ref(y12),obj.platformSelection);
y =[y1/1000, y2/1000, y3, y4/15, y5/1000, y6,...
y7/1000, y8/1000, y9/1000, y10/1000, y11/1000, y12/1000];

end
end

function releaseImpl(obj) %#ok<MANU>
if isempty(coder.target)
% Place simulation termination code here
else
% Call C-function implementing device termination
coder.ceval('terminate_phasespace');
end
end
end

methods (Access=protected)
%% Define output properties
function num = getNumInputsImpl(~)
num = 0;
end

function num = getNumOutputsImpl(~)
num = 1;
end

function flag = isOutputSizeLockedImpl(~,~)
flag = true;
end

function varargout = isOutputFixedSizeImpl(~,~)
varargout{1} = true;
end

function flag = isOutputComplexityLockedImpl(~,~)
flag = true;
end

function varargout = isOutputComplexImpl(~)
varargout{1} = false;
end

function varargout = getOutputSizeImpl(~)
varargout{1} = [1,12];
end

function varargout = getOutputDataTypeImpl(~)
varargout{1} = 'double';
end

function icon = getIconImpl(~)
% Define a string as the icon for the System block in Simulink.
icon = 'Stream_PS_ALL';
end
end

methods (Static, Access=protected)
function simMode = getSimulateUsingImpl(~)
simMode = 'Interpreted execution';
end

function isVisible = showSimulateUsingImpl
isVisible = false;
end

function header = getHeaderImpl
header = matlab.system.display.Header('PhaseSpace_ALL','Title',...
'Initialize and Stream PhaseSpace','Text',...
['This simulink block initializes the PhaseSpace cameras to '...
'collect position data. The sample time should be '...
'set to 0.1 seconds. The output of this block is a [1x12] vector '...
'containing the position in [m] and the attitude in [rad].' newline]);
end

end

methods (Static)
function name = getDescriptiveName()
name = 'Stream_PS_ALL';
end

function b = isSupportedContext(context)
b = context.isCodeGenTarget('rtw');
end

function updateBuildInfo(buildInfo, context)
if context.isCodeGenTarget('rtw')
% Update buildInfo
srcDir = fullfile(fileparts(mfilename('fullpath')),'src');
includeDir = fullfile(fileparts(mfilename('fullpath')),'include');
addIncludePaths(buildInfo,includeDir);

% Add the INCLUDE files for the PhaseSpace camera
addIncludeFiles(buildInfo,'vector.h',includeDir);
addIncludeFiles(buildInfo,'thread.h',includeDir);
addIncludeFiles(buildInfo,'socket.h',includeDir);
addIncludeFiles(buildInfo,'serialize.h',includeDir);
addIncludeFiles(buildInfo,'protocol.h',includeDir);
addIncludeFiles(buildInfo,'packet.h',includeDir);
addIncludeFiles(buildInfo,'owl_rpd.h',includeDir);
addIncludeFiles(buildInfo,'owl_math.h',includeDir);
addIncludeFiles(buildInfo,'owl.h',includeDir);
addIncludeFiles(buildInfo,'libowl.h',includeDir);
addIncludeFiles(buildInfo,'owl_rpd.hpp',includeDir);
addIncludeFiles(buildInfo,'owl.hpp',includeDir);
addIncludeFiles(buildInfo,'phasespace_headers.h',includeDir);

% Add the SOURCE files for the PhaseSpace camera
addSourceFiles(buildInfo,'socket.cpp',srcDir);
addSourceFiles(buildInfo,'owl_rpd.cpp',srcDir);
addSourceFiles(buildInfo,'owl.cpp',srcDir);
addSourceFiles(buildInfo,'libowl_socket.cpp',srcDir);
addSourceFiles(buildInfo,'libowl.cpp',srcDir);
addSourceFiles(buildInfo,'filters.cpp',srcDir);
addSourceFiles(buildInfo,'phasespace_functions.cpp',srcDir);

%addLinkFlags(buildInfo,{'-lSource'});
%addLinkObjects(buildInfo,'sourcelib.a',srcDir);
%addCompileFlags(buildInfo,{'-D_DEBUG=1'});
%addDefines(buildInfo,'MY_DEFINE_1')
end
end
end
end
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 3f725b1

Please sign in to comment.