1

I am running a simulation of a robot arm and I want an end effector to be directed to the center of a sphere while it's running a trajectory along the surface of a sphere.

My questions is how to calculate with pybullet a quaternion for end effector so it look towards center of a sphere if I have a center point coords and next/previous position coords for end effector.

pybullet.calculateInverseKinematics(self.xarm,xarmEndEffectorIndex, position, ornientation)

enter image description here

besch
  • 45
  • 4

1 Answers1

0
def euler_angles_from_vector(position, center):
    if center[0] > position[0]:
        x,y,z = center-position
    else:
        x,y,z = position-center
        
    length = math.sqrt(x**2 + y**2 + z**2)
    pitch = math.acos(z/length)
    yaw = math.atan(y/x)
    roll = math.pi if position[0] > center[0] else 0

    euler_angles = [roll,pitch,yaw]
    return euler_angles
besch
  • 45
  • 4