Project

General

Profile

Revision 05e1c990

ID05e1c9904637326580e5a8c47e8a5d5faa07153c

Added by Thomas Mullins over 7 years ago

Fixed immediate runtime error

Moved the TransformListener initialization into the target_cb, so that
it wouldn't try to initialize a NodeHandle before ros::init was called.

View differences:

vision/src/v2v3_converter.cpp
3 3
#include <geometry_msgs/Point.h>
4 4
#include <tf/transform_listener.h>
5 5

  
6
tf::TransformListener listener;
7 6
ros::Publisher pub;
8 7

  
9 8
void target_cb(const vision::TargetDescriptor target) {
9
  tf::TransformListener listener;
10 10
  geometry_msgs::Point point;
11 11
  tf::StampedTransform transform;
12 12
  try {
......
25 25
  ros::Subscriber sub = n.subscribe("target_2d", 1, target_cb);
26 26
  pub = n.advertise<geometry_msgs::Point>("target_3d", 1000);
27 27
  ros::spin();
28
  return 0;
28 29
}

Also available in: Unified diff