root / scout / libscout / src / libscout.cpp @ d1cc615c
History | View | Annotate | Download (2.86 KB)
1 | c406f16b | Ben | /**
|
---|---|---|---|
2 | 0121ead7 | bwasserm | * Copyright (c) 2011 Colony Project
|
3 | c406f16b | Ben | *
|
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 | c406f16b | Ben | |
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 | 737bb380 | Ben Wasserman | * @author Ben Wasserman
|
35 | a8480867 | Alex Zirbel | */
|
36 | c406f16b | Ben | |
37 | #include "libscout.h" |
||
38 | |||
39 | a8480867 | Alex Zirbel | /** @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 | c406f16b | Ben | |
53 | a8480867 | Alex Zirbel | /**
|
54 | * @brief Initializes modules in the libscout.
|
||
55 | 0121ead7 | bwasserm | *
|
56 | * Calls init functions for each module in libscout.
|
||
57 | a8480867 | Alex Zirbel | * @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 | 737bb380 | Ben Wasserman | |
68 | a8480867 | Alex Zirbel | /** @todo Copy this if for each module that gets added to the library */
|
69 | /*if(modules & LIB_MOTORS)
|
||
70 | {
|
||
71 | libmotors_init();
|
||
72 | }
|
||
73 | if(modules & LIB_HEADLIGHTS)
|
||
74 | {
|
||
75 | libheadlights_init();
|
||
76 | }
|
||
77 | if(modules & LIB_BUTTONS)
|
||
78 | {
|
||
79 | libbuttons_init();
|
||
80 | }*/
|
||
81 | /** @todo Add other lib inits **/
|
||
82 | return 0; |
||
83 | c406f16b | Ben | } |