possible major issue with toolbox ver 10.1 and angle usage

247 views
Skip to first unread message

jasonkol...@gmail.com

unread,
Nov 10, 2017, 2:48:56 PM11/10/17
to Robotics & Machine Vision Toolboxes

I have been struggling with this a lot and have posted before. However I dove into the toolbox functions and it seems like there is a big mistake.  I'm trying to use the simple command rpy2r to make a rotation matrix from roll, pitch, yaw angles. The problem is I give it Radians like the textbook uses but it appears to be expecting degrees and this is when the 'deg' option is not given.

The problem I see is that rpy2r is expecting radians (unless 'deg' is given) it then ensures the angle is in radians. It then sends this to rotz.m which is expecting degrees. Is anyone else having this issue? please help.
-Jason


Watch. Isn't 45 supposed to be radians in this example?
>> rpy2tr([45,0,0])
ans =
    1.0000         0         0         0
         0    0.7071   -0.7071         0
         0    0.7071    0.7071         0
         0         0         0    1.0000

however see the code for rpy2r.m

% optionally convert from degrees
    if opt.deg
        disp('converting from degrees')  I added this to see. this convert the given value in degrees to radians. It is not enabled since i didn't use 'deg'.
        d2r = pi/180.0;
        roll = roll * d2r
        pitch = pitch * d2r;
        yaw = yaw * d2r;
    end

    switch opt.order
        case {'xyz', 'arm'}
            % XYZ order
            if numrows(roll) == 1
                R = rotx(yaw) * roty(pitch) * rotz(roll);
            else
                R = zeros(3,3,numrows(roll));
                for i=1:numrows(roll)
                    R(:,:,i) = rotx(yaw(i)) * roty(pitch(i)) * rotz(roll(i));
                end
            end
        case {'zyx', 'vehicle'}
            % ZYX order
            if numrows(roll) == 1
                R = rotz(yaw) * roty(pitch) * rotx(roll); it uses the RPY in radians now with these functions. see below of those functions.
            else
                R = zeros(3,3,numrows(roll));
                for i=1:numrows(roll)
                    R(:,:,i) = rotz(yaw(i)) * roty(pitch(i)) * rotx(roll(i));
                end
            end


This is rotz.m



eml_assert_no_varsize(1,gamma);
sigdatatypes.validateAngle(gamma,'rotz','GAMMA',{'scalar'});
% rotate in the direction of x->y, counter-clockwise
rotmat = [cosd(gamma) -sind(gamma) 0; sind(gamma) cosd(gamma) 0; 0 0 1];  Here it is expecting degrees. So this is a problem right?

jasonkol...@gmail.com

unread,
Nov 11, 2017, 4:48:08 PM11/11/17
to Robotics & Machine Vision Toolboxes
figured out my problem. My university has the Phased Array toolbox. Somehow that was taking presidence over the robotics toolbox. The startup_rvc script seems to have fixed this. thank god! I should be better now. Might need to have that be a notice somewhere when the toolbox installs from the mtlbx functdion

thanks all. looking forward to getting back to robotics
jason

jasonkol...@gmail.com

unread,
Nov 11, 2017, 4:48:08 PM11/11/17
to Robotics & Machine Vision Toolboxes
I think I found my problem but not the solution.

matlab has a rotx command. So does the robotics toolbox. it seems like my version of matlab prefers the matlab version which is in DEG. The toolbox is in RAD. So all of the functions in the Robotics toolbox that do rotations (many) all deep inside use rotx, roty, rotz but the matlab version not the toolbox. Any suggestions? I've tried to move the toolbox around in the pathtool but that didn't help. Thanks everyone sorry for so many posts to find this issue

Jason



On Friday, November 10, 2017 at 2:48:56 PM UTC-5, jasonkol...@gmail.com wrote:

Peter Corke

unread,
Nov 11, 2017, 5:59:59 PM11/11/17
to Robotics & Machine Vision Toolboxes
Jason,

glad it's fixed.  I suspected as much in my earlier post, this problem has come up before for users with the TAH licence and every toolbox installed.  

In my defence I will note that the doc for rotx says

       Introduced in R2013a


which is  long after my toolbox introduced it in 1994!

I could change startup_rvc to detect this, but it adds the toolbox to the head of the path which hides the problem anyway.  .mltbx install seems to add the paths to the tail, after the Mathworks toolboxes which is why the problem occurs.  But I don't think there's anyway for a script to be executed at install time to check for this.

I'd be really happy to have suggestions about what to do.  Testing for the correct rotx at every instance in RTB would be a pain.

Peter

Jason Kolodziej

unread,
Nov 12, 2017, 3:04:43 PM11/12/17
to robotics...@googlegroups.com
Thanks peter 
Love the toolbox
I don't think there is a easy solution. Maybe just a line next to the download that says if you have the Phase toolbox make sure to run the script after the install. 
I tried dragging the toolbox to the top of the path without success but I didn't try to hard. Looking forward to getting back to the class work 
Jason

Sent from my iPhone
--
You received this message because you are subscribed to a topic in the Google Groups "Robotics & Machine Vision Toolboxes" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/robotics-tool-box/R-TgnkS-kMA/unsubscribe.
To unsubscribe from this group and all its topics, send an email to robotics-tool-...@googlegroups.com.
To post to this group, send email to robotics...@googlegroups.com.
Visit this group at https://groups.google.com/group/robotics-tool-box.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages