constraint Orientation Target quaternion

조회 수: 1 (최근 30일)
Denizhan AKINCI
Denizhan AKINCI 2024년 5월 3일
답변: Brahmadev 2024년 5월 15일
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]; % ??

채택된 답변

Brahmadev
Brahmadev 2024년 5월 15일
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!

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

태그

제품


릴리스

R2023b

Community Treasure Hunt

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

Start Hunting!

Translated by