blobtracker.h File Reference

This file contains definitions we need to use the blob tracker. More...

#include <pthread.h>
#include <ncurses.h>
#include "guardmodes.h"
#include "config.h"

Include dependency graph for blobtracker.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  blobTrackerArgs
 Structure for thread's arguments. More...

Defines

#define CAMERAANGLE   34
 Camera opening angle.
#define ROTATIONSTRESH   4
 Object position changes below this do not trigger the rotation.
#define BLOBTRACKER_SEARCH_SPEED   20.0
Constraints for HSV color blobs


#define DEFAULT_HSV_HUE_MIN   15
#define DEFAULT_HSV_HUE_MAX   32
#define DEFAULT_HSV_SAT_MIN   60
#define DEFAULT_HSV_SAT_MAX   85
#define DEFAULT_HSV_VAL_MIN   35
#define DEFAULT_HSV_VAL_MAX   100
Search or follow mode for blob tracker
Yet another set of blob tracker modes. We need them after a wakeup from sleeping mode, when we have to search for the other robot.

#define BLOBTRACKER_SEARCH   0
 rotate around and search for a blob
#define BLOBTRACKER_SEARCH2FOLLOW   1
 transional state between search and follow
#define BLOBTRACKER_FOLLOW   2
 ordinary old follow mode for blobs

Functions

void * blobTracker (void *arg)
 This thread is responsible for tracking the color blob and moving the robot to center the blob in its view area.
void blobTrackerPause (void)
 Send a pause request to the blob tracker and wait for it to reach the pause mode.
void blobTrackerWakeup (void)
 Remove the pause request (if set) and send a wakeup signal.
void blobTrackerStop (void)
 Send a quit request and send a wakeup signal if the blob tracker is in pause mode.
void blobTrackerSaveOrientation (void)
 Saves the current wheel positions to restore the robot's orientation later.
void blobTrackerRestoreOrientation (void)
 Restores the robot's orientation based on previously stored values, see blobTrackerSaveOrientation().

Variables

char blobTrackerQuitReq
 Set to 1 to end the blob tracker thread.
char blobTrackerPauseReq
 Set to 1 to let the blob tracker pause.
char blobTrackerMode
 Tells if the blob tracker is running or pausing.
char blobTrackerSearchOrFollow
 Tells us, if the blob tracker actively searches for a blob or simply follows an existing blob.
pthread_cond_t blobTrackerRun
 Sending a signal to this variable wakes the blob tracker from pausing.
pthread_mutex_t blobTrackerRunMutex
 Mutex needed for the conditional variable.


Detailed Description

This file contains definitions we need to use the blob tracker.

Blob tracker is a thread responsible for recognizing and folowing a color blob.

Version:
Id
blobtracker.h,v 1.17 2008/09/18 12:59:01 prokop Exp

Definition in file blobtracker.h.


Define Documentation

#define BLOBTRACKER_FOLLOW   2

ordinary old follow mode for blobs

Definition at line 58 of file blobtracker.h.

#define BLOBTRACKER_SEARCH   0

rotate around and search for a blob

Definition at line 56 of file blobtracker.h.

#define BLOBTRACKER_SEARCH2FOLLOW   1

transional state between search and follow

Definition at line 57 of file blobtracker.h.

#define BLOBTRACKER_SEARCH_SPEED   20.0

Definition at line 61 of file blobtracker.h.

#define CAMERAANGLE   34

Camera opening angle.

Definition at line 47 of file blobtracker.h.

#define DEFAULT_HSV_HUE_MAX   32

Definition at line 39 of file blobtracker.h.

#define DEFAULT_HSV_HUE_MIN   15

Definition at line 38 of file blobtracker.h.

#define DEFAULT_HSV_SAT_MAX   85

Definition at line 41 of file blobtracker.h.

#define DEFAULT_HSV_SAT_MIN   60

Definition at line 40 of file blobtracker.h.

#define DEFAULT_HSV_VAL_MAX   100

Definition at line 43 of file blobtracker.h.

#define DEFAULT_HSV_VAL_MIN   35

Definition at line 42 of file blobtracker.h.

#define ROTATIONSTRESH   4

Object position changes below this do not trigger the rotation.

Definition at line 49 of file blobtracker.h.


Function Documentation

void* blobTracker ( void *  arg  ) 

This thread is responsible for tracking the color blob and moving the robot to center the blob in its view area.

Parameters:
arg Arguments for this thread. Currently unused.
Returns:
Nothing.

Definition at line 95 of file blobtracker.c.

void blobTrackerPause ( void   ) 

Send a pause request to the blob tracker and wait for it to reach the pause mode.

Definition at line 192 of file blobtracker.c.

void blobTrackerRestoreOrientation ( void   ) 

Restores the robot's orientation based on previously stored values, see blobTrackerSaveOrientation().

This method blocks, until the previous position is restored.

< Difference between both wheel positions

< Current (new) position for left wheel

< Current (new) position for right wheel

< Intermediate position for left wheel while trying to reach the old position

< Intermediate position for right wheel while trying to reach the old position

Definition at line 225 of file blobtracker.c.

void blobTrackerSaveOrientation ( void   ) 

Saves the current wheel positions to restore the robot's orientation later.

Keep in mind, that the robot should have stopped before, to get reliable values.

Definition at line 219 of file blobtracker.c.

void blobTrackerStop ( void   ) 

Send a quit request and send a wakeup signal if the blob tracker is in pause mode.

Definition at line 206 of file blobtracker.c.

void blobTrackerWakeup ( void   ) 

Remove the pause request (if set) and send a wakeup signal.

Definition at line 199 of file blobtracker.c.


Variable Documentation

Tells if the blob tracker is running or pausing.

Values are defined in guardmodes.h

Definition at line 50 of file blobtracker.c.

Set to 1 to let the blob tracker pause.

To run the blob tracker again you have to send a signal via the condition variable blobTrackerRun

Definition at line 49 of file blobtracker.c.

Set to 1 to end the blob tracker thread.

Definition at line 48 of file blobtracker.c.

pthread_cond_t blobTrackerRun

Sending a signal to this variable wakes the blob tracker from pausing.

Definition at line 37 of file blobtracker.c.

pthread_mutex_t blobTrackerRunMutex

Mutex needed for the conditional variable.

Definition at line 36 of file blobtracker.c.

Tells us, if the blob tracker actively searches for a blob or simply follows an existing blob.

See Search or follow mode for blob tracker for a list of valid modes. The intended usage is

  • Brain sets the mode to search and revives this blob tracker thread
  • Blob tracker searches for a blob, finds it, stops and goes to the transient search2follow mode.
  • The previously found blob is centered and blob tracker changes to the follow mode
  • Brain, who monitors the blob tracker mode, tells the other robot to proceed.

Definition at line 52 of file blobtracker.c.


Generated on Sun Sep 28 21:20:01 2008 for Guard by  doxygen 1.5.6