constraint Orientation Target quaternion

4 views (last 30 days)
Hello again, dear community,
I'm seeking some clarity on the concept of constraintOrientationTarget, particularly regarding how TargetOrientation functions. Despite reviewing the explanation provided by MathWorks here, I'm still struggling to grasp its practical application. The example provided doesn't directly incorporate TargetOrientation, leaving me a bit perplexed. Could someone kindly offer guidance on how to effectively utilize it? Your assistance is greatly appreciated.
Many thanks in advance!
fixOrientation = constraintOrientationTarget(gripper);
fixOrientation.ReferenceBody = bodyName; % This is an object to be picked up
fixOrientation.TargetOrientation = [1 0 0 0]; % ??

Accepted Answer

Brahmadev
Brahmadev on 15 May 2024
As mentioned in the documentation you linked, Target orientation of the end effector relative to the reference body, specified as four-element vector that represents a unit quaternion. A quaternion is composed of four components: (q = [w, x, y, z]), where (w) is the real part, and (x), (y), and (z) form the vector part. This quaternion represents a rotation in 3D space, where:
  • (w): Represents the cosine of half the rotation angle.
  • (x, y, z): Represent the axis of rotation, scaled by the sine of half the rotation angle.
The unit quaternion (where the magnitude is 1) ensures that the rotation is purely orientational without any scaling.
Default Orientation ([1, 0, 0, 0]): This quaternion represents no rotation from the reference frame. If the end effector's TargetOrientation is set to this, it means the end effector is expected to maintain its current orientation with respect to the reference body's frame without any additional rotation.
For example, suppose you want the end effector to be rotated by 90 degrees around the Z-axis relative to the reference body. This rotation can be represented by a quaternion. The quaternion for a 90-degree rotation around the Z-axis is calculated as follows:
  • Angle(theta): 90 degrees or pi/2 radians.
  • Rotation Axis: Z-axis, which is represented as ([0, 0, 1]) in 3D space.
Using the formula for a quaternion representing a rotation:
[q = [cos(theta/2), sin(theta/2)*axisX, sin(theta/2)*axisY, sin(theta/2)* axisZ]
For a 90-degree rotation around the Z-axis:
[q = [cos(pi/4), 0*sin(pi/4), 0*sin(pi/4), 1*sin(pi/4)] = [0.7071, 0, 0, 0.7071]]
So, if you want the end effector to achieve this orientation relative to the reference body, you would set:
fixOrientation.TargetOrientation = [0.7071, 0, 0, 0.7071];
Hope this helps!

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Tags

Products


Release

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!