Skip to content

Commit

Permalink
4 DOFs system
Browse files Browse the repository at this point in the history
  • Loading branch information
Auralius Manurung committed Oct 19, 2016
1 parent f9c8da0 commit 94af437
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
Binary file added 4dof.avi
Binary file not shown.
35 changes: 35 additions & 0 deletions example4dof.m
@@ -0,0 +1,35 @@
function example4dof()
clc
clear all
close all

n = 4;

alpha = [0 0 0 0];
offset = [0 0 0 0];
d = [0 0 0 0];
a = [1 1 1 1];
base = [0; 0; 0];
type = ['r', 'r', 'r', 'r'];

disp('Finding solutions...');
solutions = compute_dynamics(n, a, d, alpha, offset);

init_t = 0;
final_t = 4;
dt = 0.01; % Keep in mind that ode23 function is a variable step solver!
N = (final_t - init_t) / dt;
t_span = linspace(init_t, final_t, N);
x0 = [-pi/4; 0; 0; 0; 0; 0; 0; 0];

M = [1; 1; 1; 1];
B = [0.5; 0.5; 0.5; 0.5];
u = [0; 0; 0; 0];

disp('Simulating the dynamics...');
[t,x] = ode23(@simulate_dynamics, t_span, x0, [], n, u, M, B, solutions, final_t);

animate_robot(d, a, alpha, offset, type, base, x);

end

0 comments on commit 94af437

Please sign in to comment.