RVC3-MATLAB icon indicating copy to clipboard operation
RVC3-MATLAB copied to clipboard

EST2 in chapter 7 Matlab code of the exercise 7.1.1.1 2-Dimensional (Planar) Robotic Arms (chapter7.mlx)

Open ocaravaca opened this issue 1 year ago • 1 comments

This report is for bugs with the RVC3-MATLAB repo: bugs in the RVC3 Toolbox, missing files, incorrect documentation, broken links etc.

Reports related to MATLAB, Simulink or any of the MathWorks Toolboxes should be directed to MathWorks. They will not be actioned if posted here.

What environment are you using

Are you using MATLAB Online or desktop? If desktop what operating system?

Desktop / Windows / Matlab R2024b

Let's check your installed software

Include the results of running

>> rvccheck

Results:

rvccheck rvccheck for RVC3 Toolbox Some required Toolboxes are not installed: Navigation Toolbox is required for Chapter 5 You have Peter Corke's Robotics and/or Spatial Math Toolbox in your path

This is strange because the Navigation Toolbox is actually installed:

image

If this doesn't run, or produces no output please note that fact. It would mean something is very wrong with your MATLAB path or toolbox installation.

Describe the bug A clear and concise description of what the bug is.

In chapter 7 Matlab code of the exercise 7.1.1.1 2-Dimensional (Planar) Robotic Arms (chapter7.mlx) There is a bug when running the code:

>>a1 = 1;a2=5;
>>e = ETS2.Rz("q1")*ETS2.Tx(a1)
e = 
Rz(NaN)Tx(1)

This is later another problem when trying to run:

>> e.fkine(pi/6)
Operator '*' is not supported for operands of type 'string'.

Error in ETS2/fkine (line 143)
                        r = r * tform2d(0,0,v*opt.deg);

>> e.teach;
Error using zeros
NaN and Inf not allowed.

Error in ETS2/teach (line 388)
                q = zeros(1,robot.n);

The expected behavior is the one described in chapter 7 of the book "Robotics, Vision and Control Fundamental Algorithms in MATLAB®", 3rd edition 2023 and starting from page 278.

ocaravaca avatar Oct 06 '24 17:10 ocaravaca

Apparently, the problem is the use of "q1" in the code, so the error comes from using "" in the argument just as:

e = ETS2.Rz("q1") *ETS2.Tx(a1) Instead, we should use 'q1' >>e = ETS2.Rz('q1') * ETS2.Tx(a1) and it works. So, the issue is closed for me I guess.

ocaravaca avatar Oct 08 '24 18:10 ocaravaca

Thanks for reporting this. There are multiple issues going on here, so let me take them in order:

  1. The code from the book is not working for you, since Peter's old robotics toolbox is still on your MATLAB path. Notice the printout from rvccheck that says: You have Peter Corke's Robotics and/or Spatial Math Toolbox in your path. When you run which -all ETS2, you should see multiple definitions of ETS2. I suggest you remove Peter's old toolbox from the path. The RVC3-MATLAB toolbox executes your code without any errors.
  2. The message about Navigation Toolbox in the rvccheck output is a false positive / bug. This was fixed in https://github.com/petercorke/RVC3-MATLAB/commit/5cc96cfaef54bbb7fe9b8fba1779e2d3c6634611.

If you have any other issues, please feel free to reopen this issue or file a new one.

remo-pillat avatar Dec 21 '24 22:12 remo-pillat