SSXStateEstimator.cpp
Go to the documentation of this file.
00001 /*
00002  * SSXStateEstimator.cpp
00003  *
00004  *  Created on: Nov 3, 2011
00005  *      Author: mriedel
00006  */
00007 
00008 #include <StateEstimators/SSXStateEstimator.hpp>
00009 #include <tk_state/StateEstimatorController.hpp>
00010 
00011 #include <telekyb_base/ROS.hpp>
00012 
00013 // Declare
00014 PLUGINLIB_DECLARE_CLASS(tk_state, SSXStateEstimator, telekyb_state::SSXStateEstimator, TELEKYB_NAMESPACE::StateEstimator);
00015 
00016 namespace telekyb_state {
00017 
00018 SSXStateEstimatorOptions::SSXStateEstimatorOptions()
00019         : OptionContainer("SSXStateEstimator")
00020 {
00021         tSSXSeTopicName = addOption<std::string>("tSSXSeTopicName","TopicName of SSX InternalState Sensor.","undef",true, true);
00022         tSSXPositionOffset = addOption<Eigen::Vector3d>("tSSXPositionOffset","Position Offset added to Sensor Input",
00023                         Eigen::Vector3d::Zero(), false, true);
00024 }
00025 
00026 void SSXStateEstimator::initialize()
00027 {
00028         nodeHandle = ROSModule::Instance().getMainNodeHandle();
00029 }
00030 void SSXStateEstimator::willBecomeActive()
00031 {
00032         ssxSubscriber = nodeHandle.subscribe<telekyb_msgs::TKState>(
00033                         options.tSSXSeTopicName->getValue(),1, &SSXStateEstimator::ssxCallback, this);
00034 }
00035 void SSXStateEstimator::willBecomeInActive()
00036 {
00037         ssxSubscriber.shutdown();
00038 }
00039 
00040 void SSXStateEstimator::destroy()
00041 {
00042 // nothing to do here
00043 }
00044 
00045 std::string SSXStateEstimator::getName() const
00046 {
00047 //      return options.tSSXSeTopicName->getValue();
00048         return "SSXStateEstimator";
00049 }
00050 
00051 void SSXStateEstimator::ssxCallback(const telekyb_msgs::TKState::ConstPtr& stateMsg)
00052 {
00053         // StateEstimatorController neest a telekyb::TKState
00054         TKState tStateMsg(*stateMsg);
00055         tStateMsg.position += options.tSSXPositionOffset->getValue();
00056         stateEstimatorController.activeStateCallBack(tStateMsg);
00057 }
00058 
00059 } // namespace
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Friends


tk_state
Author(s): Dr. Antonio Franchi and Martin Riedel
autogenerated on Mon Nov 11 2013 11:13:03