peripherals  1.4.2
RoadNarrows Robotics Hardware Peripherals Package
MotQik.h
1 /*
2  Title: Header file for serial control of Qik motor controller
3  Author: Rob Shiely
4  Date: 4/12/2012
5  TODOs: Need functions to get current from controllers
6 */
7 #ifndef _qik_h
8 #define _qik_h
9 
10 #include <sys/types.h>
11 #include <sys/stat.h>
12 #include <sys/ioctl.h>
13 #include <limits.h>
14 #include <fcntl.h>
15 #include <termios.h>
16 #include <unistd.h>
17 #include <stdio.h>
18 #include <stdlib.h>
19 #include <stdarg.h>
20 #include <time.h>
21 #include <errno.h>
22 #include <string.h>
23 #include "rnr/serdev.h"
24 #include "rnr/log.h"
25 /*
26  BAUD rate to use for Qik motor controllers.
27  This rate can be changed in Qik registers.
28 */
29 #define BAUDRATE 38400
30 
31 struct Qiks {
32  int m_fdQiks;
33  int m_fdQiks2; // DHP: for future
34 };
35 
36 /*
37  Function opens serial comunication with set port.
38  (No actual communication with Qik controllers in this function)
39  Returns: 0 on success and -1 on failure (0 or -1)
40 */
41 int QikOpenConnection(int *Descriptor);
42 
43 
44 /*
45  Function updates the speed of a single wheel.
46  Needs to be passed: A speed (-250 < speed < 250), a file descriptor,
47  and a motor (0 = left, 1 = right)
48  Returns: 0 on Success, -1 on incorrect speed, -2 on serial write fail.
49 */
50 int QikUpdateMotorSpeeds(int Speed, int Descriptor, int Side);
51 
52 
53 /*
54  Function changes how agressively each individual motor brakes.
55  Needs to be passed: A brake rate (0 < Braking < 31: 31 = full brake),
56  a file descriptor, and a motor)
57  Returns: 0 on Success, -1 on incorrect speed, -2 on serial write fail.
58 */
59 int QikAlterBraking(int Braking, int Descriptor, int Side);
60 
61 
62 /*
63  Function changes how agressively each individual motor changes dirrection.
64  Needs to be passed: A slew rate (0 < slew < 90: 0 = immediate change),
65  a file descriptor, and a motor)
66  Returns: 0 on Success, -1 on incorrect speed, -2 on serial write fail.
67 */
68 int QikAlterSlew(int Slew, int Descriptor, int Side);
69 
70 
71 /*
72  E-Stop Function to lock up all wheels ICE
73  Needs to be passed: Both descriptors.
74 */
75 void QikEStop(int Descriptor);
76 
77 /*
78  Closing function to release a connection to a device.
79 */
80 int QikClose(int Descriptor);
81 
82 #endif // _qik_h
Definition: MotQik.h:31