pose_tracker_main.cpp
Go to the documentation of this file.
00001 /*
00002  * pose_tracker_main.cpp
00003  *
00004  *  Created on: Feb 21, 2012
00005  *      Author: sprunkc
00006  *
00007  *  ported to ros from robular implementation by joerg mueller
00008  */
00009 
00010 
00011 #include <ros/ros.h>
00012 
00013 #include "posetracker.h"
00014 #include <vector>
00015 #include <XmlRpcValue.h>
00016 #include <iomanip>
00017 using namespace std;
00018 
00019 std::vector<PoseTracker*> pts;
00020 
00021 void markerCallback(const visualization_msgs::MarkerArray::ConstPtr &msg){
00022   for(unsigned int i=0; i<pts.size(); i++){
00023     pts.at(i)->process(msg);
00024   }
00025 }
00026 #include <iomanip>
00027 int main(int argc, char** argv)
00028 {
00029 
00030   ros::init(argc, argv, "posetracker");
00031 
00032   ros::NodeHandle nh;
00033   ros::NodeHandle private_nh("~");
00034 
00035   ros::Subscriber sub_marker = nh.subscribe<visualization_msgs::MarkerArray>("cortex_marker_array", 10, &markerCallback);
00036   tf::TransformBroadcaster pose_broadcaster;
00037 
00038 
00039 
00040   double scale;
00041   double sqrErrThreshold;
00042   bool useRansac = false;
00043   int numRansacSamples;
00044 
00045   private_nh.param<double>("scale", scale, 0.001);
00046   private_nh.param<double>("sqrErrThreshold", sqrErrThreshold, 0.05);
00047   private_nh.param<bool>("useRansac", useRansac, false);
00048   private_nh.param<int>("numRansacSamples", numRansacSamples, 10);
00049 
00050 
00051   XmlRpc::XmlRpcValue propfiles;
00052   private_nh.getParam("propfiles", propfiles);
00053   ROS_ASSERT(propfiles.getType() == XmlRpc::XmlRpcValue::TypeArray);
00054 
00055   for (int32_t i = 0; i < propfiles.size(); ++i)
00056   {
00057     ROS_ASSERT(propfiles[i].getType() == XmlRpc::XmlRpcValue::TypeString);
00058     std::string propfile = static_cast<std::string>(propfiles[i]);
00059     PoseTracker* pt = new PoseTracker();
00060     pt->init(propfile, scale, &pose_broadcaster, sqrErrThreshold, useRansac, numRansacSamples);
00061     pts.push_back(pt);
00062   }
00063 
00064   ros::spin();
00065 }
00066 
00067 
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines


cortex_stream
Author(s): Daniel Maier
autogenerated on Wed Oct 31 2012 08:22:56