Our FOB plug-in is admittedly not the most sophisticated. It limits include a single bird operation and hard-coded settings such as COM1 at 115.2kbs. I'm copying the C code below that initializes and updates the Bird below. Perhaps by looking at our initialization statements, you'll see what might be causing yours to not work.
A preferred method to connect to a FOB is to use the open-source VRPN protocol. Vizard fully support VRPN devices and from our experience most users are pleased with the results they get from this method. We have a small redistribution of VRPN along with a sample Vizard script that you can immediately download and test out. You'll need to edit the vrpn.cfg file to connect to a FOB rather than run in the test mode which it's in right now (see the readme.txt file).
You can download the VRPN demo here:
http://www.worldviz.com/download/index.php?id=19
If you have any further troubles, please don't hesitate to ask further questions.
Here's the guts of the Vizard FOB plug-in:
PHP Code:
void InitializeSensor(void *sensor)
{
BOOL birdFound = FALSE;
WORD comport = 1;
for(int i = 1; i <= 2; i++) {
comport = i;
if(birdRS232WakeUp(1,TRUE,1,&comport,115200,2000,2000)) {
birdFound = TRUE;
break;
}
}
if(!birdFound) {
printf("** ERROR: Could not find bird on COM 1 or 2\n");
((VRUTSensorObj *)sensor)->status = FALSE;
return;
}
((VRUTSensorObj *)sensor)->status = TRUE;
if(ANGLE_MODE == SENSOR_QUATERNION)
birdRS232SendCommand(1,1,"\\",1);
birdGetDeviceConfig(1,1,&devconfig);
birdStartFrameStream(1);
}
void UpdateSensor(void *sensor)
{
// Update the sensor data fields (see sensor.h)
// Fields 0-2: reserved for x, y, z position data
// Fields 3-5: reserved for yaw, pitch, roll
// or
// Fields 3-6: reserved for quaternion data
//
// eg:
// ((VRUTSensorObj *)sensor)->data[0] = newX;
if (birdFrameReady(1))
{
BIRDFRAME frame;
birdGetMostRecentFrame(1,&frame);
BIRDREADING *preading;
preading = &frame.reading[0];
double pos_scale = devconfig.wScaling;
pos[0] = (float)(preading->position.nX * pos_scale / 32767.0f) * 0.0254f;
pos[1] = (float)(preading->position.nY * pos_scale / 32767.0f) * 0.0254f;
pos[2] = (float)(preading->position.nZ * pos_scale / 32767.0f) * 0.0254f;
((VRUTSensorObj *)sensor)->data[0] = pos[1] - offset[1];
((VRUTSensorObj *)sensor)->data[1] = -(pos[2] - offset[2]) + height;
((VRUTSensorObj *)sensor)->data[2] = pos[0] - offset[0];
if(ANGLE_MODE == SENSOR_EULER2) {
yaw = preading->angles.nAzimuth * AngleConversion;
((VRUTSensorObj *)sensor)->data[3] = yaw - yawOffset;
((VRUTSensorObj *)sensor)->data[4] = -preading->angles.nElevation * AngleConversion;
((VRUTSensorObj *)sensor)->data[5] = preading->angles.nRoll * AngleConversion;
} else if (ANGLE_MODE == SENSOR_QUATERNION) {
((VRUTSensorObj *)sensor)->data[3] = preading->quaternion.nQ0 * QuatConversion;
((VRUTSensorObj *)sensor)->data[4] = preading->quaternion.nQ1 * QuatConversion;
((VRUTSensorObj *)sensor)->data[5] = preading->quaternion.nQ2 * QuatConversion;
((VRUTSensorObj *)sensor)->data[6] = preading->quaternion.nQ3 * QuatConversion;
}
}
}