Statistics
| Branch: | Revision:

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

History | View | Annotate | Download (2.2 KB)

1
/**
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
 */
25

    
26
/**
27
 * @file HeadlightControl.h
28
 * @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
 * @author Alex Zirbel
36
 */
37

    
38
#ifndef _HEADLIGHT_CONTROL_H_
39
#define _HEADLIGHT_CONTROL_H_
40

    
41
#include <ros/ros.h>
42
#include <messages/set_headlights.h>
43

    
44
#include "constants.h"
45

    
46
/* Defines */
47
#define WHITE                0xFFFFFF
48
#define OFF                        0x000000
49
#define RED                 0xFF0000
50
#define GREEN             0x00FF00
51
#define BLUE                0x0000FF
52
#define YELLOW            0xFFFF00
53
#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
#define NO_SET        -1
61

    
62
#define REDSHIFT                 16
63
#define GREENSHIFT             8
64
#define BLUESHIFT                0
65

    
66
class HeadlightControl
67
{
68
    public:
69
        HeadlightControl(const ros::NodeHandle& libscout_node,
70
                         std::string scoutname);
71

    
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

    
78
        ros::Publisher set_headlights_pub;
79
};
80

    
81
#endif
82