Skip to main content

Target Setup and First Steps

    Before you Begin

    Before starting with the setup guide, we recommend the following to get familiar with CGI-Studio:

    • Explore CGI-Studio
      Read the Quick Start Guide. 
    • Learn to create SceneComposer Solutions
      The documentation provides instructions on how to create simple SceneComposer solutions. To access SceneComposer navigate to: 
      <cgi-studio-installation-path>\bin\SceneComposer\SceneComposer.exe
    • Generate Assets for Simulation and Target Environments
      You can find guidance on generating assets from solutions (binary files containing solution information for the player) for both simulation and target environments in the documentation.

    With this knowledge you should be fit to complete this guide.


    Software Image Setup

    The CGI Studio Community Edition supports both Raspberry Pi 4 and Raspberry Pi 5. The following section describes how you can install the Community Edition on your Raspberry Pi device. Additional information about the proper setup and configuration of a Raspberry Pi device can be found in the official Raspberry Pi documentation. It also contains information on how to get started with your Raspberry Pi device. Complete the following steps to prepare your Raspberry Pi for the installation of the CGI Studio Community Edition.

    1. Download and install the Raspberry Pi Imager from this linklink: (https://www.raspberrypi.com/software/)Raspberry Pi software – Raspberry Pi.
    2. Insert a compatible SD card into your computer for flashing the image.
    Open Raspberry Pi Imager and in the Device section select Raspberry Pi Imager4 or Raspberry Pi 5, depending on your model. Afterwards click "Next".

    Raspberry Pi 5 selection

    In the menu Choose operating system select "Raspberry Pi OS (64-bit)". Then click "Next".

    OS selection

    In the storage section, select the inserted SD card, and click on"Next". chooseIn device.the Customization step click "Next" till the "Customisation: SSH authentication" configuration occurs. Make sure that SSH is enabled.

    image.pngimage.png


    Click on"Next" Raspberryand Pi 5.

    image.png


    Next choosewrite the OS and scrollimage to “Use custom.”

    image.png


    Click Ok and browse for the downloaded .img file provided by Candera and open.

    image.png


    Next choose storage and select the SD cardcard. 64gbThis which is inserted and click on next, this willmay take some time to flash OS on SD card.
    time. NowFinally eject the SD card formfrom Laptop/your PC.

    FlashRaspberry OSPi Startup

    This section outlines the initial hardware setup, booting, and first-time configuration process for setting up the operating system on a Raspberry Pi 54
    or a Raspberry Pi 5.

    1. Insert the SD Card: Insert the flashed SDmicroSD card securely into Raspberrythe pidedicated 5card board.
    slot Connecton theyour Raspberry Pi boardboard. to a

    Connect display,Hardware: connectConnect USB for touch, and insert SD card intoyour Raspberry Pi boardto an external display (using a micro-HDMI to HDMI cable), plug in your USB touch interface/peripherals or connect to DSI cable, and switch onconnect the official USB-C power supply.supply to power it on.

    Initial Boot & Setup: The OS will automatically startbegin its initial boot diagnostics. Follow the on-screen configuration wizard to installset onup Raspberryyour Pi.
    region, skip the Wi-Fi and connect LAN, and establish your core username and password. Boot to Desktop: Once you complete the wizard, the system will finalize its settings and boot directly into the desktop user interface. Once installedinstalled, you can seethe OS UI will appear on the display. 

    Connecting to the Raspberry Pi using SSH(SSH (WinSCP)

    After booting, connect to the target device via SSH or a serial terminal (e.g., Tera Term). orThis SSH.connection is required to transfer files and execute commands. Additional information on how to connect can be found here.

    At Candera we haveuse used WinSCP to transfer additional files to the target device as needed.
    After this step, your target system will be prepared to run Python-based data binding examples or any assets using the CGI-Studio runtime environment.
    The login credentials for the connection are -
    Username: candera 
    Password: candera

    image.png

    NOTE : To get the IP address of the RPi5 once it is connected to LAN, connect RPi5 with a keyboard and press “Ctrl+Alt+F4”. This will open a window asking for username and password, put candera for both and enter the command “ip addr show”, this will show the ip address of the connected network. Once you connect to the network using WinSCP or tera-term, press “Ctrl+Alt+F1” to come back to main screen.
    device.


    Blood Pressure Sample

      We have prepared several samples to demonstrate the capabilities of CGI-Studio on the target image. These samples are located at:
      /opt/candera/Samples/ on the target image and in <cgi-studio-installation-path>\bin\ProfessionalEdition\Python\Samples on the host computer.
      We will use the

      Run Blood Pressure Sample aswith anTarget examplePlayer

      to demonstrate how to run our samples.

      The Blood Pressure deviceDevice sample is a Scene Composer sample that showcasesdemonstrates a blood pressure measurement device with exemplary scenes and animations.

      General Forinformation on this sample can be found in the ProfessionalBlood Edition,Pressure Solution documentation.

      Execute the following command on the Raspberry Pi device to run the sample wasusing our target player.

      Player /opt/candera/Samples/BloodPressureDevice/BloodPressureDevice.bin

      The asset will be visible on the target device.

      Blood pressure example

      Run Blood Pressure Sample with Player Connector Library 

      The Blood Pressure Sample sample is extended with a data binding sample programmed in Python. The Python part of the sample relies on the Python-basedBased playerPlayer dataData bindingBinding libraryLibrary to interact with the data bindings of the scene.

      In this section we will explain how to run the BloodPressureSample with our precompiled target player and with the Player Connector Library. For this chapter the completed “Image Setup” is required.

      Run Blood Pressure Sample with Target Player

      Follow the steps given below to run the Blood Pressure sample on the target with our precompiled target player:

      1. Navigate to the player directory.

      cd /opt/candera/Player

      2. Run the Asset
          Execute the below command in the terminal

      ./Player ../Samples/BloodPressureDevice/BloodPressureDevice.bin

      3. The Asset will be visible on the target device.    

      image.png


      Run Blood Pressure Sample with Player Connector Library 

      Once the hardware is set up follow these steps to configure the Python environment and execute the sample.

      The Python code for the blood pressure device sample can be found under:
      <cgi-studio-installation-path>\bin\CommunityEdition\Python\Samples\BloodPressureDevice on the host computer and in /opt/candera/Python/Samples/BloodPressureDevice on the target, after successful installation of the debian package.

        Follow

        Inthe Targetsteps open terminal and navigatebelow to projectrun directory
        the Blood Pressure Sample with player connector library.
          Move to the directory: Open the terminal on your Raspberry Pi and move to the specific sample directory:
          Commanddirectory. -
          cd /opt/candera/Python/Samples/BloodPressureDevice
          Prepare the System Environment
          Before running the application, ensure the system package list is up to date and that the Python virtual environment module is installed:
          Commands - 
          sudo apt update
          sudo apt install python3-venv
          Configure and activate the Python Virtual EnvironmentEnvironment:
          Creating a virtual environment ensures that the dependencies for the Candera sample do not conflict with other system libraries.
          1. Create the environment: 
          python3
          python -m venv .
          2. Activate the environment: source bin/activate
          source bin/activate

          Install DependenciesDependencies:
          Install the required Python packages defined in the project's requirements file:
          Commandfile. -
          pip install -r ./requirementsWithoutSoundhound.txt

          Configure Environment Variables
          For

          Run the applicationSample:

          to locate the Candera libraries and GStreamer plugins, you must export the following paths.
          Important: These exports are session-specific. If you close the terminal, you will need to run them again.
          Commands - 
          export PYTHONPATH=$PYTHONPATH:/opt/candera:/opt/candera/CanderaAppConnector:/opt/candera/Samples/BloodPressureDevice
          export GST_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/gstreamer-1.0
          export GSTREAMER_ROOT=/usr/lib/aarch64-linux-gnu/

          Run

          Execute the Blood Pressure Sample
          ExecuteDevice python script using the mainfollowing scriptflags.

          by
          pointing-wsh it: toDisable theSoundHound Playerintegration Connector-lbp library: andLibrary thebinary compiledpath asset-abp file:: Asset binary path
          Command  - 
          python3
          python BloodPressureDevice.py -wsh -lbp /opt/candera/PlayerConnector/lib/libPlayerConnectorLibrary.so \
          -abp /opt/candera/Python/Samples/BloodPressureDevice/BloodPressureDevice.bin
          -wsh

                Verification: Upon execution, the Blood Pressure Device UI should initialize and appear on your connected Raspberry Pi display.
                NOTE: If the display is portrait mode butthen ifit needs to be rotated to landscape mode.
                Command - sudo XDG_RUNTIME_DIR=/tmp wlr-randr --output DSI-12 --transform 90


          Run

          Empty Solution with Slider and Gauge Control

          This chapter shows how you can create your own solution with Python data binding through a simple use case, and how to run it on host and target. It is using a Gauge Control for HMI data output for the user and a Slider Control for HMI data input via user.

          Before proceeding with the example, it is recommended to explore CGI-Studio by reading the Quick Start Guide, both of which are available in the CGI-Studio Documentation.

          The documentation also contains information on how to create simple SceneComposer solutions.

            Start Scene Composer in <cgi-studio-installation-path>\bin\SceneComposer\Scenecomposer.exe


            Open Empty Solution by either double clicking the empty solution thumbnail or through the File > New Solution dialog.image.png In the Render Targets panel (on the right side of the SceneComposer), set the resolution of Display (0) to X Resolution (width) of 800 and Y Resolution (height) of 480.

            image.png

            Drag and drop a Slider Control and a Gauge Control from the Control section of the Toolbox (on the right side of the Scene Composer) into the Scene Editor.

            image.png

            You can move the controls in the Scene Editor by selecting the translation icon (the red square in the screenshot below) in the top left corner of the Scene Editor and then selecting the control which you want to move. Just select the item you want to move and drag it to a new location.

            image.png

            Select the Gauge Control in either the Scene Editor or the Scene Tree, navigate to the properties, and adjust the scale to ensure it fits comfortably within the display.

            image.png

            To set up a data binding for the Gauge value, first select the Gauge either in the Scene Editor or the Scene Tree. In the properties panel locate the Value property under the Control section and click the chain icon next to it to establish the binding.

            image.png


            A "Define Data Binding" window will appear. In this window, select Item1 (under PredefinedBindingSource1). Finally, click OK at the bottom to confirm your selection.

            image.png


            To set a data binding for the Slider property, select the Slider control in either the Scene Editor or the Scene Tree. Then, click the chain icon next to the Value property in the Control section of the Properties panel. Next, choose Item2 (under PredefinedBindingSource1) from the available options.

            Next, generate an asset library for the target environment to run the solution in the player.
              Save the solution, then go to File > Generate Asset Library

              image.png


              A popup window will appear, allowing you to generate the asset library. Choose your desired asset location, set the environment to “Target”, then click “Generate” to create each asset library.

              image.png



              Next, create a Python script. You can use the provided Sample.py file located in 
              <cgi-installation-path>\bin\CommunityEdition\Pythony\Samples\SliderAndGauge\Sample.py in your local CGI-Studio installation folder and in /opt/cgistudio/Python/Samples/SliderAndGauge/Sample.py on the target. Run the asset on the target device:
              Ensure the device is set up correctly according to the chapter Software Image Setup. Use WinSCP or a similar tool to copy the generated target asset from the host computer to the target device.
              Run it analogous to the steps from chapter Run Blood Pressure Sample with Player Connector Library
                In Target open terminal and navigate to project directory
                       Open the terminal on your Raspberry Pi and move to the specific sample directory:
                       Command - cd /opt/candera/Samples/SliderAndGauge

                . Prepare the System Environment
                Before running the application, ensure the system package list is up to date and that the Python virtual environment module is installed:
                Commands - 
                sudo apt update
                sudo apt install python3-venv

                Configure the Python Virtual Environment
                Creating a virtual environment ensures that the dependencies for the Candera sample do not conflict with other system libraries.
                1. Create the environment:    
                python3 -m venv .
                2. Activate the environment: source bin/activate
                source bin/activate

                Configure Environment Variables
                For the application to locate the Candera libraries and GStreamer plugins, you must export the following paths.
                Important: These exports are session-specific. If you close the terminal, you will need to run them again.
                Commands - 
                export PYTHONPATH=$PYTHONPATH:/opt/candera:/opt/candera/CanderaAppConnector:/opt/candera/Samples/SliderAndGauge
                export GST_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/gstreamer-1.0
                export GSTREAMER_ROOT=/usr/lib/aarch64-linux-gnu/

                Run the Slider and gauge Sample
                Execute the main script by pointing it to the Player Connector library and the compiled asset file:
                Command  -
                python3 Sample.py  -lbp /opt/candera/PlayerConnector/libPlayerConnectorLibrary.so -abp /opt/candera/Samples/SliderAndGauge/SliderAndGauge.bin

                Verification: Upon execution, the Slider and gauge UI should initialize and appear on your connected Raspberry Pi display. The slider and gauge moves accordingly.