Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

This PR adds the class 'DQ_SerialVrepRobot' #108

Merged
merged 33 commits into from
Aug 16, 2024

Conversation

ffasilva
Copy link
Member

@ffasilva ffasilva commented Jan 26, 2024

Main instructions

By submitting this pull request, you automatically agree that you have read and accepted the following conditions:

  • Anyone wanting to propose a new modification or introduce new functionality should reach out to the team first, as proposed modifications that do not comply with the library's development philosophy and style, do not follow the library's architecture, do not introduce a clear and general benefit to the library other than to the person who proposed the modification will likely be rejected with no further discussion.
  • Support for DQ Robotics is given voluntarily and it is not the developers' role to educate and/or convince anyone of their vision.
  • Any possible response and its timeliness will be based on the relevance, accuracy, and politeness of a request and the following discussion.
  • You are familiar with the development workflow.
  • Each pull request should contain only individual changes (several changes of the same type are allowed on the same pull request).
  • Refactoring or modifying internal implementation that is working is not allowed unless comprehensively discussed with and approved by @bvadorno and @mmmarinho.

Description of changes

Hi, @dqrobotics/developers,

I've added the the class DQ_SerialVrepRobot. It follows the implementation of its C++ counterpart.

I also had to update the classes DQ_VrepRobot, LBR4pVrepRobot, and YouBotVrepRobot for compatibility with the new signatures imposed by DQ_SerialVrepRobot.

An example of use is given in 9.

Rationale

The class DQ_SerialVrepRobot already exists in the C++ library but was missing on MATLAB.

@bvadorno bvadorno requested a review from juanjqo April 3, 2024 13:56
@ffasilva
Copy link
Member Author

Hi @dqrobotics/developers,

Could we please prioritize this pull request? I cannot do the fourth, and last, lesson of the learning-dqrobotics-with-coppeliasim tutorials without it being merged into the master.

The only robots available in the public DQ Robotics interface with CoppeliaSim are LBR4pVrepRobot and YouBotVrepRobot. Besides having the obsolete methods of get_q_from_vrep and send_q_to_vrep (which I'll have to update in the third lesson of the tutorial), they only work for scenes with dynamics disabled because they use the vrep_interface.set_joint_positions method for actuating on the robots.

The fourth lesson of the tutorial is about dynamic simulations and methods such as set_joint_target_positions, get_joint_velocities, etc. I could do some weird workaround of submitting a new pull request just updating LBR4pVrepRobot and YouBotVrepRobot to continue with the tutorials, but this fix is already covered by ace84af in this pull request.

Kind regards,
Frederico

@bvadorno
Copy link
Member

Hi @mmmarinho,

Can you please take this one? As you designed the original classes, you are better positioned to review the new classes.

@ffasilva, could you please clarify if this modification will break the second lesson of the CoppeliaSim-with-DQ-Robotics tutorial?

Kind regards,
Bruno

@mmmarinho mmmarinho self-requested a review June 24, 2024 06:37
@mmmarinho
Copy link
Member

@bvadorno sure!

@juanjqo are you taking a look at this one first or should I?

@ffasilva
Copy link
Member Author

Hi @bvadorno,

@ffasilva, could you please clarify if this modification will break the second lesson of the CoppeliaSim-with-DQ-Robotics tutorial?

I don't see how it would. Lesson 2 doesn't use any robotic manipulator. However, this pull request will break the ending of lesson 3, hence why I left it as a draft.

Kind regards,
Frederico

@juanjqo
Copy link
Member

juanjqo commented Jun 24, 2024

@bvadorno sure!

@juanjqo are you taking a look at this one first or should I?

@mmmarinho could you review it first please? Currently, I don't have access to a Matlab license.

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.

@ffasilva

Thanks for this. I've written a few comments about the suggested changes.

interfaces/vrep/DQ_SerialVrepRobot.m Outdated Show resolved Hide resolved
interfaces/vrep/DQ_SerialVrepRobot.m Outdated Show resolved Hide resolved
interfaces/vrep/DQ_SerialVrepRobot.m Show resolved Hide resolved
interfaces/vrep/DQ_SerialVrepRobot.m Outdated Show resolved Hide resolved
interfaces/vrep/DQ_SerialVrepRobot.m Outdated Show resolved Hide resolved
interfaces/vrep/DQ_SerialVrepRobot.m Show resolved Hide resolved
interfaces/vrep/DQ_VrepRobot.m Outdated Show resolved Hide resolved
@@ -17,8 +17,8 @@
% will become "youBot#0", a third robot, "youBot#1", and so on.
%
% YouBotVrepRobot Methods:
% send_q_to_vrep - Sends the joint configurations to VREP
Copy link
Member

Choose a reason for hiding this comment

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

Careful removing methods, we need at least one version of backwards compatibility

Copy link
Member Author

Choose a reason for hiding this comment

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

Backwards compatibility added in a02ad1b.

Copy link
Member

Choose a reason for hiding this comment

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

In the review view, this is still deleted and not added anywhere else. Maybe I'm doing something wrong?

Copy link
Member Author

Choose a reason for hiding this comment

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

In a02ad1b I added backwards compatibility to both send_q_to_vrep and get_q_from_vrep to the class DQ_VrepRobot, where they used to be abstract methods.

function send_q_to_vrep(obj, q)
   % For backwards compatibility only. Do not use this method.

   warning('Deprecated. Use set_configuration_space_positions() instead.')
   obj.set_configuration_space_positions(q)
end

function q = get_q_from_vrep(obj)
   % For backwards compatibility only. Do not use this method.

   warning('Deprecated. Use get_configuration_space_positions() instead.')
   q = obj.get_configuration_space_positions();
end

As such, the use of something similar to

vi = DQ_VrepInterface();
vi.connect('127.0.0.1',19997);
vrep_robot = YouBotVrepRobot("youBot", vi);
vrep_robot.get_q_from_vrep

yields the result

Warning: Deprecated. Use get_configuration_space_positions() instead. 
> In DQ_VrepRobot/get_q_from_vrep (line 65) 

ans =

    1.2068
   -1.8492
    3.6463
    0.0001
    0.5395
    0.9149
    1.2685
   -0.0001

That's the desired result, right? The deprecated method send_q_to_vrep works similarly.

Copy link
Member

Choose a reason for hiding this comment

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

Hi, @ffasilva ,

The desired result is to leave the original code unchanged as much as possible and work the new code around it.

I understand why you chose to do it this way, but I'll condition the acceptance of this to these examples working without modification:
https://github.com/dqrobotics/matlab-examples/tree/master/vrep

Copy link
Member Author

@ffasilva ffasilva Aug 6, 2024

Choose a reason for hiding this comment

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

Hi @mmmarinho,

I see what you mean, but I figured that deprecating the methods in all the concrete classes that inherit from DQ_VrepRobot, rather than just doing it directly on the abstract class itself, would have generated even more modifications to the original code.

As for your request, the deprecation of the methods is working as intended. The simulation-ram-paper runs without any problems:

simulation_ram_paper

However, the constrained_kinematic_control example don't use the VrepRobot classes at all. Which means it obviously works, but it also doesn't help us validate my modifications. I raised an issue to update this example in the future.

Kind regards,
Frederico

P.S.: I caught two bugs in the constructor of the YouBotVrepRobot class. I fixed them here 7e30416.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks, @ffasilva. Your reasoning is sensible as you have minimized the number of modifications, and the example still runs. Therefore, your solution is acceptable.

@ffasilva
Copy link
Member Author

Hi @mmmarinho,

Thank you for the review. I implemented the requested modifications and fixed small details in the documentation. Please let me know if there is still something missing.

Kind regards,
Frederico

@ffasilva ffasilva requested a review from mmmarinho July 23, 2024 14:50
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.

Hi @ffasilva. Thank you, I've added some comments.


%% youBot don't follow the standard name convention on CoppeliaSim. Also, the use of 'set_names()', as is done in the C++ implementation, is not supported on a constructor in MATLAB
Copy link
Member

Choose a reason for hiding this comment

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

There are some ways to fix this but how about

youBot` does not follow the standard naming convention of/in CoppeliaSim.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed in fa35f1b.

@@ -17,8 +17,8 @@
% will become "youBot#0", a third robot, "youBot#1", and so on.
%
% YouBotVrepRobot Methods:
% send_q_to_vrep - Sends the joint configurations to VREP
Copy link
Member

Choose a reason for hiding this comment

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

In the review view, this is still deleted and not added anywhere else. Maybe I'm doing something wrong?

@ffasilva ffasilva requested a review from mmmarinho July 29, 2024 10:34
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.

Please implement the requested changes.


% (C) Copyright 2020 DQ Robotics Developers
% (C) Copyright 2018-2024 DQ Robotics Developers
Copy link
Member

Choose a reason for hiding this comment

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

DQ Robotics, as we know it now, started in 2011. Please amend the copyright date (remember that this is legally binding, so we must take it seriously.)

Copy link
Member Author

Choose a reason for hiding this comment

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

Done in 107be2c.

% >> vi.connect('127.0.0.1',19997);
% >> vrep_robot = DQ_SerialVrepRobot("my_robot", 7, "my_robot", vi);
% >> vi.start_simulation();
% >> vrep_robot.get_configuration_space_positions();
Copy link
Member

Choose a reason for hiding this comment

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

Let's change it to get_configuration() and deprecate get_configuration_space_positions().

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated comment in c934c9c. However, there is no need to deprecate get_configuration_space_positions() as this is the pull requesting proposing the first MATLAB version of DQ_SerialVrepRobot. We willl have to deprecate the methods in the C++ version, though.

Copy link
Member

Choose a reason for hiding this comment

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

@ffasilva nothing only the master branch needs to be deprecated. Only what ended up in a release version.

%
% DQ_SerialVrepRobot Methods:
% get_joint_names - Gets the joint names of the robot in the CoppeliaSim scene.
% set_configuration_space_positions - Sets the joint configurations of the robot in the CoppeliaSim scene.
Copy link
Member

Choose a reason for hiding this comment

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

Let's change it to get_configuration() and deprecate get_configuration_space_positions().

Copy link
Member Author

Choose a reason for hiding this comment

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

Comment updated in bee94d7.

%
% DQ_SerialVrepRobot Methods:
% get_joint_names - Gets the joint names of the robot in the CoppeliaSim scene.
% set_configuration_space_positions - Sets the joint configurations of the robot in the CoppeliaSim scene.
Copy link
Member

Choose a reason for hiding this comment

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

Let's change it to set_configuration() and deprecate set_configuration_space_positions().

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated comment in c9ef19e.

% get_joint_names - Gets the joint names of the robot in the CoppeliaSim scene.
% set_configuration_space_positions - Sets the joint configurations of the robot in the CoppeliaSim scene.
% get_configuration_space_positions - Gets the joint configurations of the robot in the CoppeliaSim scene.
% set_target_configuration_space_positions - Sets the joint configurations of the robot in the CoppeliaSim scene as a target configuration for the joint controllers.
Copy link
Member

Choose a reason for hiding this comment

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

set_target_configuration()

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in 5099cb7.

@@ -8,7 +8,7 @@
% >> vi.connect('127.0.0.1',19997);
% >> vrep_robot = LBR4pVrepRobot("LBR4p", vi);
% >> vi.start_simulation();
% >> robot.get_q_from_vrep();
% >> robot.get_configuration_space_positions();
Copy link
Member

Choose a reason for hiding this comment

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

Please change the methods' names according to my comments on the other files. The legacy names should be deprecated.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in ecab5b5.

@@ -8,7 +8,7 @@
% >> vi.connect('127.0.0.1',19997);
% >> vrep_robot = YouBotVrepRobot("youBot", vi);
% >> vi.start_simulation();
% >> robot.get_q_from_vrep();
% >> robot.get_configuration_space_positions();
Copy link
Member

Choose a reason for hiding this comment

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

Same as in the other files.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in 05873d5.

@@ -17,8 +17,8 @@
% will become "youBot#0", a third robot, "youBot#1", and so on.
%
% YouBotVrepRobot Methods:
% send_q_to_vrep - Sends the joint configurations to VREP
Copy link
Member

Choose a reason for hiding this comment

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

Thanks, @ffasilva. Your reasoning is sensible as you have minimized the number of modifications, and the example still runs. Therefore, your solution is acceptable.

@@ -17,11 +17,11 @@
% will become "youBot#0", a third robot, "youBot#1", and so on.
%
% YouBotVrepRobot Methods:
% send_q_to_vrep - Sends the joint configurations to VREP
% get_q_from_vrep - Obtains the joint configurations from VREP
% set_configuration_space_positions - Sends the joint configurations to VREP
Copy link
Member

Choose a reason for hiding this comment

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

Same as before: please change the name and deprecate legacy names.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in 8b53f6d.

% kinematics - Obtains the DQ_Kinematics implementation of this robot

% (C) Copyright 2020 DQ Robotics Developers
% (C) Copyright 2018-2024 DQ Robotics Developers
Copy link
Member

Choose a reason for hiding this comment

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

2011-2024

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated in badb11a.

@ffasilva ffasilva requested a review from bvadorno August 15, 2024 21:54
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 @ffasilva,

Please create a pull request for the C++ version to ensure compatibility with the new names.

Thanks!
Bruno

@bvadorno bvadorno merged commit 1eb3459 into dqrobotics:master Aug 16, 2024
1 of 2 checks passed
@ffasilva ffasilva deleted the dq-serial-vrep-robot branch August 16, 2024 09:46
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.

4 participants