This is a typical example of an image acquired by the K6300 Turret Set. |
In order to check that the K6300 Turret Set has been properly detected by your platform, use the "net" command. Simply type net and hit the Return or Enter key. You should get the following output :
VV6300 25 160x120 pixel camera, EF/PA-99: Rev. 2.09Your mileage may vary. This line contains the following information :
Q | Acquire an image. This command has no argument and does just return an acknowledge. | ||
Example : | Q | ||
Output : | q | ||
B | Return the version and the revision of the K6300 Turret Set control software. The version and the revision are coded as two separate BCD numbers. This command has no argument. | ||
Example : | B | ||
Output : | b,1,5 | ||
F | Read a flag and possibly modify it. This command has a single argument, consisting of the flag number added with an operation code. The flag number is in the range 0..63 and the operation code can be either +0 (just read the flag), +64 (read and set the flag), +128 (read and clear the flag), +192 (read and change the flag). | ||
Example : | F,72 (read flag number 8 and set it : 8+64 = 72) | ||
Output : | f,110 | ||
I | Read a single line consisting of 160 pixels. This command has a single argument, consisting of the line number to read, in the range 0..119. The 160 pixels are returned as numerical values in the rage xx.. yy. | ||
Example : | I,15 (read the line number 15) | ||
Output : | i,113,83,220, ... ,92 (total of 160 pixels) | ||
O | Read the minimum profile. | ||
Example : | O,255 | ||
Output : | O, ... | ||
P | Read the maximum profile. | ||
Example : | P,0 | ||
Output : | p, ... | ||
R | Read a 32-bit user variable. This command has a single argument, consisting of the identifier of the variable to be read from, in the range 0..15. The 32-bit user variable is returned as four numerical values, from the most significant to the least significant byte. | ||
Example : | R,5 | ||
Output : | r,0,250,192,64 (the variable has a value of 0x00FAC040) | ||
W | Write a 32-bit user variable. This command takes five arguments; the first one is the identifier of the variable to be written to, in the range 0..15; the four other ones specify the four bytes, in the same order as that of command 'R' above. | ||
Example : | W,2,10,0,0,2 (the variable has a value of 0x0A000002) | ||
Output : | w | ||
L | Read the line (160 pixels) processed by the user application (if any). This argument-less command returns an acknowledge followed by 160 numerical values, coding the 160 pixels of the line. | ||
Example : | L | ||
Output : | l,,113,83,220, ... ,92 (lower case letter 'L' followed by a total of 160 pixels) | ||
C | Read the column (120 pixels) processed by the user application (if any). See command 'L' above for details. | ||
Example : | C | ||
Output : | c,10,26,254, ... ,2 (total of 120 pixels) | ||
These commands can be issued from the terminal by prefixing them with the T,25 command (talk to turret number 25). Here are a few examples :
T,25,Q T,25,B T,25,F,0 T,25,I,119 T,25,O,200 T,25,P,50 T,25,R,0 T,25,W,15,0,0,0,16 T,25,L T,25,C ...
The hosting platform (Khepera, Koala or Kameleon) can communicate with the user preprocessing code through 64 flags (command F), 16 32-bit variables (commands R and W), a preprocessed line of pixels (command L) and a preprocessed column of pixels (command C).
The preprocessing code can obtain a pointer to the array of 64 uint8 flags by calling vvl_get_flag_ptr.
The preprocessing code can obtain a pointer to the array of 16 uint32 variables by calling vvl_get_user_ptr.
int32 vvl_reset (void);Call this function once before using any other vvl_... function. This initialises the module and sets up the hardware interface and the camera.
const uint8* vvl_get_line_ptr (int32 line);This function returns a pointer to the specified line of 160 pixels. The line argument must be in the range 0..119. If outside of this range, the function returns a pointer of value 0xFFFFFFFF (or -1).
const uint8* vvl_get_mean_ptr (void);This function returns a pointer to 120 pairs of mean pixel values. The pair consists of the mean value of left half (pixels 0 through 79) and the mean value of the right half (pixels 80 through 159) of each line.
To access the left mean value of line number 25, you would access byte number 2*25+0. To access the right mean value of the same line, you would access byte number 2*25+1.
uint16 vvl_get_mean_values (void);This function returns the overall mean values of the left half and of the right half of the image. Each half is 80 pixels wide and 120 pixels high. The left and right values are stored as the high and low byte of the returned value. To extract them, use the following piece of code :
uint16 mean_pair = vvl_get_mean_values (); uint8 left_mean = (uint8)(mean_pair >> 8); uint8 right_mean = (uint8)(mean_pair);
const uint8* vvl_get_image_ptr (void);This function returns a pointer to the raw array of 160 x 120 bytes, directly encoding the individual pixel values. To access the pixel located at the position [x;y], use the following piece of code :
const uint8* ptr = vvl_get_image_ptr (); ... uint8 pixel = ptr[x+y*160];
uint32 vvl_get_minmax (void);This function returns the co-ordinates of the minimum intensity pixel and of the maximum intensity pixel. The co-ordinates are encoded in the 32-bit result as [xmin;ymin;xmax;ymax]. Use the following piece of code to extract the individual co-ordinates :
uint32 encoded = vvl_get_minmax (); uint8 x_min = (uint8)(encoded >> 24); uint8 y_min = (uint8)(encoded >> 16); uint8 x_max = (uint8)(encoded >> 8); uint8 y_max = (uint8)(encoded);
const uint8* vvl_get_min_prof (uint8 max_level);This function computes the minimum profile of each column (there is a total of 160 columns). It searches the pixel with the lowest intensity and stores its position in the column (in the range 0..119). If the intensity of the given pixel is above the maximum level, then its position is discarded and 255 is stored instead. If every pixel should be considered, set max_level to 255.
The following piece of code prints the [y] position of each minimum pixel value, column by column :
uint32 x; const uint8* profile = vvl_get_min_prof (255); for (x = 0; x < 160; x++) { printf ("x=%3d => y=%3d\n", x, profile[x]); }
const uint8* vvl_get_max_prof (uint8 min_level);This function computes the maximum profile of each column (there is a total of 160 columns). It searches the pixel with the highest intensity and stores its position in the column (in the range 0..119). If the intensity of the given pixel is below the minimum level, then its position is discarded and 255 is stored instead. If every pixel should be considered, set min_level to 0. See vvl_get_max_prof for an example.
void vvl_aqu_image (void);This function takes a snapshot with the camera. The acquisition of the image takes about xx us. You must call this function before you call one of the following functions, or their result will be undefined :
uint8* vvl_get_flag_ptr (void);This function returns a pointer to 64 uint8 flags (8-bit values) which can be freely used by the user. The host can check or modify these flags through the K-bus command F.
uint32* vvl_get_user_ptr (void);This function returns a pointer to 16 uint32 values (32-bit values) which can be freely used by the user. The host can read these flags through the K-bus command R and write them through command W.
void vvl_write_reg (uint8 reg, uint8 data);This function writes the specified 8-bit data to the image register reg. The full documentation about the imager's registers can be found on the VVL site.
uint8 vvl_read_reg (uint8 reg);This function reads the specified imager register reg.
To store a program into the user flash, you have to use the sfill
and flash commands. The first available segment is located at
absolute address 0x00020000 (segment #2) and the standard turret
has 6 x 64 KB flash memory segments reserved for the user.
NB : | If the program exceeds 64 KB in size, it is recommended to split it into manageable chunks written segment by segment to the memory using successive sfill and flash S2 to flash S7. The download address of each chunk should be set to 0x00121100. |
Comments are welcome to support@k-team.com !