Statistics
| Branch: | Revision:

root / scout / libscout / src / HeadlightControl.h @ 071926c2

History | View | Annotate | Download (2.2 KB)

1 90c7a37c Ben Wasserman
/**
2
 * Copyright (c) 2011 Colony Project
3
 * 
4
 * Permission is hereby granted, free of charge, to any person
5
 * obtaining a copy of this software and associated documentation
6
 * files (the "Software"), to deal in the Software without
7
 * restriction, including without limitation the rights to use,
8
 * copy, modify, merge, publish, distribute, sublicense, and/or sell
9
 * copies of the Software, and to permit persons to whom the
10
 * Software is furnished to do so, subject to the following
11
 * conditions:
12
 * 
13
 * The above copyright notice and this permission notice shall be
14
 * included in all copies or substantial portions of the Software.
15
 * 
16
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
18
 * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
20
 * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
21
 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
22
 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
23
 * OTHER DEALINGS IN THE SOFTWARE.
24 a8480867 Alex Zirbel
 */
25 90c7a37c Ben Wasserman
26
/**
27 a8480867 Alex Zirbel
 * @file HeadlightControl.h
28 90c7a37c Ben Wasserman
 * @brief Contains headlights declarations and functions
29
 * 
30
 * Contains functions and definitions for the use of
31
 * headlights
32
 *
33
 * @author Colony Project, CMU Robotics Club
34
 * @author Ben Wasserman
35 a8480867 Alex Zirbel
 * @author Alex Zirbel
36
 */
37 90c7a37c Ben Wasserman
38 a8480867 Alex Zirbel
#ifndef _HEADLIGHT_CONTROL_H_
39
#define _HEADLIGHT_CONTROL_H_
40 90c7a37c Ben Wasserman
41 a8480867 Alex Zirbel
#include <ros/ros.h>
42 071926c2 Alex
#include <messages/set_headlights.h>
43 90c7a37c Ben Wasserman
44 cc558a8d Alex Zirbel
#include "constants.h"
45
46 90c7a37c Ben Wasserman
/* Defines */
47
#define WHITE                0xFFFFFF
48
#define OFF                        0x000000
49
#define RED                 0xFF0000
50 a8480867 Alex Zirbel
#define GREEN             0x00FF00
51 90c7a37c Ben Wasserman
#define BLUE                0x0000FF
52 a8480867 Alex Zirbel
#define YELLOW            0xFFFF00
53 90c7a37c Ben Wasserman
#define CYAN                0x00FFFF
54
#define PINK                0xFF00FF
55
56
#define HL_RIGHT        0x1
57
#define HL_LEFT                0x2
58
#define HL_BOTH                0x3
59
60 3ec16d35 Ben Wasserman
#define NO_SET        -1
61
62 90c7a37c Ben Wasserman
#define REDSHIFT                 16
63 a8480867 Alex Zirbel
#define GREENSHIFT             8
64
#define BLUESHIFT                0
65
66
class HeadlightControl
67
{
68
    public:
69 cc558a8d Alex Zirbel
        HeadlightControl(const ros::NodeHandle& libscout_node,
70
                         std::string scoutname);
71 a8480867 Alex Zirbel
72
        void set(int color, int which);
73
        void set_rgb(int red, int green, int blue, int which);
74
75
    private:
76
        ros::NodeHandle node;
77 90c7a37c Ben Wasserman
78 a8480867 Alex Zirbel
        ros::Publisher set_headlights_pub;
79
};
80 90c7a37c Ben Wasserman
81
#endif