Revision ceff1d29
Added a new bom node skeleton.
It works using one service that sends the goal bot and current bot in the
request and gets the information from the 4 boms back in the response.
I did not actually implement the communication with the bom because that
requires communication with the avr, which is beyond my knowledge.
I put a pseudo function in its place that can be guiltlessly removed.
scout/bom/CMakeLists.txt | ||
---|---|---|
1 |
cmake_minimum_required(VERSION 2.4.6) |
|
2 |
include($ENV{ROS_ROOT}/core/rosbuild/rosbuild.cmake) |
|
3 |
|
|
4 |
# Set the build type. Options are: |
|
5 |
# Coverage : w/ debug symbols, w/o optimization, w/ code-coverage |
|
6 |
# Debug : w/ debug symbols, w/o optimization |
|
7 |
# Release : w/o debug symbols, w/ optimization |
|
8 |
# RelWithDebInfo : w/ debug symbols, w/ optimization |
|
9 |
# MinSizeRel : w/o debug symbols, w/ optimization, stripped binaries |
|
10 |
#set(ROS_BUILD_TYPE RelWithDebInfo) |
|
11 |
|
|
12 |
rosbuild_init() |
|
13 |
|
|
14 |
#set the default path for built executables to the "bin" directory |
|
15 |
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/bin) |
|
16 |
#set the default path for built libraries to the "lib" directory |
|
17 |
set(LIBRARY_OUTPUT_PATH ${PROJECT_SOURCE_DIR}/lib) |
|
18 |
|
|
19 |
#uncomment if you have defined messages |
|
20 |
rosbuild_genmsg() |
|
21 |
#uncomment if you have defined services |
|
22 |
rosbuild_gensrv() |
|
23 |
|
|
24 |
#common commands for building c++ executables and libraries |
|
25 |
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp) |
|
26 |
#target_link_libraries(${PROJECT_NAME} another_library) |
|
27 |
#rosbuild_add_boost_directories() |
|
28 |
#rosbuild_link_boost(${PROJECT_NAME} thread) |
|
29 |
#rosbuild_add_executable(example examples/example.cpp) |
|
30 |
#target_link_libraries(example ${PROJECT_NAME}) |
|
31 |
|
|
32 |
|
|
33 |
#TODO: FIGURE OUT HOW TO FIX THIS |
|
34 |
rosbuild_add_executable(bom_node src/bom.cpp) |
scout/bom/Makefile | ||
---|---|---|
1 |
include $(shell rospack find mk)/cmake.mk |
scout/bom/mainpage.dox | ||
---|---|---|
1 |
/** |
|
2 |
\mainpage |
|
3 |
\htmlinclude manifest.html |
|
4 |
|
|
5 |
\b bom is the ros node that will orient the robots toward each other and tell the direction that any sources of IR are coming from. It can also provide information relating to the orientation of the other robot and which robot it is. |
|
6 |
|
|
7 |
<!-- |
|
8 |
Bom will contain the functions necessary for reading the values obtained by the bearing and orientation module. It will also provide commands for asking the module to get readings from specific robots. |
|
9 |
--> |
|
10 |
|
|
11 |
|
|
12 |
\section codeapi Code API |
|
13 |
|
|
14 |
<!-- |
|
15 |
Provide links to specific auto-generated API documentation within your |
|
16 |
package that is of particular interest to a reader. Doxygen will |
|
17 |
document pretty much every part of your code, so do your best here to |
|
18 |
point the reader to the actual API. |
|
19 |
|
|
20 |
If your codebase is fairly large or has different sets of APIs, you |
|
21 |
should use the doxygen 'group' tag to keep these APIs together. For |
|
22 |
example, the roscpp documentation has 'libros' group. |
|
23 |
--> |
|
24 |
|
|
25 |
|
|
26 |
*/ |
scout/bom/manifest.xml | ||
---|---|---|
1 |
<package> |
|
2 |
<description brief="bom"> |
|
3 |
Bearing and Orientation Module |
|
4 |
Module to to orient and direct the robots toward each other or |
|
5 |
other sources of IR. |
|
6 |
</description> |
|
7 |
<author>James</author> |
|
8 |
<license>BSD</license> |
|
9 |
<review status="unreviewed" notes=""/> |
|
10 |
<url>https://www.roboticsclub.org/redmine/projects/colonyscout/wiki</url> |
|
11 |
<depend package="roscpp"/> |
|
12 |
<depend package="std_msgs"/> |
|
13 |
|
|
14 |
</package> |
|
15 |
|
|
16 |
|
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) 2007 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 |
* @file bom.h |
|
27 |
* @brief Contains bom declarations and functions. |
|
28 |
* |
|
29 |
* Contains functions and definitions for the use of |
|
30 |
* bom. |
|
31 |
* |
|
32 |
* @author Colony Project, CMU Robotics Club |
|
33 |
* @author ジェームス キャロル |
|
34 |
**/ |
|
35 |
|
|
36 |
#ifndef _BOM_H_ |
|
37 |
#define _BOM_H_ |
|
38 |
|
|
39 |
#include "bom/get_bom_reading.h" |
|
40 |
|
|
41 |
/** @brief Initialize the bom module and driver. **/ |
|
42 |
int main(int argc, char **argv); |
|
43 |
|
|
44 |
/** @brief Responds to service to get specific bom data**/ |
|
45 |
bool get_data(bom::get_bom_reading::Request &req, |
|
46 |
bom::get_bom_reading::Response &res); |
|
47 |
|
|
48 |
#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 |
Also available in: Unified diff