Project

General

Profile

Revision 887b4a1a

ID887b4a1abdaf5a378dca497732905512595e3dff
Parent b23c6bbb
Child 399f7d1b

Added by Thomas Mullins over 11 years ago

Removed bom.cpp, bom.h, get_bom_reading.srv, and query_sonar.srv

Removed them for real this time; not pretend :D

View differences:

scout/bom/src/bom.cpp
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
/** @} **/
scout/bom/src/bom.h
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.h
28
 * @brief Contains bom declarations and functions.
29
 * 
30
 * Contains functions and definitions for the use of
31
 * bom.
32
 *
33
 * @author Colony Project, CMU Robotics Club
34
 * @author ジェームス キャロル
35
 **/
36

  
37
#ifndef _BOM_H_
38
#define _BOM_H_
39

  
40
#include "bom/get_bom_reading.h"
41

  
42
/** @brief Initialize the bom module and driver. **/
43
int main(int argc, char **argv);
44

  
45
/** @brief Responds to service to get specific bom data**/
46
bool get_data(bom::get_bom_reading::Request &req,
47
             bom::get_bom_reading::Response &res);
48

  
49
#endif
scout/bom/srv/get_bom_reading.srv
1
#TODO not sure what magnitude the boms span, ie change the 8 to something right
2
#TODO from sounds weird, think of something better
3

  
4
#NOTE; if say a -1 was used for the bom_targ_name, then maybe it would just 
5
#   >  send back the raw data or something.
6

  
7
#The number assicoiated with the robot you want to listen for
8
int8 bom_targ_name
9
#Your robot number, just in case you want to pretend to be someone else
10
int8 bom_my_name
11

  
12
---
13
#The data recieved
14
#Of the form: magnitude recieved, from which robot, from which bom on that bot
15
int8 bom0_mag
16
int8 bom0_from
17
int8 bom0_from_bom
18

  
19
int8 bom1_mag
20
int8 bom1_from
21
int8 bom1_from_bom
22

  
23
int8 bom2_mag
24
int8 bom2_from
25
int8 bom2_from_bom
26

  
27
int8 bom3_mag
28
int8 bom3_from
29
int8 bom3_from_bom
scout/messages/srv/query_sonar.srv
1
int8 direction
2
---
3
#front sonar
4
int16 distance0
5
#back sonar
6
int16 distance1

Also available in: Unified diff