
.. DO NOT EDIT.
.. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY.
.. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE:
.. "examples/robolab/example_curi_forward_dynamics.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_curi_forward_dynamics.py>`
        to download the full example code

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

.. _sphx_glr_examples_robolab_example_curi_forward_dynamics.py:


CURI forward dynamics
========================

Forward dynamics of the CURI robot.

.. GENERATED FROM PYTHON SOURCE LINES 7-33

.. code-block:: default

    import os

    import numpy as np
    import pinocchio

    import rofunc as rf
    from rofunc.utils.oslab.path import get_rofunc_path

    model = pinocchio.buildModelFromUrdf(
        os.path.join(get_rofunc_path(), "simulator/assets/urdf/curi/urdf/curi_pinocchio_test.urdf"))
    print('model name: ' + model.name)
    data = model.createData()

    q = pinocchio.randomConfiguration(model)
    q = pinocchio.normalize(model, q)
    v = np.matrix(np.random.rand(model.nv, 1))
    tau = np.matrix(np.random.rand(model.nv, 1))

    ddq = rf.robolab.fd(model, data, q, v, tau)
    print(ddq)

    # pinocchio.computeABADerivatives(model, data, q, v, tau)
    #
    # ddq_dq = data.ddq_dq  # Derivatives of the FD w.r.t. the joint config vector
    # ddq_dv = data.ddq_dv  # Derivatives of the FD w.r.t. the joint velocity vector
    # ddq_dtau = data.Minv  # Derivatives of the FD w.r.t. the joint acceleration vector


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

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


.. _sphx_glr_download_examples_robolab_example_curi_forward_dynamics.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_curi_forward_dynamics.py <example_curi_forward_dynamics.py>`

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

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


.. only:: html

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

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