Skip to content

Commit

Permalink
Updated wrapped for parameterization input
Browse files Browse the repository at this point in the history
  • Loading branch information
mattking-smith committed May 11, 2023
1 parent 9302814 commit 653a2ca
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build*
*.pyc
*.asv
**/.DS_Store
7 changes: 4 additions & 3 deletions gpmp2.i
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ class GaussianProcessInterpolatorLinear {
#include <gpmp2/kinematics/Arm.h>

class Arm {
Arm(size_t dof, Vector a, Vector alpha, Vector d);
Arm(size_t dof, Vector a, Vector alpha, Vector d, gpmp2::Parameterization parameterization);
Arm(size_t dof, Vector a, Vector alpha, Vector d,
const gtsam::Pose3& base_pose);
const gtsam::Pose3& base_pose, gpmp2::Parameterization parameterization);
Arm(size_t dof, Vector a, Vector alpha, Vector d,
const gtsam::Pose3& base_pose, Vector theta_bias);
const gtsam::Pose3& base_pose, Vector theta_bias, gpmp2::Parameterization parameterization);
// full forward kinematics
Matrix forwardKinematicsPose(Vector jp) const;
Matrix forwardKinematicsPosition(Vector jp) const;
Expand All @@ -123,6 +123,7 @@ class Arm {
Vector d() const;
Vector alpha() const;
gtsam::Pose3 base_pose() const;
gpmp2::Parameterization parameterization() const;
};

// abstract pose2 mobile base class
Expand Down
1 change: 1 addition & 0 deletions gpmp2/kinematics/Arm.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ class GPMP2_EXPORT Arm
const gtsam::Vector &d() const { return d_; }
const gtsam::Vector &alpha() const { return alpha_; }
const gtsam::Pose3 &base_pose() const { return base_pose_; }
const Parameterization &parameterization() const {return parameterization_; }

private:
/// Calculate the homogenous transformation and matrix for joint j with angle
Expand Down
10 changes: 5 additions & 5 deletions gpmp2/kinematics/tests/testArm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -595,11 +595,11 @@ TEST(Arm, KinovaGen3) {

// expected joint velocities
vi_exp.push_back(Vector3(0, 0, 0)); // J1
vi_exp.push_back(Vector3(0, 0, 0)); // J2
vi_exp.push_back(Vector3(-0.0298, 0, -0.0298)); // J3
vi_exp.push_back(Vector3(-0.0294, -0.0006, -0.0285)); // J4
vi_exp.push_back(Vector3(-0.0916, -0.0006, -0.0493)); // J5
vi_exp.push_back(Vector3(-0.0916, -0.0006, -0.0493)); // J6
vi_exp.push_back(Vector3(0, 0, 0)); // J2
vi_exp.push_back(Vector3(-0.0298, 0, -0.0298)); // J3
vi_exp.push_back(Vector3(-0.0294, -0.0006, -0.0285)); // J4
vi_exp.push_back(Vector3(-0.0916, -0.0006, -0.0493)); // J5
vi_exp.push_back(Vector3(-0.0916, -0.0006, -0.0493)); // J6
vi_exp.push_back(Vector3(-0.0968, -0.0380, -0.0068)); // J7

// fk no velocity
Expand Down
28 changes: 20 additions & 8 deletions matlab/+gpmp2/generateArm.m
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@
%
% Usage: arm_model = GENERATEARM(arm_str)
% @arm_str dataset string, existing datasets:
% 'SimpleTwoLinksArm', 'SimpleThreeLinksArm', 'WAMArm', 'PR2Arm'
% 'SimpleTwoLinksArm', 'SimpleThreeLinksArm', 'WAMArm',
% 'PR2Arm', 'KinovaGen3'
% @base_pose arm's base pose, default is origin with no rotation
%
% @theta_bias bias of joint angle inputs
%
% @
% Output Format:
% arm_model an ArmModel object, contains kinematics and model information

Expand Down Expand Up @@ -84,8 +88,8 @@
alpha = [-pi/2,pi/2,-pi/2,pi/2,-pi/2,pi/2,0]';
a = [0,0,0.045,-0.045,0,0,0]';
d = [0,0,0.55,0,0.3,0,0.06]';
theta = [0, 0, 0, 0, 0, 0, 0]';
abs_arm = Arm(7, a, alpha, d, base_pose, theta);
theta_bias = [0, 0, 0, 0, 0, 0, 0]';
abs_arm = Arm(7, a, alpha, d, base_pose, theta_bias);

% physical arm
% sphere data [id x y z r]
Expand Down Expand Up @@ -122,8 +126,8 @@
alpha = [-1.5708, 1.5708, -1.5708, 1.5708, -1.5708, 1.5708, 0]';
a = [0.1, 0, 0, 0, 0, 0, 0]';
d = [0, 0, 0.4, 0, 0.321, 0, 0]';
theta = [0, 1.5708, 0, 0, 0, 0, 0]';
abs_arm = Arm(7, a, alpha, d, base_pose, theta);
theta_bias = [0, 1.5708, 0, 0, 0, 0, 0]';
abs_arm = Arm(7, a, alpha, d, base_pose, theta_bias);
% physical arm
% sphere data [id x y z r]
spheres_data = [...
Expand Down Expand Up @@ -171,8 +175,8 @@
alpha = [pi/2, pi, pi/2, 1.0472, 1.0472, pi]';
a = [0, 0.41, 0, 0, 0, 0]';
d = [0.2755, 0, -0.0098, -0.2501, -0.0856, -0.2228]';
theta = [0, 0, 0, 0, 0, 0]';
abs_arm = Arm(6, a, alpha, d, base_pose, theta);
theta_bias = [0, 0, 0, 0, 0, 0]';
abs_arm = Arm(6, a, alpha, d, base_pose, theta_bias);
% physical arm
% sphere data [id x y z r]
spheres_data = [...
Expand Down Expand Up @@ -225,10 +229,18 @@
Point3(spheres_data(i,2:4)')));
end
arm_model = ArmModel(abs_arm, sphere_vec);

elseif strcmp(arm_str, 'KinovaGen3')
% arm: Kinova Gen3 7DOF arm (modified DH parameterization)
alpha = [pi, pi/2, -pi/2, pi/2, -pi/2, pi/2, -pi/2]';
a = zeros(7,1);
d = [-0.2848, -0.0118, -0.4208, -0.0128, -0.3143, 0.0, -0.1674]';
theta_bias = [0, 0, 0, 0, 0, 0]';
abs_arm = Arm(7, a, alpha, d, base_pose, theta_bias);

% no such dataset
else
error('No such arm exist');
error('No such arm model exist');
end

end
Expand Down

0 comments on commit 653a2ca

Please sign in to comment.