Skip to content

Conversation

@juanjqo
Copy link
Member

@juanjqo juanjqo commented Jan 6, 2023

@dqrobotics/developers

Hi @bvadorno,

This PR proposes the following modifications to fix #76 :

  • Removed the public property type from subclasses DQ_SerialManipulatorDH and DQ_SerialManipulatorMDH. Added the protected property joint_types in DQ_SerialManipulator. Motivations:
    • The joint types do not depend on any specific parametrization. Therefore, obj.joint_types is a property common to all subclasses, like obj.n_joints.
    • Since we now have the method set_joint_types (and get_joint_types, both added in this PR) there is no need to keep obj.joint_types as a public property. (Currently, the user can freely get and set the property obj.type.
  • The following methods were added in DQ_SerialManipulator:
    • get_supported_joint_types() (protected, abstract)
    • check_joint_types() (public)
    • get_joint_types() (public) (returns the joint types as a vector)
    • get_joint_type(ith) (public) (returns only the ith joint type as a double)
    • set_joint_types() (public) (sets all joints)
    • set_joint_type(ith) (public) (sets only the ith joint)

UML:
drawing

Example of use:
Minimal example used in #76

clear all;
clc;
close all;

ax18_DH_theta   = [0       0      -pi/2   -pi/2      -pi/2];  % theta
ax18_DH_d       = [0.167   0       0     0.1225          0];  % d
ax18_DH_a       = [0      0.159    0.02225    0      0.170];  % a
ax18_DH_alpha   = [-pi/2   0      -pi/2   -pi/2          0];  % alpha

R = double(DQ_JointType.REVOLUTE);
P = double(DQ_JointType.PRISMATIC);
H = double(DQ_JointType.HELICAL);
S = double(DQ_JointType.SPHERICAL);
C = double(DQ_JointType.CYLINDRICAL);
Pl = double(DQ_JointType.PLANAR);
SD = double(DQ_JointType.SIX_DOF);

ax18_DH_type    = [SD P H S C];


ax18_DH_matrix = [  ax18_DH_theta;
    ax18_DH_d;
    ax18_DH_a;
    ax18_DH_alpha;
    ax18_DH_type;
    ]; % D&H parameters matrix for the arm model

ax = DQ_SerialManipulatorDH(ax18_DH_matrix)

Output:

Error using DQ_SerialManipulator/check_joint_types
Unsupported joint types. Use valid joint types:  DQ_JointType.REVOLUTE,
DQ_JointType.PRISMATIC.

Error in DQ_SerialManipulator/set_joint_types (line 146)
            obj.check_joint_types();

Error in DQ_SerialManipulatorDH (line 196)
            obj.set_joint_types(A(5,:));

Error in untitled2 (line 30)
ax = DQ_SerialManipulatorDH(ax18_DH_matrix)

Best regards,

Juancho

[DQ_SerialManipulator] Added the property joint_types. Added the methods get_supported_joint_types(), check_joint_types() and, new methods to set and get the joint types. 

[DQ_SerialManipulatorDH, MDH] Updated the subclasses to comply with the modifications made in DQ_SerialManipulator.
Copy link
Member

@bvadorno bvadorno left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @juanjqo,

The modification is overall fine, although there are some minor issues to solve before I approve it.

Best wishes,
Bruno


function set_joint_types(obj, joint_types)
% SET_JOINT_TYPES(joint_types) sets the joint types.
% 'joint_types' the vector that contains the joint types.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'joint_types' is a vector containing the joint types.

obj.check_joint_types();
end

function ret = get_joint_types(obj)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change it according to my comment for the set_joint_type method.

end


function ret = get_supported_joint_types(~)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any reason for ignoring the arguments? (That is, for using ~)

Copy link
Member Author

@juanjqo juanjqo Feb 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @bvadorno, as discussed internally, I removed the '~'.

Current:

methods (Static, Access = protected) 
     function ret = get_supported_joint_types()
     % This method returns the supported joint types.
        ret = [DQ_JointType.REVOLUTE, DQ_JointType.PRISMATIC];
     end
end

[DQ_SerialManipulator.m] Removed the '~' from the method signature. Furthermore, I defined as a static method.
[DQ_SerialManipulatorDH, MDH] Changed method get_supported_join_types() to comply with the modification made in DQ_SerialManipulator.
[DQ_SerialManipulator, DQ_SerialManipulatorDH, MDH]

function ret = get_joint_type(obj, ith_joint)
% GET_JOINT_TYPE(ith_joint) returns the joint type of the ith joint.
% GET_JOINT_TYPE(ith_joint) returns a vector containing the joint types.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@juanjqo, is get_joint_type returning a vector? I thought we were sticking with your initial implementation, in which get_joint_type would return just a double.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bvadorno I was a typo. You're right, get_joint_type returns a double.

@bvadorno
Copy link
Member

bvadorno commented Feb 2, 2023

Hi @juanjqo, there is just one outstanding clarification before merging this pull request.

@bvadorno bvadorno merged commit 7fa9d28 into dqrobotics:master Feb 2, 2023
@juanjqo juanjqo deleted the joint_types branch February 3, 2023 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] The subclasses of DQ_SerialManipulator allow the use of any type of joints

2 participants