Revision 80eadc1e
ID | 80eadc1e3c45684c96e4f083ad628fbb3e1fb357 |
Created the vision package
For now there is a skeleton of v2v3_converter (without the math) which
will take in a TargetDescriptor (x, y, size) and tf from /camera to
/kinect, and will output a 3d target location.
vision/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(v2v3_converter src/v2v3_converter.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}) |
vision/Makefile | ||
---|---|---|
1 |
include $(shell rospack find mk)/cmake.mk |
vision/mainpage.dox | ||
---|---|---|
1 |
/** |
|
2 |
\mainpage |
|
3 |
\htmlinclude manifest.html |
|
4 |
|
|
5 |
\b vision is ... |
|
6 |
|
|
7 |
<!-- |
|
8 |
Provide an overview of your package. |
|
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 |
*/ |
vision/manifest.xml | ||
---|---|---|
1 |
<package> |
|
2 |
<description brief="vision"> |
|
3 |
|
|
4 |
vision |
|
5 |
|
|
6 |
</description> |
|
7 |
<author>Thomas Mullins</author> |
|
8 |
<license>BSD</license> |
|
9 |
<review status="unreviewed" notes=""/> |
|
10 |
<url>http://ros.org/wiki/vision</url> |
|
11 |
<depend package="roscpp"/> |
|
12 |
<depend package="tf"/> |
|
13 |
<depend package="geometry_msgs"/> |
|
14 |
|
|
15 |
</package> |
|
16 |
|
|
17 |
|
vision/msg/TargetDescriptor.msg | ||
---|---|---|
1 |
Header header |
|
2 |
float64 x |
|
3 |
float64 y |
|
4 |
float64 size |
vision/src/v2v3_converter.cpp | ||
---|---|---|
1 |
#include <ros/ros.h> |
|
2 |
#include <vision/TargetDescriptor.h> |
|
3 |
#include <geometry_msgs/Point.h> |
|
4 |
#include <tf/transform_listener.h> |
|
5 |
|
|
6 |
tf::TransformListener listener; |
|
7 |
ros::Publisher pub; |
|
8 |
|
|
9 |
void target_cb(const vision::TargetDescriptor target) { |
|
10 |
geometry_msgs::Point point; |
|
11 |
tf::StampedTransform transform; |
|
12 |
try { |
|
13 |
listener.lookupTransform("/camera", "/kinect", ros::Time(0), transform); |
|
14 |
} |
|
15 |
catch (tf::TransformException ex) { |
|
16 |
ROS_ERROR("%s", ex.what()); |
|
17 |
} |
|
18 |
// TODO fill point based on target and tf |
|
19 |
pub.publish(point); |
|
20 |
} |
|
21 |
|
|
22 |
int main(int argc, char **argv) { |
|
23 |
ros::init(argc, argv, "v2v3_converter"); |
|
24 |
ros::NodeHandle n; |
|
25 |
ros::Subscriber sub = n.subscribe("target_2d", 1, target_cb); |
|
26 |
pub = n.advertise<geometry_msgs::Point>("target_3d", 1000); |
|
27 |
ros::spin(); |
|
28 |
} |
Also available in: Unified diff