
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/robolab/example_coordinate_transform.py"
.. LINE NUMBERS ARE GIVEN BELOW.

.. only:: html

    .. note::
        :class: sphx-glr-download-link-note

        :ref:`Go to the end <sphx_glr_download_examples_robolab_example_coordinate_transform.py>`
        to download the full example code

.. rst-class:: sphx-glr-example-title

.. _sphx_glr_examples_robolab_example_coordinate_transform.py:


Coordinate transform
========================

This example shows how to transform coordinates between different reference frames and rotation representations.

.. GENERATED FROM PYTHON SOURCE LINES 7-21

.. code-block:: default


    import rofunc as rf
    import numpy as np

    # Rot_quat = rf.robolab.quaternion_about_axis(-np.pi / 2, [0, 1, 0])
    # Rot_matrix = rf.robolab.homo_matrix_from_quaternion(Rot_quat)
    #
    # q = rf.robolab.quaternion_multiply([1, 0, 0, 0], Rot_quat)
    # print(q)

    a = rf.robolab.quaternion_from_euler(0, 0, np.pi/4)
    b = rf.robolab.quaternion_from_euler(0, 0, -np.pi/2)
    q = rf.robolab.quaternion_multiply([0, -0.707, 0, 0.707], a)
    print(q)


.. rst-class:: sphx-glr-timing

   **Total running time of the script:** (0 minutes 0.000 seconds)


.. _sphx_glr_download_examples_robolab_example_coordinate_transform.py:

.. only:: html

  .. container:: sphx-glr-footer sphx-glr-footer-example




    .. container:: sphx-glr-download sphx-glr-download-python

      :download:`Download Python source code: example_coordinate_transform.py <example_coordinate_transform.py>`

    .. container:: sphx-glr-download sphx-glr-download-jupyter

      :download:`Download Jupyter notebook: example_coordinate_transform.ipynb <example_coordinate_transform.ipynb>`


.. only:: html

 .. rst-class:: sphx-glr-signature

    `Gallery generated by Sphinx-Gallery <https://sphinx-gallery.github.io>`_
