1

To control a robotic arm, I have a controller with 6 dimensions (x, y, z position, and roll, pitch, yaw rotation). I am using a position (x, y, z) and quaternion (x, y, z, w) to represent the desired position and orientation of the robot's gripper.

I am using some libraries that people might not be familiar with (namely, geometry_msgs from ROS), so here is what I'm doing in pseudocode:

while(true):
  new_position = last_position + (joy.x, joy.y, joy.z)
  new_quaternion = last_quaternion * quaternionFromRPY(joy.roll, joy.pitch, joy.yaw)

  // (Compute inverse kinematics using position and orientation, then send to robot arm)

  last_position = new_position
  last_quaternion = new_quaternion

  delay(dt)

I am able to set the x, y, and z of the position part of the pose just fine. Technically, I am also able to set the quaternion just fine as well, but my problem is that controlling the quaternion is extremely non-intuitive, since rotation is not commutative. i.e., if I rotate 180 degrees about the x-axis, then the control of the rotation about the z-axis gets inverted.

Is there any way that I can control the rotation from a sort of "global reference frame," if that makes any sense? I would like it so that if I twist the joystick clockwise about z, the pose will rotate accordingly, instead of "sometimes rotating clockwise, sometimes rotating counterclockwise."

4

1 に答える 1

1

これは、四元数積の要素の順序を交換するのと同じくらい簡単ではありませんか?

単位四元数qは、ローカル座標のベクトルをグローバル座標vの回転ベクトルに変換します。q*v*q'修正四元数a*q*b(a, b単位四元数も) は次のように変換vされます。

a*(q*(b*v*b')*q')*a', 

ここで、b 部分はローカル座標での回転として解釈でき、a 部分はグローバル座標での回転として解釈できます。

したがって、グローバル座標のみに回転を適用するには、 を設定しますb=1。つまり、それを省略し、目的の回転をa係数に入れます。

于 2014-04-28T12:51:40.967 に答える