Skip to content

Commit 15740f7

Browse files
committed
Commit of R2018b files
1 parent c1793c2 commit 15740f7

File tree

9 files changed

+9
-106
lines changed

9 files changed

+9
-106
lines changed

Libraries/OpenManipulatorLib.slx

-3.83 KB
Binary file not shown.
2.37 KB
Binary file not shown.
2.08 KB
Binary file not shown.

ScriptsFunctions/Kinematics/createRigidBodyTree.m

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,7 @@
1111
% Add gravity
1212
gravityVec = [0 0 -9.80665];
1313
robot.Gravity = gravityVec;
14-
15-
% Add inertial properties
16-
setRobotInertialProperties;
17-
14+
1815
% Add another massless coordinate frame for the end effector
1916
eeOffset = 0.12;
2017
eeBody = robotics.RigidBody('end_effector');
@@ -25,7 +22,8 @@
2522

2623
% If this fails, load the preloaded rigid body tree
2724
catch
28-
load openManipulatorDescription robot;
25+
warning('Error importing URDF file. Loading presaved object.');
26+
load openManipulatorDescription robot
2927
end
3028

3129
% Return its home configuration
818 Bytes
Binary file not shown.

ScriptsFunctions/Kinematics/openManipulatorIK.m

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
clc
1111

1212
addpath(genpath(strcat(pwd,'\Dependencies')))
13-
robot = importrobot('open_manipulator.urdf');
13+
robot = createRigidBodyTree;
1414
axes = show(robot);
1515
axes.CameraPositionMode = 'auto';
1616

@@ -29,13 +29,6 @@
2929
fnplt(trajectory,'r',2);
3030

3131
%% Perform Inverse Kinematics for a point in space
32-
33-
% Add end effector frame, offset from the grip link frame
34-
eeOffset = 0.12;
35-
eeBody = robotics.RigidBody('end_effector');
36-
setFixedTransform(eeBody.Joint,trvec2tform([eeOffset 0 0]));
37-
addBody(robot,eeBody,'link5');
38-
3932
ik = robotics.InverseKinematics('RigidBodyTree',robot);
4033
weights = [0.1 0.1 0 1 1 1];
4134
initialguess = robot.homeConfiguration;

ScriptsFunctions/Kinematics/setRobotInertialProperties.m

Lines changed: 0 additions & 43 deletions
This file was deleted.

ScriptsFunctions/Kinematics/simInvKin.m

Lines changed: 0 additions & 46 deletions
This file was deleted.

ScriptsFunctions/Utilities/checkDependencies.m

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,15 +52,16 @@
5252
urdfFolder = fileparts(xacroFile);
5353
urdfFile = fullfile(urdfFolder,'open_manipulator.urdf');
5454
filetext = fileread('open_manipulator.urdf.xacro');
55-
% String replace all the joint angle limit expressions with numeric values
56-
[startIdx,endIdx] = regexp(filetext,'\${(-)?pi*\S*}');
55+
% String replace all the expressions with numeric values
56+
searchExpression = '\${[^}]*\d+[^}]*}'; % Starts with $ and has text (with at least one number) between { }
57+
[startIdx,endIdx] = regexp(filetext,searchExpression);
5758
while ~isempty(startIdx)
5859
token = filetext(startIdx(1):endIdx(1));
5960
numericVal = eval(token(3:end-1));
6061
filetext = strrep(filetext,token,num2str(numericVal));
61-
[startIdx,endIdx] = regexp(filetext,'\${(-)?pi*\S*}');
62+
[startIdx,endIdx] = regexp(filetext,searchExpression);
6263
end
63-
% Write the URDf file with the new text
64+
% Write the URDF file with the new text
6465
file = fopen(urdfFile,'w');
6566
fwrite(file,filetext);
6667
fclose(file);

0 commit comments

Comments
 (0)