Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

Background

Phidget is a company that provides products for USB Sensing and Control. Phidget specialize in making affordable, easy to use sensors and controllers that require minimal electronics knowledge. Phidget covers vast range of sensors and motors.

Sensors

Phidget Protocol Handler Flow

TQLEngine provides phidget protocol handler, which is essentially a wrapper over the Phidget Driver that is provided by Phidget. Note that the developers are required to install the phidget driver for different platform (Linux, Windows, Mac) from the phidget website.

Phidget Protocol Handler Parameters

Phidget has a broad range of sensors and motors. The phidget protocol handler provides wrapper implementation for following Device Types. Adding support for additional device types will be provided on a need basis.

Phidget Input Parameter List

NameDescriptionHow Used?

DeviceType

Specify the type of device that requires interaction. Supported values are:

PhidgetRFID, PhidgetTextLCD, PhidgetGPS, PhidgetInterfaceKit, PhidgetAdvancedServo

DeviceType is passed as a modifier to Invoke.

<Invoke Method="Get" DeviceType="PhidgetInterfaceKit"/>

SerialNumberThis represents the interface port number to which the sensor or motor is connected.SerialNumber is passed as a modifier to Invoke
ServoAngleAngle to be applied to a Advanced Servo Motor.

ServoAngle is passed as a payload to Invoke wrapped within

Message/Value container.

<Invoke Method="Post" DeviceType="PhidgetTextLCD">

<Message><Value><ServoAngle>110.0</ServoAngle></Value></Message>

</Invoke>

SimulatedSimulates Sensor Behavior by sending random integer values between 1 and 100 
-

Some time if you need to pass a String value to the handler as input - usually in case of RFID Writer

or LCD Text Display, you can pass it as part of <Message><Value>Hello</Value></Message> as payload to Invoke.

Payload of <Invoke>.

<Invoke Method="Post" DeviceType="PhidgetTextLCD">

<Message><Value>Hello</Value></Message>

 </Invoke>

 

Phidget Output Format

Output from the Phidget Handler is simply a text value.

Special formatted case for GPS Sensors - In case of GPS the output text is aggregated and presented in a single formatted text as below: 

Phidget Handler GPS Output Text Format
Lon:<value>;Lat:<value>;Alt:<Value>;Vel:<Value>;Head:<Value>;Status:<Value>
Default Value for Lon, Lat, Alt, Vel, Head is: Unknown
Default Value for Status is false
USB Camera Parameter Structure
<USBCameraParameters>
  <ImageFormat></ImageFormat>
  <SaveToDisk></SaveToDisk>
  <ImageName></ImageName>
  <Size>
    <Height></Height>
    <Width></Width>
  </Size>
  <Configuration>
    <Standard></Standard>
    <Quality></Quality>
    <Channel></Channel>
    <Brightness></Brightness>
    <Contrast></Contrast>
    <Gamma></Gamma>
    <Gain></Gain>
    <Sharpness></Sharpness>
    <Saturation></Saturation>
    <Hue></Hue>
  </Configuration>
</USBCameraParameters>

 

USB Camera Parameter Structure

Invoking UCAM Handler

Invoking UCAM Handler via Invoke
<Action Name="USBCameraImageAction"> <Workflow Limit="1" Live="1" Timeout="-1"> <Task name="Main" while="true"> <Event name="Argument" as="ActionArgument"/> <Invoke name="GetImage" waitFor="ActionArgument" post="ucam://"> <Message> <Value> <USBCameraParameters> <ImageFormat>[%:Event.Argument.USBCameraParameters.ImageFormat.Value:%]</ImageFormat> <SaveToDisk>[%:Event.Argument.USBCameraParameters.SaveToDisk.Value:%]</SaveToDisk> <ImageName>[%:Event.Argument.USBCameraParameters.ImageName.Value:%]</ImageName> <Size> <Height>[%:Event.Argument.USBCameraParameters.Size.Height.Value:%]</Height> <Width>[%:Event.Argument.USBCameraParameters.Size.Width.Value:%]</Width> </Size> <Configuration> <Standard>[%:Event.Argument.USBCameraParameters.Configuration.Standard.Value:%]</Standard> <Quality>[%:Event.Argument.USBCameraParameters.Configuration.Quality.Value:%]</Quality> <Channel>[%:Event.Argument.USBCameraParameters.Configuration.Channel.Value:%]</Channel> <Brightness>[%:Event.Argument.USBCameraParameters.Configuration.Brightness.Value:%]</Brightness> <Contrast>[%:Event.Argument.USBCameraParameters.Configuration.Contrast.Value:%]</Contrast> <Gamma>[%:Event.Argument.USBCameraParameters.Configuration.Gamma.Value:%]</Gamma> <Gain>[%:Event.Argument.USBCameraParameters.Configuration.Gain.Value:%]</Gain> <Sharpness>[%:Event.Argument.USBCameraParameters.Configuration.Sharpness.Value:%]</Sharpness> <Saturation>[%:Event.Argument.USBCameraParameters.Configuration.Saturation.Value:%]</Saturation> <Hue>[%:Event.Argument.USBCameraParameters.Configuration.Hue.Value:%]</Hue> </Configuration> </USBCameraParameters> </Value> </Message> </Invoke> <Log Message="******Invoked USBCamera******"/> <Output name="Result" as="ActionResult"> <Value> <Image>[%:[%:@Output:%]Invoke.GetImage.Message.Value:%]</Image> </Value> </Output> </Task> </Workflow> </Action>

Driver Installation Steps

Installing Phidget Driver

Installing V4l4j


For the ucam handler to work two things are needed, the video driver of the camera which comes by default and the v4l4j library. The steps below show installing of v4l4j library 
Steps:

1.Before installing the v4l4j some packages are needed to be installed. If you are running debian based operating system type the command

 sudo apt-get install openjdk-7-jdk ant libjpeg8-dev
 
It will download and install the required prereqs, 
 

2. To download the v4l4j you need subversion(svn) tool, download and install it as shown below

sudo apt-get install subversion

3. Now download the library using the following command

svn co http://v4l4j.googlecode.com/svn/v4l4j/trunk v4l4j-trunk
 

4. Then go to the v4l4j-trunk directory (cd v4l4j-trunk) and start the build process by typing the command shown below


{}On Raspbian Wheezy (Raspberry pi):
JDK_HOME=/usr/lib/jvm/java-7-openjdk-armhf/ LIBPIXFC=pixfc-sse/libpixfc-sse-armv6l-hardfp.a ant clean all
*On Wheezy beta: (Raspberry Pi)*
JDK_HOME=/usr/lib/jvm/java-7-openjdk-armhf/ LIBPIXFC=pixfc-sse/libpixfc-sse-armv6l-softfp.a ant clean all
On other environments setup
Setup JDK_HOME environment variable to your JDK path and do
ant clean all 
 

5. If you get this error "error: libv4lconvert.h: No such file or directory" , type

sudo apt-get install libv4l-dev 

And do the build process again. 

6. Once the build process is completed

 

7. Install by running command

sudo ant install
 



8. Finally test the library by running command

ant test-fps
 

  • No labels