dqrobotics / matlab-examples

Examples and demos for Matlab
GNU Lesser General Public License v3.0
2 stars 3 forks source link

[REQUEST] Update example "vrep/constrained_kinematic_control" to use the class LBR4pVrepRobot #11

Open ffasilva opened 2 months ago

ffasilva commented 2 months ago

Code of Conduct

By submitting this report you automatically agree that you've read and accepted the following conditions.

Hello @dqrobotics/developers,

Request motivation

While working on the DQ_SerialVrepRobot pull request, I realized that the vrep/constrained_kinematic_control example doesn't use the LBR4pVrepRobot class.

Being it a CoppeliaSim usage example, I believe is counterproductive to set both the robot kinematics and the joint names in the main .m file instead teaching the proper use of our VrepRobot classes.

Expected outcome

The example should be updated to use the class LBR4pVrepRobot.

Additional context

This issue is meant to remind me to update this example in the future. However, I lack whatever privilege is needed to assign issues to people; thus, I can't assign myself here. Could someone please do it for me?

Edit: I can't change labels either. Could someone please label this as a "request"?

Kind regards, Frederico

bvadorno commented 2 months ago

Thanks, @ffasilva,

From your comment, I infer that you intend to replace

LBR4p_DH_theta = [0, 0, 0, 0, 0, 0, 0];
LBR4p_DH_d = [0.200, 0, 0.4, 0, 0.39, 0, 0];
LBR4p_DH_a = [0, 0, 0, 0, 0, 0, 0];
LBR4p_DH_alpha = [pi/2, -pi/2, pi/2, -pi/2, pi/2, -pi/2, 0];
LBR4p_DH_type = double(repmat(DQ_JointType.REVOLUTE,1,7));
LBR4p_DH_matrix = [LBR4p_DH_theta;
                    LBR4p_DH_d;
                    LBR4p_DH_a;
                    LBR4p_DH_alpha
                    LBR4p_DH_type];

robot = DQ_SerialManipulatorDH(LBR4p_DH_matrix);
robot.set_effector(1+0.5*DQ.E*DQ.k*0.07);

n = robot.get_dim_configuration_space();
qmin = [-pi -pi -pi/2 -pi -pi/2 -pi -pi/2]';
qmax = [pi pi pi/2 pi pi/2 pi pi/2]';

with a single call to LBR4pVrepRobot. Can you confirm?

When submitting the pull request, I'll assign @juanjqo as the reviewer for this example because he wrote it initially.

Kind regards, Bruno

ffasilva commented 2 months ago

Hi @bvadorno,

Something in this direction. Those lines here


n = robot.get_dim_configuration_space();
qmin = [-pi -pi -pi/2 -pi -pi/2 -pi -pi/2]';
qmax = [pi pi pi/2 pi pi/2 pi pi/2]';

can't really go away, but all of these ones


jointnames={'LBR4p_joint1','LBR4p_joint2',...
            'LBR4p_joint3','LBR4p_joint4',...
            'LBR4p_joint5','LBR4p_joint6',...
            'LBR4p_joint7'};

%---------------------Robot definition--------------------------%
LBR4p_DH_theta = [0, 0, 0, 0, 0, 0, 0];
LBR4p_DH_d = [0.200, 0, 0.4, 0, 0.39, 0, 0];
LBR4p_DH_a = [0, 0, 0, 0, 0, 0, 0];
LBR4p_DH_alpha = [pi/2, -pi/2, pi/2, -pi/2, pi/2, -pi/2, 0];
LBR4p_DH_type = double(repmat(DQ_JointType.REVOLUTE,1,7));
LBR4p_DH_matrix = [LBR4p_DH_theta;
                    LBR4p_DH_d;
                    LBR4p_DH_a;
                    LBR4p_DH_alpha
                    LBR4p_DH_type];

robot = DQ_SerialManipulatorDH(LBR4p_DH_matrix);
robot.set_effector(1+0.5*DQ.E*DQ.k*0.07);

can be replaced by a single call to LBR4pVrepRobot. Also, there is no need to do calls such as


vi.set_joint_target_velocities(jointnames, u);
q_dot(:,j) = vi.get_joint_velocities(jointnames);

because we have higher-level methods for those (e.g., set_configuration_space_positions, get_configuration_space_positions, etc).

Kind regards, Frederico

bvadorno commented 2 months ago

Thanks, @ffasilva.

You must be careful with the functions set_joint_target_velocities. They imply that the example considers joint dynamics (there is an inner loop control). If my memory does not fail me, this is not the case for set_configuration_space_positions. @juanjqo, can you confirm?

Kind regards, Bruno

juanjqo commented 2 months ago

Hi @bvadorno and @ffasilva

I completely forgot everything about the mentioned example and I had to review some previous discussions. I have some minor comments that I'd like to mention here for myself in the future.

juanjqo commented 2 months ago

@bvadorno @ffasilva may I update the example?

ffasilva commented 2 months ago

Hi @juanjqo,

I would do it latter this week, but if you have the time now, go for it! I can then review it, if @bvadorno is okay with it.

Kind regards, Frederico

bvadorno commented 2 months ago

Dear @ffasilva and @juanjq,

Not yet. I’ll schedule a DQ Robotics meeting for this Friday, and I’ll use this particular example to illustrate how the current development flow needs to be amended.

Kind regards, Bruno