Processors
==========

Introduction
~~~~~~~~~~~~

Here is an overview of ``onshape-to-robot`` pipeline:

.. image:: _static/img/architecture.png

* **(1)**: The assembly is retrieved from Onshape, to produce an intermediate representation of the robot. See the `robot.py <https://github.com/Rhoban/onshape-to-robot/blob/master/onshape_to_robot/robot.py>`_ from the source code.
* **(2)**: Some operations can be applied on this representation, those are the **processors**, some of them are listed below.
* **(3)**: The robot is exported to the desired format (URDF, MuJoCo, etc.) using an **exporter**.

.. note::

    If you want to tweak your robot in the process, do not hesitate to have a look at the `export.py <https://github.com/Rhoban/onshape-to-robot/blob/master/onshape_to_robot/export.py>`_ script, which is the entry point of the ``onshape-to-robot`` command, and summarize the above-listed steps.

Retrieve and Convert Modes
~~~~~~~~~~~~~~~~~~~~~~~~~~

It is possible to only execute the retrieval step **(1)**, by passing the ``--retrieve`` argument to the ``onshape-to-robot`` command. This will save the intermediate representation of the robot to a file named ``robot.pkl`` in the output directory.

Similarly, steps **(2)** and **(3)** can be executed by passing the ``--convert`` argument, which will load the robot from the ``robot.pkl`` file. Processors will then be executed and the exported will produce the final output. This can be convenient to avoid sending API requests to Onshape while tweaking processors or exporters.

You can also use the ``--save-pickle`` argument to save the robot data after retrieval while still proceeding to conversion.

Processors list
~~~~~~~~~~~~~~~

.. toctree::
   :maxdepth: 2
   :caption: Processors:

   processor_ball_to_euler
   processor_merge_parts
   processor_simplify_stls
   processor_scad
   processor_dummy_base_link
   processor_no_collision_meshes
   processor_collision_as_visual
   processor_convex_decomposition
   processor_fixed_links
   custom_processors
