root / scout / bom / src / bom.cpp @ ceff1d29
History | View | Annotate | Download (3.29 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 bom.cpp
|
28 |
* @brief Contains code to control the bom.
|
29 |
*
|
30 |
* Implementation of functions for bom use.
|
31 |
*
|
32 |
* @author Colony Project, CMU Robotics Club
|
33 |
* @author キャロル ジェムス
|
34 |
**/
|
35 |
|
36 |
#include "ros/ros.h" |
37 |
#include "bom.h" |
38 |
//#include "libscout/src/constants.h"
|
39 |
#include <cstdlib> |
40 |
|
41 |
/**
|
42 |
* @defgroup bom Bom
|
43 |
* @brief Functions for using the bom
|
44 |
*
|
45 |
* @{
|
46 |
**/
|
47 |
|
48 |
|
49 |
/**A psuedo function to make the below code compile**/
|
50 |
int get_response_from_avr(bom::get_bom_reading::Request &req,
|
51 |
bom::get_bom_reading::Response &res) |
52 |
{ |
53 |
/**
|
54 |
* The actual function will be in the avr, and will get the data
|
55 |
* directly off of the boms
|
56 |
**/
|
57 |
return 1; |
58 |
} |
59 |
|
60 |
|
61 |
/**
|
62 |
* @brief Sends who you want to look for, and returns the specific data
|
63 |
*
|
64 |
* Serves the service get_bom_reading by responding to service requests with the
|
65 |
* values of the boms.
|
66 |
* @param req The request. Should contain the name of the target bot and this
|
67 |
* bots name..
|
68 |
* @param res The response. The fields will be filled with values.
|
69 |
*/
|
70 |
bool get_data(bom::get_bom_reading::Request &req,
|
71 |
bom::get_bom_reading::Response &res) |
72 |
{ |
73 |
/**TODO is that how you pass the values across? need the ampersands?**/
|
74 |
get_response_from_avr(req,res); |
75 |
/**TODO if you haven't noticed, reader, this shouldn't work ...ask Priya **/
|
76 |
ROS_DEBUG("Data Recieved! Not");
|
77 |
return true; |
78 |
} |
79 |
|
80 |
/**
|
81 |
* @brief Bom driver. This is a ROS node that controls bom communication.
|
82 |
*
|
83 |
* This is the main function for the bom node. It is run when the node
|
84 |
* starts and initializes the bom. It then advertises the
|
85 |
* get_bom_reading service.
|
86 |
*
|
87 |
* @param argc The number of command line arguments (should be 1)
|
88 |
* @param argv The array of command line arguments
|
89 |
**/
|
90 |
int main(int argc, char **argv) |
91 |
{ |
92 |
/* Initialize in ROS the bom driver node */
|
93 |
ros::init(argc, argv, "bom_driver");
|
94 |
|
95 |
/* Advertise that this serves the get_bom_reading service */
|
96 |
ros::NodeHandle n; |
97 |
ros::ServiceServer service = n.advertiseService("get_bom_reading",
|
98 |
get_data); |
99 |
|
100 |
// Hardware init functions here
|
101 |
|
102 |
ROS_INFO("Ready to communicate with the bom.");
|
103 |
ros::spin(); |
104 |
|
105 |
return 0; |
106 |
} |
107 |
|
108 |
/** @} **/
|