Table of Contents

Introduction

ORemoteCamera provides Remote Frame Grabbing on Windows and x86 Linux platforms. You are able to develop applications on the x86 Windows or Linux platforms using the OCamera API. The respective libraries (Windows DLL, or x86 Linux Shared Object) tunnel the API calls using SOAP to the smart camera daemon camerad. This daemon is started automatically at boot-time (/ffx/rcS).

ORemoteCamera - Windows Version

Install ORemoteCamera-3.2.0-festo0-20080625.exe (version may vary) on your Windows Plattform. After the successful installation you find a example solution (default installation path C:\Program Files\Festo\ORemoteCamera\example).

image grabbed: 3616 bytes
image grabbed: 3616 bytes
image grabbed: 3616 bytes
image grabbed: 3616 bytes
image grabbed: 3616 bytes
image grabbed: 3616 bytes
image grabbed: 3616 bytes
image grabbed: 3616 bytes
image grabbed: 3616 bytes
image grabbed: 3616 bytes
please press return

ORemoteCamera - Linux Version

* Get and extract ORemoteCameraLinux-3.2.0-festo0.tar.gz (version may vary) on your Linux PC.

$ tar xzvf ORemoteCameraLinux-3.2.0-festo0.tar.gz
...
$ cd ORemoteCameraLinux-3.2.0-festo0/ 

Example: Controlling the LEDs

This example shows how to use the smart cameras' LEDs. You can compile it for the smart camera (using arm-linux-gcc and linking against libcamera.so), or you can compile for x86 Linux or Windows platforms using ORemoteCamera.

/********************************************************************
 *
 * Digital LED example programm.
 *
 *
 * Note for ORemoteCamera users:
 * please compile with -DOREMOTECAMERA in order to link it against
 * the ORemotecamera linux library. If you compile it for Windows you
 * don't need to provide this preprocessor switch.
 *
 ********************************************************************/
 
#ifdef WIN32
  #ifndef OREMOTECAMERA
    #define OREMOTECAMERA
  #endif
#endif
 
#ifdef OREMOTECAMERA
  #include "OCamera_remote.h"
#else
  #include "OCamera.h"
#endif
 
#include <stdio.h>
#include <stdlib.h>
#include <string>
 
#ifdef WIN32
  // SleepEx
  #include <windows.h>
#else
  // msleep
  #include <unistd.h>
#endif
 
void msleep( unsigned int ms )
{
#ifdef WIN32
  SleepEx( ms, false );
#else
  ::usleep( ms * 1000 );
#endif
}
 
OCameraLEDs     *pLED;
 
int main(int argc, char* argv[])
{
 
#ifdef OREMOTECAMERA
  std::string sRemoteHost("192.168.2.10:8080");
  if(argc > 1)
  {
    sRemoteHost = argv[1];
  }
#endif
 
#ifdef OREMOTECAMERA
  pLED = CreateCameraLEDs( sRemoteHost.c_str() );
#else
  pLED = OCameraLEDs::poCreateInterface();
#endif
  if( NULL == pLED )
  {
    printf("Error creation LEDs interface");
    goto Error_LED;
  }
  if(pLED->iOpen() < 0)
  {
    printf("Error opening LEDs");
    goto Error_LEDOpen;
  }
 
  // now all interfaces are successfully attached and opened
  printf("Hello!");
 
  //////////////////////////////////////////////////////////////////////////////////////
  // now enter code for personal use
  //////////////////////////////////////////////////////////////////////////////////////
  int LEDValue;
  LEDValue = pLED->iGetLEDs();
  printf("Actual LED-State %#x (D C B A)", LEDValue);
  printf("\tLED A green  red = %s %s", (LEDValue & OCameraLEDs::LED_0_GREEN)  ? "ON" : "OFF", \
                                        (LEDValue & OCameraLEDs::LED_0_RED)    ? "ON" : "OFF");
  printf("\tLED B green  red = %s %s", (LEDValue & OCameraLEDs::LED_1_GREEN)  ? "ON" : "OFF", \
                                        (LEDValue & OCameraLEDs::LED_1_RED)    ? "ON" : "OFF");
  printf("\tLED C yellow red = %s %s", (LEDValue & OCameraLEDs::LED_2_YELLOW) ? "ON" : "OFF", \
                                        (LEDValue & OCameraLEDs::LED_2_RED)    ? "ON" : "OFF");
  printf("\tLED D yellow red = %s %s", (LEDValue & OCameraLEDs::LED_3_YELLOW) ? "ON" : "OFF", \
                                        (LEDValue & OCameraLEDs::LED_3_RED)    ? "ON" : "OFF");
 
  pLED->iSetLED(OCameraLEDs::LED_ALL, 1);
  msleep(500);
  pLED->iSetLED(OCameraLEDs::LED_ALL, 0);
  msleep(300);
  pLED->iSetLED(OCameraLEDs::LED_0_GREEN, 1);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_0_RED, 1);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_1_GREEN, 1);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_1_RED, 1);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_2_YELLOW, 1);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_2_RED, 1);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_3_YELLOW, 1);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_3_RED, 1);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_0_GREEN, 0);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_0_RED, 0);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_1_GREEN, 0);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_1_RED, 0);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_2_YELLOW, 0);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_2_RED, 0);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_3_YELLOW, 0);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_3_RED, 0);
  msleep(200);
  pLED->iSetLED(OCameraLEDs::LED_ALL_RED, 1);
  msleep(500);
  pLED->iSetLED(OCameraLEDs::LED_ALL_RED, 0);
  msleep(300);
  pLED->iSetLED(OCameraLEDs::LED_ALL_GREEN, 1);
  msleep(500);
  pLED->iSetLED(OCameraLEDs::LED_ALL_GREEN, 0);
  msleep(300);
  pLED->iSetLED(OCameraLEDs::LED_ALL_YELLOW, 1);
  msleep(500);
  pLED->iSetLED(OCameraLEDs::LED_ALL_YELLOW, 0);
  msleep(300);
 
  // activate ONLY LEDs C and D and two even if a iState of 0xFF is chosen!!
  pLED->iSetLEDs(OCameraLEDs::LED_2_YELLOW | OCameraLEDs::LED_2_RED | \
                 OCameraLEDs::LED_3_YELLOW | OCameraLEDs::LED_3_RED, 0xFF);
  printf("Actual LED-State %#x", pLED->iGetLEDs());
  printf("\tLED C yellow red = %s %s", (pLED->iGetLED(OCameraLEDs::LED_2_YELLOW)) ? "ON" : "OFF", \
                                         (pLED->iGetLED(OCameraLEDs::LED_2_RED)) ? "ON" : "OFF");
  printf("\tLED D yellow red = %s %s", (pLED->iGetLED(OCameraLEDs::LED_3_YELLOW)) ? "ON" : "OFF", \
                                         (pLED->iGetLED(OCameraLEDs::LED_3_RED)) ? "ON" : "OFF");
  msleep(500);
 
  // toggle some outputs
  pLED->iToggleLEDs(OCameraLEDs::LED_2_YELLOW | OCameraLEDs::LED_3_RED);
  printf("Actual LED-State %#x", pLED->iGetLEDs());
  printf("\tLED C yellow red = %s %s", (pLED->iGetLED(OCameraLEDs::LED_2_YELLOW)) ? "ON" : "OFF", \
                                         (pLED->iGetLED(OCameraLEDs::LED_2_RED)) ? "ON" : "OFF");
  printf("\tLED D yellow red = %s %s", (pLED->iGetLED(OCameraLEDs::LED_3_YELLOW)) ? "ON" : "OFF", \
                                         (pLED->iGetLED(OCameraLEDs::LED_3_RED)) ? "ON" : "OFF");
  msleep(500);
 
  pLED->iToggleLED(OCameraLEDs::LED_3_YELLOW);
  printf("Actual LED-State %#x", pLED->iGetLEDs());
  printf("\tLED C yellow red = %s %s", (pLED->iGetLED(OCameraLEDs::LED_2_YELLOW)) ? "ON" : "OFF", \
                                         (pLED->iGetLED(OCameraLEDs::LED_2_RED)) ? "ON" : "OFF");
  printf("\tLED D yellow red = %s %s", (pLED->iGetLED(OCameraLEDs::LED_3_YELLOW)) ? "ON" : "OFF", \
                                         (pLED->iGetLED(OCameraLEDs::LED_3_RED)) ? "ON" : "OFF");
  msleep(500);
  //////////////////////////////////////////////////////////////////////////////////////
 
  //---------------------------------------------------------------------------
  // Cleanup
  //---------------------------------------------------------------------------
  // defined cleanup of all interfaces
  pLED->iClose();
Error_LEDOpen:
  pLED->Destroy();
Error_LED:
 
  printf("Goodbye!");
  return(EXIT_SUCCESS);
}

Example: Using In- and Outputs

This example shows how to use the smart cameras' IO. You can compile it for the smart camera (using arm-linux-gcc and linking against libcamera.so), or you can compile for x86 Linux or Windows platforms using ORemoteCamera.

/********************************************************************
 *
 * Digital IO example programm.
 *
 *
 * Note for ORemoteCamera users:
 * please compile with -DOREMOTECAMERA in order to link it against
 * the ORemotecamera linux library. If you compile it for Windows you
 * don't need to provide this preprocessor switch.
 *
 ********************************************************************/
 
#ifdef WIN32
  #ifndef OREMOTECAMERA
    #define OREMOTECAMERA
  #endif
#endif
 
#ifdef OREMOTECAMERA
  #include "OCamera_remote.h"
#else
  #include "OCamera.h"
#endif
 
#include <stdio.h>
#include <stdlib.h>
#include <string>
 
#ifdef WIN32
  // SleepEx
  #include <windows.h>
#else
  // msleep
  #include <unistd.h>
#endif
 
void msleep( unsigned int ms )
{
#ifdef WIN32
  SleepEx( ms, false );
#else
  ::usleep( ms * 1000 );
#endif
}
 
int main(int argc, char *argv[])
{
 
  OCameraInputs   *pIn;
  OCameraOutputs  *pOut;
  int iOutState;
 
#ifdef OREMOTECAMERA
  std::string sRemoteHost("192.168.7.10:8080");
  if(argc > 1)
  {
    sRemoteHost = argv[1];
  }
#endif
 
  // open CameraInputs
#ifdef OREMOTECAMERA
  pIn = CreateCameraInputs( sRemoteHost.c_str() );
#else
  pIn = OCameraInputs::poCreateInterface();
#endif
  if(pIn == 0)
  {
    printf("Error creation Inputs interface");
    goto Error_Input;
  }
  if(pIn->iOpen() < 0)
  {
    printf("Error opening Inputs");
    goto Error_InOpen;
  }
 
  // open CameraOutputs
#ifdef OREMOTECAMERA
  pOut = CreateCameraOutputs( sRemoteHost.c_str() );
#else
  pOut = OCameraOutputs::poCreateInterface();
#endif
  if(pOut == 0)
  {
    printf("Error creation Outputs interface");
    goto Error_Outputs;
  }
  if(pOut->iOpen() < 0)
  {
    printf("Error opening Outputs");
    goto Error_OutOpen;
  }
 
  // now all interfaces are successfully attached and opened
 
  printf("Welcome to the Digital IO example.");
 
  //
  // do some easy stuff with the outputs
  //
 
  printf("Watch the outputs ... ");
 
  // save output state
  iOutState = pOut->iGetOutputs();
 
  pOut->iSetOutput(OCameraOutputs::OUTPUT_ALL, 0);
  for(int i=0; i<10; i++)
  {
    pOut->iSetOutput(OCameraOutputs::OUTPUT_O0, 1);
    msleep(50);
    pOut->iSetOutput(OCameraOutputs::OUTPUT_O1, 1);
    msleep(50);
    pOut->iSetOutput(OCameraOutputs::OUTPUT_O2, 1);
    msleep(50);
    pOut->iSetOutput(OCameraOutputs::OUTPUT_O0, 0);
    msleep(50);
    pOut->iSetOutput(OCameraOutputs::OUTPUT_O1, 0);
    msleep(50);
    pOut->iSetOutput(OCameraOutputs::OUTPUT_O2, 0);
    msleep(50);
  }
 
  // restore output state
  pOut->iSetOutputs(OCameraOutputs::OUTPUT_ALL, iOutState);
 
  //
  // do some examples on inputs
  //
 
  int InValue;
  InValue = pIn->iGetInputs();
  printf("Actual Input-State %#x", InValue);
  printf("\tInputs 1 0 = %s %s", (InValue & OCameraInputs::INPUT_I1) ? "ON" : "OFF", \
                                   (InValue & OCameraInputs::INPUT_I0) ? "ON" : "OFF");
 
  int iRetVal;
  //---------------------------------------------------------------------------
  // Wait infinite
  pIn->iSetTimeout(-1);
  do
  {
    printf("Waiting infinite until Input 0 changes from 0 -> 1");
 
    // clear sticky edge detection bits
    iRetVal = pIn->iClearEdges((OCameraInputs::INPUT_I0_RE | OCameraInputs::INPUT_I0_FE | OCameraInputs::INPUT_I1_RE | OCameraInputs::INPUT_I1_FE));
 
    // stop program execution until input zero changes to 1
    iRetVal = pIn->iWaitForInput(OCameraInputs::INPUT_I0_RE, 1);
    InValue = pIn->iGetInputs();
    printf("Returncode = %d", iRetVal );
    printf("Actual Input-State %#x", pIn->iGetInputs());
    printf("\tInputs 1 0 == %s %s", (InValue & OCameraInputs::INPUT_I1) ? "ON" : "OFF", \
                                     (InValue & OCameraInputs::INPUT_I0) ? "ON" : "OFF");
    printf("Exit if Inputs 1 0 == ON ON");
  } while ((InValue & OCameraInputs::INPUT_ALL) != OCameraInputs::INPUT_ALL);
 
  printf("Release Inputs!!");
  msleep(3000);
 
  //---------------------------------------------------------------------------
  // Wait with timeout
  pIn->iSetTimeout(3000); // no more infinite waiting!!
  do
  {
    printf("Wait until Input 0 and 1 equal each 1 OR 3000ms elapsed");
    // stop program execution until
    //   - input zero changes to 1   OR
    //   - input one changes to 1    OR
    //   - 3000 milliseconds elapsed
    iRetVal = pIn->iWaitForInputs(OCameraInputs::INPUT_ALL, 3);
    InValue = pIn->iGetInputs();
    printf("Returncode == %d\tInValue == %d",iRetVal,InValue);
    if (iRetVal < 0)
    {
      // timeout or error occurred
      printf("\tTimeout:");
    } else
    {
      printf("\tInput: ");
      printf("\t\tInputs 1 0 == %s %s", (pIn->iGetInput(OCameraInputs::INPUT_I1)) ? "ON" : "OFF", \
                                          (pIn->iGetInput(OCameraInputs::INPUT_I0)) ? "ON" : "OFF");
    }
    printf("Exit if Inputs 1 0 == ON ON [%#x]", InValue);
  } while ((InValue & OCameraInputs::INPUT_ALL) != OCameraInputs::INPUT_ALL);
 
  printf("Release Inputs!!");
  msleep(3000);
 
  //---------------------------------------------------------------------------
  // Wait infinite for input changes
  pIn->iSetTimeout(-1); // set timeout value to wait infinite
  do
  {
    printf("Wait until Input 0 OR 1 changes");
    // stop program execution until
    //   - input zero changes   OR
    //   - input one changes
    iRetVal = pIn->iWaitForInputsChange(OCameraInputs::INPUT_I0 | OCameraInputs::INPUT_I1);
    InValue = pIn->iGetInputs();
    printf("Returncode = %d", iRetVal);
    printf("Actual Input-State %#x", pIn->iGetInputs());
    printf("\tInputs 1 0 = %s %s", (InValue & OCameraInputs::INPUT_I1) ? "ON" : "OFF", \
                                     (InValue & OCameraInputs::INPUT_I0) ? "ON" : "OFF");
    printf("Exit if Inputs 1 0 == ON ON");
  } while ((InValue & OCameraInputs::INPUT_ALL) != OCameraInputs::INPUT_ALL);
  //////////////////////////////////////////////////////////////////////////////////////
 
  // Cleanup
  pOut->iClose();
Error_OutOpen:
  pOut->Destroy();
Error_Outputs:
  pIn->iClose();
Error_InOpen:
  pIn->Destroy();
Error_Input:
 
  printf("Goodbye!");
  return(EXIT_SUCCESS);
}