kb_stargazer.h File Reference

Include dependency graph for kb_stargazer.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Defines

#define NB_MARK_TYPES   6
#define HLD1S   0
#define HLD1L   1
#define HLD2S   2
#define HLD2L   3
#define HLD3S   4
#define HLD3L   5
#define NB_MARK_MODES   2
#define MARK_ALONE   0
#define MARK_MAP   1
#define NB_HEIGHT_FIX_MODES   2
#define HEIGHT_FIX_NO   0
#define HEIGHT_FIX_YES   1
#define ANGLE_CORRECTION   100.0
#define CALIB_STDEV_MAX   5.0

Functions

int kb_stargazer_init (char *DeviceName)
int kb_gazer_get_version (char *version)
int kb_gazer_set_landmark_number (int number)
int kb_gazer_get_landmark_number (int *number)
int kb_gazer_set_ref_id (int refid)
int kb_gazer_get_ref_id (int *refid)
int kb_gazer_set_landmark_type (int type)
int kb_gazer_get_landmark_type (int *type)
int kb_gazer_set_landmark_mode (int mode)
int kb_gazer_get_landmark_mode (int *mode)
int kb_gazer_set_height_fix_mode (int mode)
int kb_gazer_get_height_fix_mode (int *mode)
int kb_gazer_start_map_mode ()
int kb_gazer_set_end_command ()
int kb_gazer_start_computation ()
int kb_gazer_stop_computation ()
int kb_gazer_wait_stop_computation ()
int kb_stargazer_read_data (double *x, double *y, double *z, double *angle, int *idnum, char *mode, int corr)
void kb_stargazer_Close ()
int kb_gazer_calibration (knet_dev_t *mot1, knet_dev_t *mot2, double *_center_x0, double *_center_y0, double *_angle_rot, double *_a_axis, double *_b_axis, double *_stddev_x, double *_stddev_y)

Variables

const char * kb_gazer_landmark_types []
const char * kb_gazer_landmark_modes []
const char * kb_gazer_height_fix_modes []

Define Documentation

#define ANGLE_CORRECTION   100.0

Definition at line 34 of file kb_stargazer.h.

Referenced by kb_gazer_calibration(), kb_stargazer_read_data(), and main().

#define CALIB_STDEV_MAX   5.0

Definition at line 36 of file kb_stargazer.h.

Referenced by kb_gazer_calibration(), and main().

#define HEIGHT_FIX_NO   0

Definition at line 30 of file kb_stargazer.h.

Referenced by set_Stargazer_parameters().

#define HEIGHT_FIX_YES   1

Definition at line 31 of file kb_stargazer.h.

#define HLD1L   1

Definition at line 14 of file kb_stargazer.h.

#define HLD1S   0

Definition at line 13 of file kb_stargazer.h.

Referenced by set_Stargazer_parameters().

#define HLD2L   3

Definition at line 16 of file kb_stargazer.h.

#define HLD2S   2

Definition at line 15 of file kb_stargazer.h.

#define HLD3L   5

Definition at line 18 of file kb_stargazer.h.

#define HLD3S   4

Definition at line 17 of file kb_stargazer.h.

#define MARK_ALONE   0

Definition at line 23 of file kb_stargazer.h.

Referenced by main(), and set_Stargazer_parameters().

#define MARK_MAP   1

Definition at line 24 of file kb_stargazer.h.

Referenced by set_Stargazer_parameters().

#define NB_HEIGHT_FIX_MODES   2

Definition at line 29 of file kb_stargazer.h.

Referenced by kb_gazer_get_height_fix_mode().

#define NB_MARK_MODES   2

Definition at line 22 of file kb_stargazer.h.

Referenced by kb_gazer_get_landmark_mode().

#define NB_MARK_TYPES   6

Definition at line 12 of file kb_stargazer.h.

Referenced by kb_gazer_get_landmark_type(), and set_Stargazer_parameters().


Function Documentation

int kb_gazer_calibration ( knet_dev_t mot1,
knet_dev_t mot2,
double *  _center_x0,
double *  _center_y0,
double *  _angle_rot,
double *  _a_axis,
double *  _b_axis,
double *  _stddev_x,
double *  _stddev_y 
)

configure the Stargazer rotation compensation

Parameters:
mot1 left motor pointer
mot2 right motor pointer
_center_x0 x center of the fitted ellipse
_center_y0 y center of the fitted ellipse
_angle_rot angle of rotation of the fitted ellipse
_a_axis half major axis of the fitted ellipse
_b_axis half minor axis of the fitted ellipse
_stddev_x standard deviation error of x
_stddev_y standard deviation error of y
Returns:
0 no error

-1 timeout while computing calibration -2 data buffer too short -3 error computing ellipse parameters -4 error: data are too scattered < -4+ (return kb_stargazer_read_data) error getting Stargazer data

Definition at line 1645 of file kb_stargazer.c.

References a_axis, ANGLE_CORRECTION, angle_rot, b_axis, CALIB_STDEV_MAX, CALIBRATION_SPEED, center_x0, center_y0, compute_ellipse(), CONFIGURE_TIMEOUT, kb_stargazer_read_data(), kmot_SetPoint(), kMotRegSpeed, MAX_CALIB_DATA, stop(), and STOP_THRESHOLD_ANGLE.

Referenced by main().

Here is the call graph for this function:

int kb_gazer_get_height_fix_mode ( int *  mode  ) 

Get the height fix mode

Parameters:
mode height fix mode: 0 = NO, 1 = YES
Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged -3 : unknown height mode

Definition at line 1300 of file kb_stargazer.c.

References buf, CMD_HEIGHT_FIX, kb_gazer_height_fix_modes, MAX_BUF, NB_HEIGHT_FIX_MODES, SerialDeviceHandle, and write_serial().

Referenced by main(), and set_Stargazer_parameters().

Here is the call graph for this function:

int kb_gazer_get_landmark_mode ( int *  mode  ) 

Get the landmark mode

Parameters:
mode landmark mode
Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged -3 : unknown landmark mode

Definition at line 1200 of file kb_stargazer.c.

References buf, CMD_MARK_MODE, kb_gazer_landmark_modes, MAX_BUF, NB_MARK_MODES, SerialDeviceHandle, and write_serial().

Referenced by main(), and set_Stargazer_parameters().

Here is the call graph for this function:

int kb_gazer_get_landmark_number ( int *  number  ) 

Get the number of landmarks

Parameters:
number number of landmarks
Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged

Definition at line 928 of file kb_stargazer.c.

References buf, CMD_LANDMARK_NB, MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by main(), and set_Stargazer_parameters().

Here is the call graph for this function:

int kb_gazer_get_landmark_type ( int *  type  ) 

Get the landmark type

Parameters:
type landmark type
Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged -3 : unknown landmark type

Definition at line 1101 of file kb_stargazer.c.

References buf, CMD_MARK_TYPE, kb_gazer_landmark_types, MAX_BUF, NB_MARK_TYPES, SerialDeviceHandle, and write_serial().

Referenced by main(), and set_Stargazer_parameters().

Here is the call graph for this function:

int kb_gazer_get_ref_id ( int *  refid  ) 

Get the landmark id reference

Parameters:
refid landmark id number reference
Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged

Definition at line 1012 of file kb_stargazer.c.

References buf, CMD_REFERENCE_ID, MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by main(), and set_Stargazer_parameters().

Here is the call graph for this function:

int kb_gazer_get_version ( char *  version  ) 

Get Stargazer firmware version

Parameters:
version version
Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged -3 : command not acknowledged

Definition at line 681 of file kb_stargazer.c.

References CMD_VERSION, CMD_VERSION_ACK, MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by main().

Here is the call graph for this function:

int kb_gazer_set_end_command (  ) 

Set end of commands for update

Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged -3 : data not upated

Definition at line 1401 of file kb_stargazer.c.

References buf, CMD_PARAM_UPDATE, CMD_SET_END, MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by set_Stargazer_parameters().

Here is the call graph for this function:

int kb_gazer_set_height_fix_mode ( int  mode  ) 

Set the height fix mode

Parameters:
mode height fix: 0 = NO, 1 = YES
Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged -3 : mode not valid

Definition at line 1254 of file kb_stargazer.c.

References ACK_CHAR, buf, CMD_HEIGHT_FIX, kb_gazer_height_fix_modes, MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by set_Stargazer_parameters().

Here is the call graph for this function:

int kb_gazer_set_landmark_mode ( int  mode  ) 

Set the landmark mode

Parameters:
mode landmark mode
Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged -3 : mode not valid

Definition at line 1155 of file kb_stargazer.c.

References buf, CMD_MARK_MODE, kb_gazer_landmark_modes, MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by set_Stargazer_parameters().

Here is the call graph for this function:

int kb_gazer_set_landmark_number ( int  number  ) 

Set the number of landmarks

Parameters:
number number of landmarks
Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged

Definition at line 887 of file kb_stargazer.c.

References buf, CMD_LANDMARK_NB, MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by set_Stargazer_parameters().

Here is the call graph for this function:

int kb_gazer_set_landmark_type ( int  type  ) 

Set the landmark type

Parameters:
type landmark type
Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged -3 : type not valid

Definition at line 1056 of file kb_stargazer.c.

References buf, CMD_MARK_TYPE, kb_gazer_landmark_types, MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by set_Stargazer_parameters().

Here is the call graph for this function:

int kb_gazer_set_ref_id ( int  refid  ) 

Set the landmark id as reference

Parameters:
refid landmark id number to set as reference
Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged

Definition at line 971 of file kb_stargazer.c.

References buf, CMD_REFERENCE_ID, MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by set_Stargazer_parameters().

Here is the call graph for this function:

int kb_gazer_start_computation (  ) 

Start computation of position

Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged

Definition at line 805 of file kb_stargazer.c.

References CMD_CALC_START, CMD_CALC_START_ACK, MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by main().

Here is the call graph for this function:

int kb_gazer_start_map_mode (  ) 

Start the map building mode

Returns:
0 : no error -1 : serial port not open -2 : could not stop receiving position -3 : command not acknowledged

Definition at line 1354 of file kb_stargazer.c.

References ACK_CHAR, buf, CMD_MAP_MODE_START, kb_gazer_wait_stop_computation(), MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by main().

Here is the call graph for this function:

int kb_gazer_stop_computation (  ) 

Stop computation of position

Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged

Definition at line 736 of file kb_stargazer.c.

References CMD_CALC_STOP, CMD_CALC_STOP_ACK, MAX_BUF, SerialDeviceHandle, and write_serial().

Referenced by kb_gazer_wait_stop_computation().

Here is the call graph for this function:

int kb_gazer_wait_stop_computation (  ) 

Stop computation of position and wait until it stops (retry MAX_STOP)

Returns:
0 : no error -1 : serial port not open -2 : command not acknowledged

Definition at line 774 of file kb_stargazer.c.

References kb_gazer_stop_computation(), and MAX_STOP.

Referenced by kb_gazer_start_map_mode(), kb_stargazer_Init(), and main().

Here is the call graph for this function:

void kb_stargazer_Close (  ) 

kb_stargazer_Close release the Stargazer

Definition at line 1605 of file kb_stargazer.c.

References BATTERY_GPIO, kb_gpio_cleanup(), kb_gpio_clear(), and SerialDeviceHandle.

Referenced by main().

Here is the call graph for this function:

int kb_stargazer_init ( char *  DeviceName  ) 
int kb_stargazer_read_data ( double *  x,
double *  y,
double *  z,
double *  angle,
int *  idnum,
char *  cmode,
int  corr 
)

Read data and interpret data from the Stargazer serial port kb_stargazer_read_data must be called periodically (up to 10 times/s) kb_gazer_start_computation must be called once before

Parameters:
x x position relative to the reference landmark in [cm], right direction
y y position relative to the reference landmark in [cm], forward direction
z height to the landmark in [cm]
angle angle relative to the reference landmark orientation in [degree] (counterclockwise) in 0..360 range
idnum id number of the currently used landmark
cmode current mode: 'F' = map building mode, 'I' map mode, 'Z' height calculation mode
corr 1 = apply position correction; 0 do not apply it
Returns:
0 : no error -1 : cannot serial port not open -2 : cannot communicate with the Stargazer -3 : buffer overrun (try to call more often this function!) -4 : read command not acknowledged -5 : data error -6 : no landmark found -7 : data error -8 : no received data -9 : mapid error 1 : update parameters after map building mode > 1: MAPID in map building mode

Definition at line 1477 of file kb_stargazer.c.

References a_axis, ANGLE_CORRECTION, angle_rot, b_axis, CMD_DEADZONE_ACK, CMD_MAPID_ACK, CMD_PARAM_UPDATE, id, kb_erase_line(), MAX_BUF, and SerialDeviceHandle.

Referenced by kb_gazer_calibration(), and main().

Here is the call graph for this function:


Variable Documentation

const char* kb_gazer_landmark_modes[]
const char* kb_gazer_landmark_types[]
Generated on Mon Dec 3 09:43:48 2012 for KoreBot Library by  doxygen 1.6.3