.. _brash_juicer_running:


Using juicer to generate the message database
##############################################


These instructions describe how to run juicer to create a database for use with BRASH.


Run the database conversion node
================================

You can generate the database by running the following launch file in the brash workspace: 

.. code-block:: bash

   $ cd ~/code/brash
   $ source install/setup.bash  
   $ ros2 launch juicer_util generate_juicer_database.launch.py
        
You might need to modify the launch arguments if your cFS and juicer installation paths are different than the default arguments: 

* ``cfs_path``: ``~/code/cFS``
* ``juicer_path``: ``~/code/juicer``
* ``output``: ``combined.sqlite``

The  default ``input_list`` of objects to be processed is composed by the libraries found in the cf/ folder. If you 
create a new cFS application, you'll want to add its library here:

   .. code-block:: python
   
      ['core-cpu1', 'cf/cfe_assert.so', 'cf/ci_lab.so',
      'cf/ros_app.so', 'cf/sample_app.so', 'cf/sample_lib.so',
      'cf/sbn_f_remap.so', 'cf/sbn.so', 'cf/sbn_udp.so',
      'cf/sch_lab.so', 'cf/to_lab.so', 'cf/robot_sim.so',
      'cf/cf.so', 'cf/rover_app.so']
      
        
The launch file executes the **generate_juicer_database** node, which generates an ``sqlite`` database file at ``<juicer_path>/dbs`` with the name specified by ``<output>``. You might need to create the folder **dbs** in the juicer_path, if it does not exist yet.




View the database
=================

.. code-block:: bash

    $ sqlitebrowser

brings up this window

   .. figure:: _static/sqlb-default.png
      :width: 800px
      :alt: Enable TO output
      :align: center

#. Select **Open Database** and select the ``combined.sqlite`` file generated above (or whatever you defined the output name above as).
#. Select the **Browse Data** tab.
#. From the **Table** dropdown select **symbols**.

   .. figure:: _static/sqlb-symbols.png
      :width: 800px
      :alt: Enable TO output
      :align: center