Robot Control Library
rc_usefulincludes.h
Go to the documentation of this file.
1/**
2 * <rc_usefulincludes.h>
3 *
4 * This may be used as an "uber-include" at the beginning of a c file to include
5 * the most common C libs without having a cluttered list. This is technically
6 * bad practice and you should include only the headers necessary for your
7 * program to operate. However, this can save time while quickly prototyping and
8 * remains for backwards compatability.
9 *
10 * @addtogroup Useful_Includes
11 * @ingroup Deprecated
12 * @{
13 */
14
15
16#ifndef RC_USEFUL_INCLUDES
17#define RC_USEFUL_INCLUDES
18
19
20#define _GNU_SOURCE
21
22#include <stdio.h>
23#include <stdlib.h>
24#include <stdint.h>
25#include <string.h>
26#include <fcntl.h>
27#include <unistd.h>
28#include <getopt.h>
29#include <termios.h>
30#include <errno.h>
31#include <sys/ioctl.h>
32#include <sys/types.h> // for uint8_t types etc
33#include <sys/stat.h>
34#include <time.h> // usleep, nanosleep
35#include <math.h> // atan2 and fabs
36#include <signal.h> // capture ctrl-c
37#include <pthread.h> // multi-threading
38#include <linux/input.h>// buttons
39#include <poll.h> // interrupt events
40#include <sys/mman.h> // mmap for accessing eQep
41#include <sys/socket.h> // udp socket
42#include <netinet/in.h> // udp socket
43#include <sys/time.h>
44#include <arpa/inet.h> // udp socket
45#include <ctype.h> // for isprint()
46#include <sys/select.h> // for read timeout
47
48
49// Useful Constants
50#ifndef DEG_TO_RAD
51#define DEG_TO_RAD 0.0174532925199
52#endif
53
54#ifndef RAD_TO_DEG
55#define RAD_TO_DEG 57.295779513
56#endif
57
58#ifndef PI
59#define PI M_PI
60#endif
61
62#ifndef TWO_PI
63#define TWO_PI (2.0 * M_PI)
64#endif
65
66
67// Useful Macros
68#ifndef ARRAY_SIZE
69#define ARRAY_SIZE(array) sizeof(array)/sizeof(array[0])
70#endif
71
72#ifndef min
73#define min(a, b) ((a < b) ? a : b)
74#endif
75
76#endif // RC_USEFUL_INCLUDES
77
78///@} end group Deprecated