NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
ros_odom_rapid_position.h
Go to the documentation of this file.
1 /* Copyright (c) 2017, United States Government, as represented by the
2  * Administrator of the National Aeronautics and Space Administration.
3  *
4  * All rights reserved.
5  *
6  * The Astrobee platform is licensed under the Apache License, Version 2.0
7  * (the "License"); you may not use this file except in compliance with the
8  * License. You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15  * License for the specific language governing permissions and limitations
16  * under the License.
17  */
18 
19 #ifndef DDS_ROS_BRIDGE_ROS_ODOM_RAPID_POSITION_H_
20 #define DDS_ROS_BRIDGE_ROS_ODOM_RAPID_POSITION_H_
21 
22 #include <string>
23 #include <memory>
24 
25 #include "dds_ros_bridge/ros_sub_rapid_pub.h"
27 #include "dds_ros_bridge/util.h"
28 
29 #include "ff_msgs/EkfState.h"
30 
31 #include "knDds/DdsTypedSupplier.h"
32 
33 #include "rapidDds/RapidConstants.h"
34 
35 #include "rapidIo/RapidIoParameters.h"
36 
37 #include "rapidUtil/RapidHelper.h"
38 
39 #include "dds_msgs/AstrobeeConstants.h"
40 #include "dds_msgs/EkfStateSupport.h"
41 
42 namespace ff {
43 
45  public:
46  RosOdomRapidPosition(const std::string& subscribe_topic,
47  const std::string& pub_topic,
48  const ros::NodeHandle& nh,
49  const unsigned int queue_size = 10);
50 
51  void CopyTransform3D(rapid::Transform3D& transform,
52  const geometry_msgs::Pose& pose);
53  void CopyVec3D(rapid::Vec3d& vec_out, const geometry_msgs::Vector3& vec_in);
54  void MsgCallback(const ff_msgs::EkfStateConstPtr& msg);
55  void PubEkf(const ros::TimerEvent& event);
56  void PubPosition(const ros::TimerEvent& event);
57  void SetEkfPublishRate(float rate);
58  void SetPositionPublishRate(float rate);
59 
60  private:
61  rapid::PositionTopicPairParameters params_;
62  std::shared_ptr<rapid::PositionProviderRosHelper> provider_;
63 
64  ff_msgs::EkfStateConstPtr ekf_msg_;
65 
66  using StateSupplier =
67  kn::DdsTypedSupplier<rapid::ext::astrobee::EkfState>;
68  using StateSupplierPtr = std::unique_ptr<StateSupplier>;
69 
70  StateSupplierPtr state_supplier_;
71 
72  bool ekf_sent_, pub_ekf_;
73 
74  ros::Timer ekf_timer_, position_timer_;
75 };
76 
77 } // end namespace ff
78 
79 #endif // DDS_ROS_BRIDGE_ROS_ODOM_RAPID_POSITION_H_
ff::RosOdomRapidPosition::MsgCallback
void MsgCallback(const ff_msgs::EkfStateConstPtr &msg)
Definition: ros_odom_rapid_position.cc:79
ff::RosOdomRapidPosition::CopyTransform3D
void CopyTransform3D(rapid::Transform3D &transform, const geometry_msgs::Pose &pose)
Definition: ros_odom_rapid_position.cc:111
rapid_position_provider_ros_helper.h
ff::RosSubRapidPub
Definition: ros_sub_rapid_pub.h:30
ff::RosOdomRapidPosition::SetEkfPublishRate
void SetEkfPublishRate(float rate)
Definition: ros_odom_rapid_position.cc:181
ff::RosOdomRapidPosition
Definition: ros_odom_rapid_position.h:44
ff::RosOdomRapidPosition::PubEkf
void PubEkf(const ros::TimerEvent &event)
Definition: ros_odom_rapid_position.cc:130
ff::RosOdomRapidPosition::RosOdomRapidPosition
RosOdomRapidPosition(const std::string &subscribe_topic, const std::string &pub_topic, const ros::NodeHandle &nh, const unsigned int queue_size=10)
Definition: ros_odom_rapid_position.cc:23
ff
Definition: generic_rapid_msg_ros_pub.h:36
ff::RosOdomRapidPosition::PubPosition
void PubPosition(const ros::TimerEvent &event)
Definition: ros_odom_rapid_position.cc:174
ff::RosOdomRapidPosition::SetPositionPublishRate
void SetPositionPublishRate(float rate)
Definition: ros_odom_rapid_position.cc:192
ff::RosOdomRapidPosition::CopyVec3D
void CopyVec3D(rapid::Vec3d &vec_out, const geometry_msgs::Vector3 &vec_in)
Definition: ros_odom_rapid_position.cc:123