robotics-toolbox-matlab icon indicating copy to clipboard operation
robotics-toolbox-matlab copied to clipboard

SerialLink.double and Link.double

Open aminya opened this issue 5 years ago • 3 comments

Link.double converts link parameters to numeric (double) type

dl = l.double is a Link object in which all the parameters are numeric ('double') type.

Useful when you are using Pi=sym('pi') to avoid round off errors (e.g in sin(Pi/2)), but later you want to pass the link object to a method (e.g. ikine) which only supports real numbers.

Will give an error if a symbolic variable is not convertible to double number.

See also SerialLink.double

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

SerialLink.double converts SerialLink object parameters to numeric (double) type

dr = r.double is a SerialLink object in which all the parameters are numeric ('double') type.

Useful when you are using Pi=sym('pi') to avoid round off errors (e.g in sin(Pi/2)), but later you want to pass the SerialLink object to a method (e.g. ikine) which only supports real numbers.

Will give an error if a symbolic variable is not convertible to double number.

See also Link.double

Author: Amin Yahyaabadi ([email protected])

aminya avatar Jul 08 '19 23:07 aminya

@petercorke I added two methods to Link and Serial Link which convert the parameters of both object to double.

aminya avatar Jul 11 '19 01:07 aminya

I'm not sure double() is the right name for this. Generally double() converts some representation to a native vector/matrix representation. Perhaps simplify() or symeval() or something.

petercorke avatar Jul 14 '19 00:07 petercorke

I'm not sure double() is the right name for this. Generally double() converts some representation to a native vector/matrix representation. Perhaps simplify() or symeval() or something.

From Matlab document: double(s) converts symbolic values to MATLAB double precision. It is part of the symbolic toolbox.

But as you said double() is also the name for another function that just converts other numeric types to double type. double

simplify is different from the double function. double function converts numbers that are defined as symbolic to double. Such as sym(pi)

aminya avatar Jul 14 '19 00:07 aminya