Skip to content

Conversation

@juanjqo
Copy link
Member

@juanjqo juanjqo commented May 16, 2025

Hi @dqrobotics/developers,

This PR adds the DQ_JointType class and setter and getter methods for the DQ_SerialManipulator class. All of them are already available in the Matlab version of the DQ Robotics. The class follows the pattern design of the DQ_ParameterDH class (added in #69), which prioritizes the language compatibility with the MATLAB implementation.

JointType

I proposed a test example in dqrobotics/cpp-examples#21.

Usage

Creating a robot

 DQ_JointType R = DQ_JointType::REVOLUTE;

 Matrix<double,5,7> dh_matrix(5,7);
 dh_matrix <<11, 12, 13, 14, 15, 16, 17, // theta
                        21, 22, 23, 24, 25, 26, 27, // d
                        31, 32, 33, 34, 35, 36, 37, // a
                        41, 42, 43, 44, 45, 46, 47, // alpha
                        R,  R,  R,  R,  R,  R,  R;
 auto dh_robot = std::make_shared<DQ_SerialManipulatorDH>(dh_matrix);

// getter and setter methods
  dh_robot->get_joint_type(0);
  dh_robot->set_joint_type(DQ_JointType::PRISMATIC, 2);
  auto joint_types = dh_robot->get_joint_types();

Setting unsupported joints

 dh_robot ->set_joint_type(DQ_JointType::HELICAL, 0);
libc++abi: terminating due to uncaught exception of type std::runtime_error: Unsupported joint types. Use valid joint types: DQ_JointType::REVOLUTE, DQ_JointType::PRISMATIC.

Kind regards,

Juancho

juanjqo added 16 commits May 14, 2025 17:50
…ing the paper in which the class is based on.
@juanjqo juanjqo marked this pull request as ready for review May 16, 2025 14:34
Copy link
Member

@mmmarinho mmmarinho left a comment

Choose a reason for hiding this comment

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

Easy one for you @juanjqo

* @brief ToString converts the DQ_JointType to string.
* @return A string that corresponds to the joint type.
*/
std::string ToString() const {
Copy link
Member

Choose a reason for hiding this comment

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

The method name ‘ToString’ is not compliant. I think we have something similar in ‘DQ’, could you please refer to that one?

Copy link
Member Author

Choose a reason for hiding this comment

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

@mmmarinho fixed! =)

…d to to_string in the class DQ_JointType and updated the class DQ_SerialManipulator to comply with this modification.
Copy link
Member

@mmmarinho mmmarinho left a comment

Choose a reason for hiding this comment

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

Accepted pending dqrobotics/cpp-examples#21

@mmmarinho mmmarinho self-assigned this May 19, 2025
@mmmarinho mmmarinho merged commit b970d90 into dqrobotics:master May 19, 2025
3 of 6 checks passed
@juanjqo juanjqo deleted the joint_type branch May 21, 2025 09:36
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.

2 participants