Revision 66f55732
Adding painter node to control paintboard and metal detector
scout/painter/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 |
rosbuild_add_executable(painter src/painter.cpp) |
|
25 |
|
|
26 |
#common commands for building c++ executables and libraries |
|
27 |
#rosbuild_add_library(${PROJECT_NAME} src/example.cpp) |
|
28 |
#target_link_libraries(${PROJECT_NAME} another_library) |
|
29 |
#rosbuild_add_boost_directories() |
|
30 |
#rosbuild_link_boost(${PROJECT_NAME} thread) |
|
31 |
#rosbuild_add_executable(example examples/example.cpp) |
|
32 |
#target_link_libraries(example ${PROJECT_NAME}) |
scout/painter/Makefile | ||
---|---|---|
1 |
include $(shell rospack find mk)/cmake.mk |
scout/painter/mainpage.dox | ||
---|---|---|
1 |
/** |
|
2 |
\mainpage |
|
3 |
\htmlinclude manifest.html |
|
4 |
|
|
5 |
\b painter |
|
6 |
|
|
7 |
<!-- |
|
8 |
Provide an overview of your package. |
|
9 |
--> |
|
10 |
|
|
11 |
--> |
|
12 |
|
|
13 |
|
|
14 |
*/ |
scout/painter/manifest.xml | ||
---|---|---|
1 |
<package> |
|
2 |
<description brief="painter"> |
|
3 |
|
|
4 |
painter |
|
5 |
|
|
6 |
</description> |
|
7 |
<author>Thomas Mullins</author> |
|
8 |
<license>BSD</license> |
|
9 |
<review status="unreviewed" notes=""/> |
|
10 |
<url>http://ros.org/wiki/painter</url> |
|
11 |
<depend package="roscpp"/> |
|
12 |
<depend package="messages"/> |
|
13 |
|
|
14 |
</package> |
|
15 |
|
|
16 |
|
scout/painter/src/painter.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 painter.cpp |
|
28 |
* @brief Contains code to control the painter and query the metal detector. |
|
29 |
* |
|
30 |
* @author Colony Project, CMU Robotics Club |
|
31 |
* @author Tom Mullins |
|
32 |
* |
|
33 |
*/ |
|
34 |
|
|
35 |
#define QUEUE_SIZE 10 |
|
36 |
|
|
37 |
#include <cstdlib> |
|
38 |
#include <ros/ros.h> |
|
39 |
#include <messages/set_paintboard.h> |
|
40 |
#include <messages/query_paintboard.h> |
|
41 |
#include <messages/query_metal_detector.h> |
|
42 |
|
|
43 |
using namespace std; |
|
44 |
|
|
45 |
/** |
|
46 |
* @brief ROS callback to turn the paint output on or off |
|
47 |
*/ |
|
48 |
void paint_set(const ::messages::set_paintboard::ConstPtr& msg) |
|
49 |
{ |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* @brief ROS callback to query whether the paint output is on or off |
|
54 |
*/ |
|
55 |
bool paint_query(::messages::query_paintboard::Request &req, |
|
56 |
::messages::query_paintboard::Response &res) |
|
57 |
{ |
|
58 |
return true; |
|
59 |
} |
|
60 |
|
|
61 |
/** |
|
62 |
* @brief ROS callback to query whether there is metal detected |
|
63 |
*/ |
|
64 |
bool metal_query(::messages::query_metal_detector::Request &req, |
|
65 |
::messages::query_metal_detector::Response &res) |
|
66 |
{ |
|
67 |
return true; |
|
68 |
} |
|
69 |
|
|
70 |
/** |
|
71 |
* @brief Painter driver for ROS, to control the painter and metal detector |
|
72 |
* |
|
73 |
* @param argc The number of command line arguments (should be 1) |
|
74 |
* @param argv The array of command line arguments |
|
75 |
*/ |
|
76 |
int main(int argc, char **argv) |
|
77 |
{ |
|
78 |
ros::init(argc, argv, "painter"); |
|
79 |
ros::NodeHandle node; |
|
80 |
|
|
81 |
ros::Subscriber painter_sub = node.subscribe("/set_paintboard", QUEUE_SIZE, |
|
82 |
paint_set); |
|
83 |
ros::ServiceServer painter_srv = node.advertiseService("/query_paintboard", |
|
84 |
paint_query); |
|
85 |
ros::ServiceServer metal_srv = node.advertiseService("/query_metal_detector", |
|
86 |
metal_query); |
|
87 |
|
|
88 |
ROS_INFO("Painter node ready."); |
|
89 |
ros::spin(); |
|
90 |
|
|
91 |
return 0; |
|
92 |
} |
Also available in: Unified diff