19 #include <asr_msgs/AsrObject.h> 20 #include <sensor_msgs/JointState.h> 21 #include <geometry_msgs/PoseStamped.h> 22 #include <posedetection_msgs/Object6DPose.h> 26 #include <boost/thread.hpp> 46 void ptuCB(
const sensor_msgs::JointState& ptu_msg) {
48 pan = ptu_msg.position[0];
49 tilt = ptu_msg.position[1];
52 void fobCB(
const asr_msgs::AsrObject& fob_msg) {
53 if (!fob_msg.identifier.empty() && strcmp(fob_msg.identifier.c_str(),
"tracker_left_raw") == 0) {
55 geometry_msgs::PoseWithCovariance current_pose_with_c = fob_msg.sampledPoses.back();
56 fob_pose = current_pose_with_c.pose;
59 void cbdCB(
const geometry_msgs::PoseStamped& cbd_msg) {
62 cbd_pose = cbd_msg.pose;
70 nh.
getParam(
"output_file_path", output_file_path);
76 boost::thread trackerThread(
spin,
this);
81 ROS_INFO(
"Enter 'e' to stop capturing.");
82 while (std::cin.
get() !=
'e'){
91 ss << pan <<
"; " << tilt <<
"; ";
92 ss << fob_pose.position.x <<
"; " << fob_pose.position.y <<
"; " << fob_pose.position.z <<
"; ";
93 ss << fob_pose.orientation.w <<
"; " << fob_pose.orientation.x <<
"; " << fob_pose.orientation.y <<
"; " << fob_pose.orientation.z <<
"; ";
94 ss << cbd_pose.position.x <<
"; " << cbd_pose.position.y <<
"; " << cbd_pose.position.z << std::endl;
96 std::ofstream dataFile;
97 dataFile.open (output_file_path.c_str(),std::ios::app);
100 ROS_INFO(
"data captured %d", data_counter);
106 int main(
int argc,
char** argv)
108 ros::init(argc, argv,
"calibration_tracker");
111 new ::DataTracker(nh);
void fobCB(const asr_msgs::AsrObject &fob_msg)
static void spin(DataTracker *obj)
Subscriber subscribe(const std::string &topic, uint32_t queue_size, void(T::*fp)(M), T *obj, const TransportHints &transport_hints=TransportHints())
ROSCPP_DECL void init(int &argc, char **argv, const std::string &name, uint32_t options=0)
std::string output_file_path
ROSCPP_DECL void spin(Spinner &spinner)
DataTracker(ros::NodeHandle nh)
geometry_msgs::Pose fob_pose
void cbdCB(const geometry_msgs::PoseStamped &cbd_msg)
geometry_msgs::Pose cbd_pose
void ptuCB(const sensor_msgs::JointState &ptu_msg)
int main(int argc, char **argv)
bool getParam(const std::string &key, std::string &s) const