convert_orientation()
  • 1 Minute to read

convert_orientation()


Article summary

Convert the orientation representation from either Euler angles (roll, pitch, yaw) or quaternion (x, y, z, w) to quaternion format.

Reference

Arguments

ArgumentsTypeDefault valueDescription
orientationdictDictionary representing the orientation. It can contain either Euler angles (roll, pitch, yaw) or quaternion (x, y, z, w).
unitsANGLE_UNITANGLE_UNIT.DEGREESThe unit for the Euler angles. Default is degrees.

Return

TypeDescription
Dictthe keys are (x, y, z , w) and the items are the respective value for the quaternion representation.

Exceptions

  • RayaWrongArgument

See the complete list of arms exceptions

Usage Example

... 
async def setup(self):
    self.arms: ArmsController = self.enable_controller('arms')
   
 ...
 async def loop(self):
    orientation= {
        'roll': 90.0,
        'pitch': 90.0
    }
    print(self.arms.convert_orientation(
            orientation=orientation))
...
    self.finish_app()

Output

{'x': 0.5, 'y': 0.5, 'z': -0.5, 'w': 0.5}

Was this article helpful?

What's Next