PDA

View Full Version : Flock of Birds recognized, but no data sent


sjroorda
04-21-2005, 03:29 AM
Using the trial version of Vizard 2.51 (running Windows XP) to see if it addresses my needs, I try to add tracker functionality. I have a Flock of Birds (Ascension), and it is recognized by Vizard, but no data is received. Are there any known problems with this tracker?

Neither an example program works, nor the script made using the tutorial.

My code:
sensor = viz.add('flockofbirds.dls');
sensor.reset();
viz.tracker();

Manually triggering events (data = sensor.get(); print data) prints only non-changing values.

Output of Vizard is
flockofbirds.dls - WorldViz Flock of Birds Driver v0.1

Using FoB with another program works well!

tobin
04-21-2005, 11:40 AM
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:

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;
}


}
}

sjroorda
05-09-2005, 04:33 AM
Thank you for this code. I tried a little, and found out it the problem wasn't Vizard directly, but the FoB itself. I don't know the exact problem yet, but after having played with the program WinBIRD that was delivered with the Flock of Birds, after a while Vizard worked, too. Strange, but nice...

tobin
05-27-2005, 01:45 PM
Our Ascension Flock of Birds plug-in now works well with 1 or more birds. The plug-in expects the Flock of Birds system to be in normal address mode and will not work in other modes (plug-in attached in following message).

Vizard parameters are:

NUM_FOB = 1 or 2
PORT_FOB = 1 (default)
BAUD_FOB = 115200 (default)


In normal address mode, you enter a binary number using dip switches 4, 5, 6, 7 to adjust the bird stack to how many birds are present. If only 1 bird is present, then set all to 0. Otherwise, set each bird box according to its sequential number.

Baud rate is set with dips 1,2,3. For the default mode (115.2kbs), leave 1,2,3 ON (which is the DOWN position).

The transmitter should be plugged into the first bird in the chain. The RS-232 null model cable should also come off the first bird in the chain.

When changing bird settings, switch to STBY before changing, then back to FLY after changing.

After Vizard has connected to the bird/s, then the status light will glow red and stay on.


Here's a sample script:

import viz
viz.go()

NUM_FOB = 2

ball = viz.add('white_ball.wrl')
ball.color(viz.RED)
flock1 = viz.add('flockofbirds.dls')
ball.link(flock1)

ball = viz.add('white_ball.wrl')
ball.color(viz.BLUE)
flock2 = viz.add('flockofbirds.dls')
ball.link(flock2)

viz.add('tut_ground.wrl')

viz.clearcolor(viz.GRAY)

viz.move(0,0,-8)

def onkeydown(key):
#The keyboard button 'key' is being pressed
if key == 'r':
flock1.reset()
flock2.reset()
print 'reset!'

viz.callback(viz.KEYDOWN_EVENT,onkeydown)

tobin
05-27-2005, 01:58 PM
Place this file in your vizard25/plugins folder, replacing the existing file. This adds the functionality described in the previous message.

giancamati
06-30-2006, 05:28 AM
What is the event associated to the Bird? How can I map and implement a new behaviour of those events.

Best Regards.
Giancarlo Amati

giancamati
07-07-2006, 08:43 AM
Hello everybody,

I have the following question: I connected 2 FlockOfBirds together and set the NUM_FOB = 2

now I create two tracker linked to two spheres.
The Vizard does not warn with any error message, so I suppose it is able to recognize 2 FOB but, the two sphere are not sinchronized with the FOB. It seems that Vizard receives only zeros parameters.

Any Idea about that?

Thank you so much

tobin
07-18-2006, 09:28 PM
In earlier posts you seem to have indicated that you got your FOB working with Vizard. Can you summarize what does and what does not work for you? If you've modified the sample script above in any way, could you please post your script so that I may look at it.

Also, are you getting any sign of life from the FOB from the indicator lights?

jsnow
03-01-2016, 07:36 AM
tobin,

"You can download the VRPN demo here:

http://www.worldviz.com/download/index.php?id=19 " :

Forbidden

You don't have permission to access /download/ on this server.

Apache/2.2.22 (Ubuntu) Server at www.worldviz.com Port 80

Not work link, please link
Thank.

Jeff
03-01-2016, 08:48 PM
The ascension plug-in (http://docs.worldviz.com/vizard/#Flock_of_birds_plug-in.htm) is included with Vizard. There is no need for an additional download to use the flock of birds.