<<<<<<<<<<<<<<<<<

flock(oscar) Animation flock(oscar)

NAME

flock - a group of 3D positioning devices

DESCRIPTION

The flock class communicates with the "Flock of Birds" (3D positioning devices). The position and attitude of each bird (x,y,z, elevation, roll, and azimuth) can be obtained. The flock consists of a transmitter and a number of receivers. The strength of the transmitter signal is determined by the bird closest to the transmitter. The typical sensing range of the flock is a cubic yard. It is important that the flock transmitter be located on a non- metalic surface since the flock uses a magnetic field to determine position and attitude.

The position values are returned in inches and the attitude values in degrees. If you are facing the terminal, x values go left/right, y values go in/out of the screen, and z values go up/down.

SUPERCLASS

object

INSTANCE VARIABLES

delay Delay in seconds to be used by "continuous_locate:" message.

buffer_size Size of buffers to store x,y,z for the bird in "continuous_locate:" message.

ac_filter Status for turning ac (narrow notch) filter in the bird on or off.

dc_filter Status for turning dc (wide notch) filter in the bird on or off.

MESSAGES

ac_filter= Sets the value of ac_filter switch, one is ON, zero is OFF.

ac_filter_off! Sets the value of ac_filter switch to zero.

ac_filter_on! Sets the value of ac_filter switch to one.

ac_filter? returns the value of ac_filter switch.

align! The position of the current bird (set with bird=

message) is defined to be (0,0,0).

azimuth? Returns the azimuth of the current bird at the time of the last locate! message.

bird= Determines which bird in the flock will receive positioning and other requests.

bird? Returns the number of the current bird. That is, the bird in the flock which is responding to messages.

buffer_size= Sets the value of the buffer_size instance variable (1-256). This number is used to accumulate x,y,z measurements in "continuous_locate:" method.

buffer_size? Returns the value of buffer_size.

buffer_x? Returns values accumulated in the buffer during "continuous_locate:" method.

buffer_y? Returns values accumulated in the buffer during "continuous_locate:" method.

buffer_z? Returns values accumulated in the buffer during "continuous_locate:" method.

button? Looks at the current birds mouse buttons and return 0 if no buttons are pressed, 1 if the left button is pressed, 2 if the middle (or middle and left) button is pressed, and 3 if the right (right and any other) button is pressed.

change_filters! Set flock ac (narrow notch) and dc (wide notch) filters according to the switches specified in appropriate methods.

continuous_locate: argument Stores argument number of x,y,z measurements in buffer_x, buffer_y and buffer_z. The reading of the results can be done as they are produced or after some delay (see delay instance variable and methods). In the later case the delay should be specified accordingly to the measurement rate, e.g. for measurement rate 30 and argument = 5 the delay should be 5/30 = 0.16. Default delay is equal to

zero. Continuous accumulation of measurements starts when none of the buttons are pressed for the bird. So the method is usually issued when some button is pressed and then it is released.

crystal_speed? Returns the speed in Mhz of the flock CPU clock.

dc_filter= Sets the value of dc_filter switch, one is ON, zero is OFF.

dc_filter_off! Sets the value of dc_filter switch to zero.

dc_filter_on! Sets the value of dc_filter switch to one.

dc_filter? returns the value of dc_filter switch.

delay= argument Set the delay instance variable. See "continuous_locate:" message.

delay? Returns the delay instance variable. See "continuous_locate:" message.

delta_azimuth? Returns the change in azimuth of the current bird from the previous locate! message.

delta_elevation? Returns the change in elevation of the current bird from the previous locate! message.

delta_orientation? Returns the difference in orientation of the current bird from the previous locate! message.

delta_position? Returns the difference in position of the current bird from the previous locate! message.

delta_roll? Returns the change in roll of the current bird from the previous locate! message.

delta_time? Returns difference in seconds between last and previous locate commands. Should not be used after "continuous_locate:".

delta_x? Returns the change in x position of the current bird from the previous locate! message.

delta_y? Returns the change in y position of the current bird from the previous locate! message.

delta_z? Returns the change in z position of the current bird from the previous locate! message.

elevation? Returns the elevation of the current bird at the time of the last locate! message.

free! Frees an instance of flock.

initialize! Opens connections to each bird in the flock and initializes it. Because of a current limitation on the SGI serial port driver, each bird must be manually toggled from FLY to STDBY, and back to FLY *before* the initialize! message. The light on front of each bird will blink several times and go out after the switch is toggled. Once the initialize! message has been sent, then the lights on the front of each bird should light.

locate! Tells the current bird to determine its position and attitude. No value is returned.

measurement_rate? Returns bird's measurement rate in cycles per second. If "sync_on!" (default) is used then on SGI it is about 60 Hz. With "sync_off!" it is about 100 Hz.

number_birds= Sets the number of birds in the flock

number_birds? Returns the number of birds in the flock

orientation? Returns the roll, elevation, and azimuth of the current bird at the time of the last locate! message.

position? Returns the x,y,z of the current bird at the time of the last locate! message.

previous_azimuth? Returns the azimuth of the current bird from the previous locate! message.

previous_elevation? Returns the elevation of the current bird from the previous locate! message.

previous_roll? Returns the roll of the current bird from the previous locate! message.

previous_time? Returns the previous_time instance variable in seconds from the flock initialization time.

previous_x? Returns the x of the current bird from the previous locate! message.

previous_y? Returns the y of the current bird from the previous locate! message.

previous_z? Returns the z of the current bird from the previous locate! message.

roll? Returns the roll of the current bird at the time of the last locate! message.

scale= Set scaling factors to be applied to the x,y,z position of the current bird.

scale? Returns the scaling factor of the current bird

serial_port= Sets the serial port that the workstation communicates to the current bird over. The Flock is currently set up to use /dev/ttyf1 for bird 0 and /dev/ttyf2 for bird 1 on SGI cheetah as a default.

serial_port? Gets the serial port that the workstation communicates to the bird.

set_max_measurement_rate! Sets measurement rate to its maximal value. The command is discarded if sync is on.

set_min_measurement_rate! Sets measurement rate to its minimal value. The command is discarded if sync is on.

speed_x? Returns the derivative of bird's x coordinate by time.

speed_xyz? Returns the derivative of bird's position by time. This message should follow "continuous_locate:number". The derivative is calculated using linear least square fit to the data accumulated in buffer_x, buffer_y, and buffer_z. The angles of corresponding lines are adjusted by using measurement_rate of the bird.

speed_y? Returns the derivative of bird's y coordinate by time.

speed_z? Returns the derivative of bird's z coordinate by time.

sync_off! Set bird synchronization with the monitor off.

sync_on! Set bird synchronization with the monitor on.

time? Returns the time in seconds since initialization measured at the last "locate!" message.

x? Returns the x of the current bird at the time of the last locate! message.

y? Returns the y of the current bird at the time of the last locate! message.

z? Returns z of the current bird at the time of the last locate! message.

EXAMPLES

The first example initializes the flock of birds and sets bird # 0 as the current bird. It then tells the bird to find its location and register it as (0,0,0). A second position/orientation sample is taken from the bird and the values are printed. Remember that each bird must be toggled from FLY to STDBY, and back to FLY before the initialize! is done.

flock new: aflock; /* the following message is sent implicitly by locate! align! and other * messages, it can be omitted. */ aflock initialize!; aflock bird=0 locate! align!;

aflock locate!; aflock print:position; aflock print:orientation;

The second example display four cubes in stereo. The camera view is positioned by one bird and the red cube is positioned and rotated by the second bird.

camera new: acamera

view_up=(0,0,-1)

position=(0,10,0)

focal_point=(0.0,0.0,0.0)

view_angle=30

on! ;

light new: alight position=(0,10,0) on! ;

cube_modeller new: cube_model;

person new: cube1 color=(1,0,0) modeller=cube_model position=(-1,-1,0) ;

person new: cube2 color=(0,1,0) modeller=cube_model position=(1,1,0) ;

person new: cube3 color=(0,0,1) modeller=cube_model position=(-1,1,0) ;

person new: cube4 color=(1,1,0) modeller=cube_model position=(1,-1,0) ;

gl new: aren background=(0.6400,0.5800,0.5000) actors=(cube1,cube2,cube3,cube4) cameras=acamera lights=alight

;

flock new: aflock ;

scalar new: camera_bird = 1; scalar new: mouse_bird = 0; vector new: original_camera;

loop new: aloop

resolution=1

duration=1

start_actions+"aflock bird=camera_bird locate! align!;"

start_actions+"aflock bird=camera_bird scale=(.3,.3,.5);"

start_actions+"original_camera= [acamera position?];"

start_actions+"aflock bird=mouse_bird locate! align!;"

tick_actions+"aflock bird=camera_bird locate!;"

tick_actions+"acamera position= original_camera;"

tick_actions+"acamera position+ [aflock position?];"

tick_actions+"alight position= [acamera position?] position+(0,0,2);"

tick_actions+"aflock bird=mouse_bird locate!;"

tick_actions+"cube1 orientation= [aflock orientation?];"

tick_actions+"cube1 position=[aflock position?];"

tick_actions+"aren render!;"

tick_actions+"aloop duration+ 1;" ;

aren stereo_on! render!; aloop start!;

SEE ALSO


Please send comments and suggestions to
consult@rpi.edu