Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #include <StateEstimators/SSXStateEstimator.hpp>
00009 #include <tk_state/StateEstimatorController.hpp>
00010
00011 #include <telekyb_base/ROS.hpp>
00012
00013
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
00043 }
00044
00045 std::string SSXStateEstimator::getName() const
00046 {
00047
00048 return "SSXStateEstimator";
00049 }
00050
00051 void SSXStateEstimator::ssxCallback(const telekyb_msgs::TKState::ConstPtr& stateMsg)
00052 {
00053
00054 TKState tStateMsg(*stateMsg);
00055 tStateMsg.position += options.tSSXPositionOffset->getValue();
00056 stateEstimatorController.activeStateCallBack(tStateMsg);
00057 }
00058
00059 }