"Fossies" - the Fresh Open Source Software Archive

Member "motion-Release-4.3.0/src/track.h" (14 Jan 2020, 5144 Bytes) of package /linux/misc/motion-Release-4.3.0.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "track.h" see the Fossies "Dox" file reference documentation.

    1 /*    track.h
    2  *
    3  *    Experimental motion tracking.
    4  *
    5  *    Copyright 2000, Jeroen Vreeken
    6  *    This program is published under the GNU Public license
    7  */
    8 
    9 #ifndef _INCLUDE_TRACK_H
   10 #define _INCLUDE_TRACK_H
   11 
   12 #include "alg.h"
   13 #include <termios.h>
   14 
   15 struct trackoptions {
   16     int dev;
   17     /* Config options: */
   18     unsigned int type;
   19     char *port;
   20     unsigned int motorx;
   21     unsigned int motory;
   22     int maxx;
   23     int maxy;
   24     int minx;
   25     int miny;
   26     unsigned int stepsize;
   27     unsigned int speed;
   28     unsigned int homex;
   29     unsigned int homey;
   30     unsigned int iomojo_id;
   31     unsigned int active;            /* This is the track_auto but 'auto' is defined word so use active*/
   32     unsigned int motorx_reverse;
   33     unsigned int motory_reverse;
   34     unsigned int minmaxfound;
   35     unsigned int step_angle_x;
   36     unsigned int step_angle_y;
   37     unsigned int move_wait;
   38     /* UVC */
   39     int pan_angle; // degrees
   40     int tilt_angle; // degrees
   41     char *generic_move;
   42 };
   43 
   44 extern struct trackoptions track_template;
   45 
   46 unsigned int track_center(struct context *, int, unsigned int, int, int);
   47 unsigned int track_move(struct context *, int, struct coord *, struct images *, unsigned int);
   48 
   49 enum track_action { TRACK_CENTER, TRACK_MOVE };
   50 
   51 /*
   52  * Some default values:
   53  */
   54 #define TRACK_SPEED             255
   55 #define TRACK_STEPSIZE          40
   56 
   57 #define TRACK_TYPE_STEPPER      1
   58 #define TRACK_TYPE_IOMOJO       2
   59 #define TRACK_TYPE_PWC          3
   60 #define TRACK_TYPE_GENERIC      4
   61 #define TRACK_TYPE_UVC          5
   62 #define TRACK_TYPE_SERVO        6
   63 
   64 /*
   65  * Some defines for the Serial stepper motor:
   66  */
   67 
   68 #define STEPPER_BAUDRATE        B9600
   69 
   70 #define STEPPER_STATUS_LEFT     1
   71 #define STEPPER_STATUS_RIGHT    2
   72 #define STEPPER_STATUS_SAFETYL  4
   73 #define STEPPER_STATUS_SAFETYR  8
   74 
   75 #define STEPPER_STATUS_UP       1
   76 #define STEPPER_STATUS_DOWN     2
   77 #define STEPPER_STATUS_SAFETYU  4
   78 #define STEPPER_STATUS_SAFETYD  8
   79 
   80 
   81 
   82 #define STEPPER_COMMAND_STATUS  0
   83 #define STEPPER_COMMAND_LEFT_N  1
   84 #define STEPPER_COMMAND_RIGHT_N 2
   85 #define STEPPER_COMMAND_LEFT    3
   86 #define STEPPER_COMMAND_RIGHT   4
   87 #define STEPPER_COMMAND_SWEEP   5
   88 #define STEPPER_COMMAND_STOP    6
   89 #define STEPPER_COMMAND_SPEED   7
   90 
   91 #define STEPPER_COMMAND_UP_N    1
   92 #define STEPPER_COMMAND_DOWN_N  2
   93 #define STEPPER_COMMAND_UP      3
   94 #define STEPPER_COMMAND_DOWN    4
   95 
   96 
   97 
   98 /*
   99  * Some defines for the Serial servo motor:
  100  */
  101 
  102 /*
  103  * Controlling:
  104  * Three bytes are sent to the servo - BYTE1=SERVO_COMMAND BYTE2=COMMAND BYTE3=DATA
  105  * eg, sending the command    01 02 08    would Command SERVO_COMMAND1 to move LEFT a total of 8 STEPS
  106  *
  107  * An extra command 0x08 has been added but here is the basic command set.
  108  *
  109  * 0x00 STATUS   - Current status byte will be returned, data byte ignored
  110  * 0x01 LEFT_N   - Servo will take N Steps to the Left until it reaches the Servos safety limit
  111  * 0x02 RIGHT_N  - Servo will take N Steps to the Right until it reaches the Servos safety limit
  112  * 0x03 LEFT     - Servo will move to Left most position, data byte ignored.
  113  * 0x04 RIGHT    - Servo will move to Right most position, data byte ignored.
  114  * 0x05 SWEEP    - Servo will sweep between its extremes, data byte ignored.
  115  * 0x06 STOP     -  Servo will Stop, data byte ignored
  116  * 0x07 SPEED    - Set servos speed between 0 and 255.
  117  * 0x08 ABSOLUTE - Set servo to absolute position between 0 and 255
  118  * 0x09 POSITION - Get servo to absolute position between 0 and 255
  119  * */
  120 
  121 #define SERVO_BAUDRATE        B9600
  122 
  123 #define SERVO_COMMAND_STATUS   0
  124 #define SERVO_COMMAND_LEFT_N   1
  125 #define SERVO_COMMAND_RIGHT_N  2
  126 #define SERVO_COMMAND_LEFT     3
  127 #define SERVO_COMMAND_RIGHT    4
  128 #define SERVO_COMMAND_SWEEP    5
  129 #define SERVO_COMMAND_STOP     6
  130 #define SERVO_COMMAND_SPEED    7
  131 #define SERVO_COMMAND_ABSOLUTE 8
  132 #define SERVO_COMMAND_POSITION 9
  133 
  134 
  135 #define SERVO_COMMAND_UP_N     1
  136 #define SERVO_COMMAND_DOWN_N   2
  137 #define SERVO_COMMAND_UP       3
  138 #define SERVO_COMMAND_DOWN     4
  139 
  140 
  141 
  142 /*
  143  * Some defines for the Iomojo Smilecam:
  144  */
  145 
  146 #define IOMOJO_BAUDRATE    B19200
  147 
  148 #define IOMOJO_CHECKPOWER_CMD   0xff
  149 #define IOMOJO_CHECKPOWER_RET   'Q'
  150 #define IOMOJO_MOVEOFFSET_CMD   0xfe
  151 #define IOMOJO_SETSPEED_CMD     0xfd
  152 #define IOMOJO_SETSPEED_RET     'P'
  153 #define IOMOJO_MOVEHOME         0xf9
  154 #define IOMOJO_RESTART          0xf7
  155 
  156 #define IOMOJO_DIRECTION_RIGHT  0x01
  157 #define IOMOJO_DIRECTION_LEFT   0x02
  158 #define IOMOJO_DIRECTION_DOWN   0x04
  159 #define IOMOJO_DIRECTION_UP     0x08
  160 
  161 #ifdef HAVE_V4L2
  162 
  163 /*
  164  * Defines for the Logitech QuickCam Orbit/Sphere USB webcam
  165  */
  166 
  167 #define LQOS_VERTICAL_DEGREES   180
  168 #define LQOS_HORIZONAL_DEGREES  120
  169 
  170 /*
  171  * UVC
  172  */
  173 
  174 #ifndef V4L2_CID_PAN_RELATIVE
  175 #define V4L2_CID_PAN_RELATIVE                   (V4L2_CID_CAMERA_CLASS_BASE+4)
  176 #endif
  177 
  178 #ifndef V4L2_CID_TILT_RELATIVE
  179 #define V4L2_CID_TILT_RELATIVE                  (V4L2_CID_CAMERA_CLASS_BASE+5)
  180 #endif
  181 
  182 #ifndef V4L2_CID_PAN_RESET
  183 #define V4L2_CID_PAN_RESET                      (V4L2_CID_CAMERA_CLASS_BASE+6)
  184 #endif
  185 
  186 #ifndef V4L2_CID_TILT_RESET
  187 #define V4L2_CID_TILT_RESET                     (V4L2_CID_CAMERA_CLASS_BASE+7)
  188 #endif
  189 
  190 #define INCPANTILT 64 // 1 degree
  191 
  192 
  193 #endif /* HAVE_V4L2 */
  194 
  195 #endif /* _INCLUDE_TRACK_H */