Skip to content

Commit

Permalink
Initial commit R2024b
Browse files Browse the repository at this point in the history
  • Loading branch information
smiller01985 committed Jan 4, 2025
1 parent f0ab154 commit 104146b
Show file tree
Hide file tree
Showing 47 changed files with 80 additions and 28 deletions.
Binary file modified Libraries/mars_rover_lib.slx
Binary file not shown.
Binary file modified Models/mars_rover_terrain.slx
Binary file not shown.
Binary file modified Models/mars_rover_test_harness_chassis.slx
Binary file not shown.
8 changes: 4 additions & 4 deletions Overview/html/mars_rover_terrain.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
To make changes, update the MATLAB code and republish this document.
-->
<title>Mars Rover on Uneven Terrain</title>
<meta name="generator" content="MATLAB 24.1">
<meta name="generator" content="MATLAB 24.2">
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
<meta name="DC.date" content="2024-03-21">
<meta name="DC.date" content="2024-09-12">
<meta name="DC.source" content="mars_rover_terrain.m">
<style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
Expand Down Expand Up @@ -142,8 +142,8 @@ <h2 id="1">Model</h2>
<p>This shows the results for path 2 where the rover is driven with an ideal torque sources on flat terrain. To simplify the test, we put the rover on flat ground, but follow the same x-y trajectory as the previous test. We can see the difference in wheel torques.</p>
<img vspace="5" hspace="5" src="mars_rover_terrain_11.png" alt=""> <img vspace="5" hspace="5" src="mars_rover_terrain_12.png" alt=""> <img vspace="5" hspace="5" src="mars_rover_terrain_13.png" alt=""> <h2 id="9">Simulation Results from Simscape Logging: Path 2 Electrical</h2>
<p>The model is configured to model the electrical system of the powertrain, including 6 motors for propulsion and 4 motors for steering. The results of the simulation include the current drawn by the motors as it follows path 2.</p>
<img vspace="5" hspace="5" src="mars_rover_terrain_14.png" alt=""> <img vspace="5" hspace="5" src="mars_rover_terrain_15.png" alt=""> <img vspace="5" hspace="5" src="mars_rover_terrain_16.png" alt=""> <img vspace="5" hspace="5" src="mars_rover_terrain_17.png" alt=""> <p class="footer">Copyright 2021-2024 The MathWorks, Inc.<br>
<a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2024a</a>
<img vspace="5" hspace="5" src="mars_rover_terrain_14.png" alt=""> <img vspace="5" hspace="5" src="mars_rover_terrain_15.png" alt=""> <img vspace="5" hspace="5" src="mars_rover_terrain_16.png" alt=""> <img vspace="5" hspace="5" src="mars_rover_terrain_17.png" alt=""> <img vspace="5" hspace="5" src="mars_rover_terrain_18.png" alt=""> <img vspace="5" hspace="5" src="mars_rover_terrain_19.png" alt=""> <p class="footer">Copyright 2021-2024 The MathWorks, Inc.<br>
<a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2024b</a>
<br>
</p>
</div>
Expand Down
Binary file modified Overview/html/mars_rover_terrain.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_14.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_15.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Overview/html/mars_rover_terrain_17.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added Overview/html/mars_rover_terrain_18.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions Scripts_Data/Parameters/mars_rover_params_chassis.m
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
Rover.Powertrain.Steer.Motor.efficiency = 25/30*100; % percent
Rover.Powertrain.Steer.Motor.eff_meas_spd = 5000; % rpm
Rover.Powertrain.Steer.Motor.eff_meas_trq = 300; % N*m
Rover.Powertrain.Steer.Motor.damping = 1e-6; % (N*m/(rad/s))
Rover.Powertrain.Steer.Motor.damping = 1.5e-2; % (N*m/(rad/s))
Rover.Powertrain.Steer.Motor.gear_ratio = 243;

Rover.Powertrain.Drive.Motor.max_torque = 500; % N*m
Expand All @@ -203,7 +203,7 @@
Rover.Powertrain.Drive.Motor.efficiency = 25/30*100; % percent
Rover.Powertrain.Drive.Motor.eff_meas_spd = 5000; % rpm
Rover.Powertrain.Drive.Motor.eff_meas_trq = 300; % N*m
Rover.Powertrain.Drive.Motor.damping = 1e-6; % (N*m/(rad/s))
Rover.Powertrain.Drive.Motor.damping = 1.5e-2; % (N*m/(rad/s))
Rover.Powertrain.Drive.Motor.gear_ratio = 243;


Expand Down
70 changes: 57 additions & 13 deletions Scripts_Data/Plots/mars_rover_terrain_plot4_motorspdcurr.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,29 @@

RoverBus = logsout_mars_rover_terrain.get('RoverBus');
simlog_t = RoverBus.Values.Chassis.Powertrain.Drive.w.L1.Time;
simlog_wL1 = RoverBus.Values.Chassis.Powertrain.Drive.w.L1.Data*30/pi;
simlog_wL2 = RoverBus.Values.Chassis.Powertrain.Drive.w.L2.Data*30/pi;
simlog_wL3 = RoverBus.Values.Chassis.Powertrain.Drive.w.L3.Data*30/pi;
simlog_wR1 = RoverBus.Values.Chassis.Powertrain.Drive.w.R1.Data*30/pi;
simlog_wR2 = RoverBus.Values.Chassis.Powertrain.Drive.w.R2.Data*30/pi;
simlog_wR3 = RoverBus.Values.Chassis.Powertrain.Drive.w.R3.Data*30/pi;
simlog_wL1 = RoverBus.Values.Chassis.Powertrain.Drive.w.L1.Data;
simlog_wL2 = RoverBus.Values.Chassis.Powertrain.Drive.w.L2.Data;
simlog_wL3 = RoverBus.Values.Chassis.Powertrain.Drive.w.L3.Data;
simlog_wR1 = RoverBus.Values.Chassis.Powertrain.Drive.w.R1.Data;
simlog_wR2 = RoverBus.Values.Chassis.Powertrain.Drive.w.R2.Data;
simlog_wR3 = RoverBus.Values.Chassis.Powertrain.Drive.w.R3.Data;
simlog_wLS1 = RoverBus.Values.Chassis.Powertrain.Steer.w.L1.Data;
simlog_wLS3 = RoverBus.Values.Chassis.Powertrain.Steer.w.L3.Data;
simlog_wRS1 = RoverBus.Values.Chassis.Powertrain.Steer.w.R1.Data;
simlog_wRS3 = RoverBus.Values.Chassis.Powertrain.Steer.w.R3.Data;

CtrlBus = logsout_mars_rover_terrain.get('CtrlBus');
simlog_trqL1 = CtrlBus.Values.Chassis.Drive.trq.L1.Data/Rover.Powertrain.Drive.Motor.gear_ratio;
simlog_trqL2 = CtrlBus.Values.Chassis.Drive.trq.L2.Data/Rover.Powertrain.Drive.Motor.gear_ratio;
simlog_trqL3 = CtrlBus.Values.Chassis.Drive.trq.L3.Data/Rover.Powertrain.Drive.Motor.gear_ratio;
simlog_trqR1 = CtrlBus.Values.Chassis.Drive.trq.R1.Data/Rover.Powertrain.Drive.Motor.gear_ratio;
simlog_trqR2 = CtrlBus.Values.Chassis.Drive.trq.R2.Data/Rover.Powertrain.Drive.Motor.gear_ratio;
simlog_trqR3 = CtrlBus.Values.Chassis.Drive.trq.R3.Data/Rover.Powertrain.Drive.Motor.gear_ratio;
simlog_trqLS1 = CtrlBus.Values.Chassis.Steer.trq.L1.Data/Rover.Powertrain.Steer.Motor.gear_ratio;
simlog_trqLS3 = CtrlBus.Values.Chassis.Steer.trq.L3.Data/Rover.Powertrain.Steer.Motor.gear_ratio;
simlog_trqRS1 = CtrlBus.Values.Chassis.Steer.trq.R1.Data/Rover.Powertrain.Steer.Motor.gear_ratio;
simlog_trqRS3 = CtrlBus.Values.Chassis.Steer.trq.R3.Data/Rover.Powertrain.Steer.Motor.gear_ratio;


if(isfield(RoverBus.Values.Chassis.Powertrain.Drive,'i'))
simlog_iL1 = RoverBus.Values.Chassis.Powertrain.Drive.i.L1.Data;
Expand All @@ -47,13 +64,13 @@
end

ah(1) = subplot(211);
plot(simlog_t, simlog_wL1,'DisplayName','L1','LineWidth',1)
plot(simlog_t, simlog_wL1*30/pi,'DisplayName','L1','LineWidth',1)
hold on
plot(simlog_t, simlog_wL2,'DisplayName','L2','LineWidth',1)
plot(simlog_t, simlog_wL3,'DisplayName','L3','LineWidth',1)
plot(simlog_t, simlog_wR1,'DisplayName','R1','LineWidth',1)
plot(simlog_t, simlog_wR2,'DisplayName','R2','LineWidth',1)
plot(simlog_t, simlog_wR3,'DisplayName','R3','LineWidth',1)
plot(simlog_t, simlog_wL2*30/pi,'DisplayName','L2','LineWidth',1)
plot(simlog_t, simlog_wL3*30/pi,'DisplayName','L3','LineWidth',1)
plot(simlog_t, simlog_wR1*30/pi,'DisplayName','R1','LineWidth',1)
plot(simlog_t, simlog_wR2*30/pi,'DisplayName','R2','LineWidth',1)
plot(simlog_t, simlog_wR3*30/pi,'DisplayName','R3','LineWidth',1)
hold off;
title('Motor Speed');
legend('Location','Best');
Expand All @@ -77,4 +94,31 @@

grid on

linkaxes(ah,'x');
linkaxes(ah,'x');

% Reuse figure if it exists, else create new figure
if ~exist('h4a_mars_rover_terrain', 'var') || ...
~isgraphics(h4a_mars_rover_terrain, 'figure')
h4a_mars_rover_terrain = figure('Name', 'mars_rover_terrain');
end
figure(h4a_mars_rover_terrain)
clf(h4a_mars_rover_terrain)

simlog_drive_pwr = ...
simlog_wL1.*simlog_trqL1 + ...
simlog_wL2.*simlog_trqL2 + ...
simlog_wL3.*simlog_trqL3 + ...
simlog_wR1.*simlog_trqR1 + ...
simlog_wR2.*simlog_trqR2 + ...
simlog_wR3.*simlog_trqR3 + ...
simlog_wLS1.*simlog_trqLS1 + ...
simlog_wLS3.*simlog_trqLS3 + ...
simlog_wRS1.*simlog_trqRS1 + ...
simlog_wRS3.*simlog_trqRS3;

plot(simlog_t,simlog_drive_pwr)

title('Power Consumption, Drive and Steer Motors')
ylabel('Power (W)')
xlabel('Time (s)')
grid on
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
To make changes, update the MATLAB code and republish this document.
-->
<title>Generating Grid Surface from STL Geometry: Terrain</title>
<meta name="generator" content="MATLAB 24.1">
<meta name="generator" content="MATLAB 24.2">
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
<meta name="DC.date" content="2024-03-21">
<meta name="DC.date" content="2024-09-12">
<meta name="DC.source" content="mars_rover_workflow_grid_surface.m">
<style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
Expand Down Expand Up @@ -168,7 +168,7 @@ <h2 id="3">Perform Interpolation</h2>
</pre>
<p class="footer">
<br>
<a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2024a</a>
<a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2024b</a>
<br>
</p>
</div>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
To make changes, update the MATLAB code and republish this document.
-->
<title>Planning Trajectory for Rover Arm: Inverse Kinematics</title>
<meta name="generator" content="MATLAB 24.1">
<meta name="generator" content="MATLAB 24.2">
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
<meta name="DC.date" content="2024-03-21">
<meta name="DC.date" content="2024-09-12">
<meta name="DC.source" content="mars_rover_workflow_inverse_kinematics.m">
<style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
Expand Down Expand Up @@ -220,7 +220,7 @@ <h2 id="15">Test Model with Joint Angles Obtained from Inverse Kinematic Analysi
</p>
<img vspace="5" hspace="5" src="mars_rover_workflow_inverse_kinematics_04.png" alt=""> <p class="footer">
<br>
<a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2024a</a>
<a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2024b</a>
<br>
</p>
</div>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Workflows/Inverse_Kinematics/mars_rover_arm.slx
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
To make changes, update the MATLAB code and republish this document.
-->
<title>Extracting Point Cloud from STL Geometry: Wheel</title>
<meta name="generator" content="MATLAB 24.1">
<meta name="generator" content="MATLAB 24.2">
<link rel="schema.DC" href="http://purl.org/dc/elements/1.1/">
<meta name="DC.date" content="2024-03-21">
<meta name="DC.date" content="2024-09-12">
<meta name="DC.source" content="mars_rover_workflow_point_cloud.m">
<style type="text/css">
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,font,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td{margin:0;padding:0;border:0;outline:0;font-size:100%;vertical-align:baseline;background:transparent}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:'';content:none}:focus{outine:0}ins{text-decoration:none}del{text-decoration:line-through}table{border-collapse:collapse;border-spacing:0}
Expand Down Expand Up @@ -181,7 +181,7 @@ <h2 id="1">Read in the STL file, plot mesh</h2>
</pre>
<p class="footer">
<br>
<a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2024a</a>
<a href="https://www.mathworks.com/products/matlab/">Published with MATLAB&reg; R2024b</a>
<br>
</p>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Info>
<Category UUID="FileClassCategory">
<Label UUID="96c40e67-021b-48a2-9371-288e60f8854b"/>
</Category>
</Info>
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<?xml version="1.0" encoding="UTF-8"?>
<Info location="mars_rover_terrain_18.png" type="File"/>

0 comments on commit 104146b

Please sign in to comment.