Hi, I’m building something a bit more complex than a pneumatic cylinder on the platform, and since I need to assemble some parts together, what’s bothering me now is the transformation of the origin coordinates, for example I want to fit a small part in a specific position on the base link as needed, which involves how I can rotate the origin coordinates of a part by 90 degrees around some axis, like the joint link For example, in the origin settings in joint link, there are X, Y, Z, dx, dy, dz, dw, and I can imitate entering 0.707 in the dx option (which looks like a √2/2 calculation, but I don’t really understand why entering 0.707 would rotate it 90 degrees around the X axis), and when I enter 0.707 in dy in the same way, it doesn’t rotate 90 degrees as I thought it would. I don’t know if the math involved has to do with quaternions or the requirements of the physics engine behind it, and I would appreciate if someone could advise on the mechanics of this or the basics needed.
Hi, the value of every origin is currently displayed as a quaternion in the 3D editor. The easiest way to achieve what you want to do is to use an online rotation converter. In the box that says “Euler angles of multiple axis rotations (degrees)” you can enter the values of how you want to rotate the object. Then simply copy the values that appear in the Output box called “Quaternion [x, y, z, w]”. These are the values that are called dx, dy, dz, dw in Simumatik. Note that the drop down menu that says “XYZ” in the Euler box specifies in which order the rotations will be applied.
As a side note, if you want to modify the rotations from inside a behavior script, the following functions can help you convert simple Euler angles into a quaternion that can be output to a smtk_transform variable (connected to some origin), and the other way around.
# Converting from quaternion to Euler output_origin = [0.0, 0.0, 0.024, 0.7071, 0.0, 0.0, 0.7071] [x, y, z, R, P, Y] = Transform2Euler(output_origin) # Modify the angles P = -numpy.pi/2 + numpy.pi * aperture # Converting back to a quaternion and updating the output output_origin = Transform2Quat([x, y, z, R, P, Y])
Hej! the problem was easily solved by the first method, thanks a lot! I will test the second way later, it seems that we can also learn some math, physics and python on this platform, it’s great!