Project

General

Profile

Statistics
| Branch: | Revision:

root / scout / libscout / src / libscout.cpp @ ce8c3190

History | View | Annotate | Download (2.91 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 libscout.cpp
28
 * @brief Contains top level scout library functions
29
 * 
30
 * Contains functions and definitions for the use of
31
 * libscout
32
 *
33
 * @author Colony Project, CMU Robotics Club
34
 * @author Ben Wasserman
35
 */
36

    
37
#include "libscout.h"
38

    
39
/** @todo Decide how to call user behaviors
40
 *
41
 * I'm thinking that there be a function call in main that calls the "main"
42
 fn in the user behavior. However, their "main" function will not be called 
43
 main. However, this has to be able to point to different functions by 
44
 changing as little code in this file as possible. Also, the user behaviors
45
 should live in a different directory (possibly a different package).
46
 However, this other package should not be executed as a separate node,
47
 because that is the job of the libscout node/package to handle all the ROS 
48
 stuff, and keep it under the lid. The user only has to call normal c 
49
 functions. I also want to reduce the need to recompile this package when the 
50
 user behavior, or any other package that works below the surface.
51
 */
52

    
53
/**
54
 * @brief Initializes modules in the libscout.
55
 * 
56
 * Calls init functions for each module in libscout.
57
 * @param modules A bitmask of the modules that will be initialized.
58
 */
59
int init(int modules, int argc, char **argv)
60
{
61
    ros::init(argc, argv, "libscout");
62

    
63
    ros::NodeHandle node;
64

    
65
    MotorControl motors = new MotorControl(node);
66
    HeadLightControl headlights = new HeadlightControl(node);
67
    SonarControl sonars = new SonarControl(node);
68

    
69
    /** @todo Copy this if for each module that gets added to the library */
70
    /*if(modules & LIB_MOTORS)
71
    {
72
        libmotors_init();
73
    }
74
    if(modules & LIB_HEADLIGHTS)
75
    {
76
        libheadlights_init();
77
    }
78
    if(modules & LIB_BUTTONS)
79
    {
80
        libbuttons_init();
81
    }*/
82
    /** @todo Add other lib inits **/
83
    return 0;
84
}
85