TKStateToStampedPose.cpp
Go to the documentation of this file.
00001 /*
00002  * TKStateToStampedPose.cpp
00003  *
00004  *  Created on: Feb 15, 2012
00005  *      Author: mriedel
00006  */
00007 
00008 #include "TKStateToStampedPose.hpp"
00009 
00010 #include <ros/ros.h>
00011 
00012 #include <telekyb_base/ROS/ROSModule.hpp>
00013 
00014 TKStateToStampedPoseOptions::TKStateToStampedPoseOptions()
00015         : OptionContainer("State2Pose")
00016 {
00017         tInputState = addOption<std::string>("tInputState", "Define Input TKState", "undef", true, true);
00018         tOutputPose = addOption<std::string>("tOutputPose", "Define Output PoseStamped", "undef", true, true);
00019 }
00020 
00021 TKStateToStampedPose::TKStateToStampedPose() {
00022         n = ROSModule::Instance().getMainNodeHandle();
00023         stateSub = n.subscribe(options.tInputState->getValue(), 1, &TKStateToStampedPose::tkStateCB, this);
00024         posePub = n.advertise<geometry_msgs::PoseStamped>(options.tOutputPose->getValue(), 1);
00025 }
00026 
00027 TKStateToStampedPose::~TKStateToStampedPose() {
00028         // TODO Auto-generated destructor stub
00029 }
00030 
00031 void TKStateToStampedPose::tkStateCB(const telekyb_msgs::TKState::ConstPtr& msg)
00032 {
00033         geometry_msgs::PoseStamped poseMsg;
00034         poseMsg.header = msg->header;
00035         poseMsg.header.frame_id = "world";
00036         poseMsg.pose = msg->pose;
00037         posePub.publish(poseMsg);
00038 }
00039 
00040 
00041 int main(int argc, char **argv) {
00042         TeleKyb::init(argc,argv, "state2pose", ros::init_options::AnonymousName);
00043 
00044         TKStateToStampedPose *o = new TKStateToStampedPose();
00045         ros::waitForShutdown();
00046         delete o;
00047 
00048         TeleKyb::shutdown();
00049 }
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


tk_conversion
Author(s): Martin Riedel
autogenerated on Mon Nov 11 2013 11:14:33