root / vision / src / v2v3_converter.cpp @ 80eadc1e
History | View | Annotate | Download (773 Bytes)
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 |
} |