Skip to content

Conversation

@juanjqo
Copy link
Member

@juanjqo juanjqo commented Nov 13, 2022

@dqrobotics/developers

Hi @mmmarinho,

This example tests the pose_jacobian_derivative() method.

The example compares the results between the DQ_Kinematics::pose_jacobian_derivative() and the ones obtained using numerical differentiation.

The implementation of the numerical differentiation method is based on the four-point central finite differences (Numerical Methods for Engineers and Scientists, 3rd Edition by Amos Gilat, P318).

std::vector<MatrixXd> numerical_differentiation(const std::vector<Eigen::MatrixXd>& J,
                                                const double& T)
{
    int s = J.size();
    std::vector<MatrixXd> J_dot(s, MatrixXd::Zero(J[0].rows(), J[0].cols()));
    for(int i=2; i<s-2;i++)
    {
        J_dot[i] = ((J[i-2]-8*J[i-1]+8*J[i+1]-J[i+2])/(12*T));
    }
    return J_dot;
}

@bvadorno
Copy link
Member

Hi @juanjqo,

Thank you for that. That's an interesting test, but as a gold standard, you should compare the results with the MATLAB version.

Best,
Bruno

@bvadorno
Copy link
Member

(To be clear, ideally, there would be a test that automatically generates the result using the MATLAB version and compare the results between the output of the MATLAB implementation and the C++ implementation.)

@juanjqo
Copy link
Member Author

juanjqo commented Nov 13, 2022

Hi @bvadorno!

At this moment, there is no Matlab implementation of the method pose_jacobian_derivative() in the class DQ_Kinematics, only for C++C++ (in this dqrobotics/cpp#48). In the example, I'm comparing the results of the pose jacobian derivatives of the classes DQ_HolonomicBase, DQ_DifferentialDriveRobot, and DQ_SerialManipulator.

I was thinking first of comparing the results with the numerical differentiation. Once the C++ version is working I could implement the method in Matlab and create a test as you suggested.

I could include a comparison between my numerical differentiation implementation and the Matlab version diff()/T in Matlab.

What do you think?

Best regards,

Juancho

(B: reverted to its initial form to ensure context.)

@bvadorno
Copy link
Member

Well, unless my memory fails me, or I'm living in an alternate reality, I implemented the pose_jacobian_derivative in MATLAB, which is what we published on RAM. Maybe we are talking about different things?

Bruno

@juanjqo
Copy link
Member Author

juanjqo commented Nov 13, 2022

@bvadorno The pose jacobian derivative method is currently available in the class DQ_Serial Manipulator but not in the class DQ_Kinematics.
I implemented recently a Pull Request to include the method in the class DQ_Kinematics. In other words, I coud only compare the results of the Matlab version (DQ_SerialManipulator) and the C++ version (DQ_Kinematics) only for 'DQ_SerialManipulator' robots.
For other classes/robots, as DQ_HolonomicBase, DQ_DifferentialDriveRobot, DQ_SerialWholeBody and DQ_WholeBody, the pose_jacobian_derivative is not implemented.

Juancho

@bvadorno
Copy link
Member

Hi Juancho,

Thank you for the clarification. Your initial message, which you edited, gave the impression that there was no implementation whatsoever of the Jacobian derivative in MATLAB, and that was very puzzling.

I strongly suggest only editing messages to include corrections of minor typos, but never to change the context of the conversation. That might be a source of great confusion. If possible, revert the edited message to its initial form.

Regarding this Pull Request, since there is a proposal for changing the architecture, please update the class diagram, highlighting the changes, specifically the abstract methods that you are proposing.

@mmmarinho , may you provide @juanjqo with the class diagrams that we used for RAM? I’m with limited access to the internet and my computer, and it might take a while if I need to do it.

Best,
Bruno

@juanjqo
Copy link
Member Author

juanjqo commented Nov 14, 2022

@dqrobotics/developers

Hi Bruno,

I edited the message to its initial form. Furthermore, I added (in my PR ) a UML diagram highlighting the changes.

Please let me know if something else is required.

Best regards,

Juancho

@bvadorno
Copy link
Member

Hi @juanjqo,

Brilliant. I've put my comments directly in the PR.

Best wishes,
Bruno

…e error and the threshold in which big negative errors were considered accurated.
@mmmarinho mmmarinho merged commit 78b5643 into dqrobotics:master Nov 21, 2022
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.

3 participants