NASA Astrobee Robot Software  0.19.1
Flight software for the Astrobee robots operating inside the International Space Station.
measurement_conversions.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 LOCALIZATION_MEASUREMENTS_MEASUREMENT_CONVERSIONS_H_
20 #define LOCALIZATION_MEASUREMENTS_MEASUREMENT_CONVERSIONS_H_
21 
22 #include <ff_msgs/DepthOdometry.h>
23 #include <ff_msgs/DepthLandmarks.h>
24 #include <ff_msgs/Feature2dArray.h>
25 #include <ff_msgs/VisualLandmarks.h>
40 
41 #include <Eigen/Core>
42 
43 #include <pcl/point_cloud.h>
44 #include <pcl/point_types.h>
45 #include <pcl_conversions/pcl_conversions.h>
46 
47 #include <sensor_msgs/Image.h>
48 #include <sensor_msgs/PointCloud2.h>
49 
50 #include <string>
51 #include <utility>
52 #include <vector>
53 
54 namespace localization_measurements {
55 MatchedProjectionsMeasurement MakeMatchedProjectionsMeasurement(const ff_msgs::VisualLandmarks& visual_landmarks);
56 
57 HandrailPointsMeasurement MakeHandrailPointsMeasurement(const ff_msgs::DepthLandmarks& depth_landmarks,
58  const TimestampedHandrailPose& world_T_handrail);
59 
60 Plane MakeHandrailPlane(const gtsam::Pose3& world_T_handrail, const double distance_to_wall);
61 
62 std::pair<gtsam::Point3, gtsam::Point3> MakeHandrailEndpoints(const gtsam::Pose3& world_T_handrail,
63  const double length);
64 
65 MatchedProjectionsMeasurement FrameChangeMatchedProjectionsMeasurement(
66  const MatchedProjectionsMeasurement& matched_projections_measurement,
67  const gtsam::Pose3& new_frame_T_measurement_origin);
68 
69 FeaturePointsMeasurement MakeFeaturePointsMeasurement(const ff_msgs::Feature2dArray& optical_flow_tracks);
70 
71 FanSpeedMode ConvertFanSpeedMode(const uint8_t speed);
72 
73 boost::optional<ImageMeasurement> MakeImageMeasurement(const sensor_msgs::ImageConstPtr& image_msg,
74  const std::string& encoding);
75 
76 PointCloudMeasurement MakePointCloudMeasurement(const sensor_msgs::PointCloud2ConstPtr& point_cloud_msg);
77 
78 boost::optional<DepthImageMeasurement> MakeDepthImageMeasurement(
79  const sensor_msgs::PointCloud2ConstPtr& depth_cloud_msg, const sensor_msgs::ImageConstPtr& image_msg,
80  const Eigen::Affine3d image_A_depth_cam = Eigen::Affine3d::Identity());
81 
82 // TODO(rsoussan): Move this somewhere else?
83 template <typename PointType>
84 sensor_msgs::PointCloud2 MakePointCloudMsg(const pcl::PointCloud<PointType>& cloud,
85  const localization_common::Time timestamp, const std::string frame) {
86  sensor_msgs::PointCloud2 cloud_msg;
87  pcl::toROSMsg(cloud, cloud_msg);
88  localization_common::TimeToHeader(timestamp, cloud_msg.header);
89  cloud_msg.header.frame_id = frame;
90  return cloud_msg;
91 }
92 
93 localization_common::PoseWithCovariance MakePoseWithCovariance(const geometry_msgs::PoseWithCovariance& msg);
94 
95 Odometry MakeOdometry(const ff_msgs::Odometry& msg);
96 
97 DepthCorrespondences MakeDepthCorrespondences(const std::vector<ff_msgs::DepthCorrespondence>& msgs);
98 
99 DepthOdometryMeasurement MakeDepthOdometryMeasurement(const ff_msgs::DepthOdometry& depth_odometry_msg);
100 } // namespace localization_measurements
101 
102 #endif // LOCALIZATION_MEASUREMENTS_MEASUREMENT_CONVERSIONS_H_
localization_measurements::ConvertFanSpeedMode
FanSpeedMode ConvertFanSpeedMode(const uint8_t speed)
Definition: measurement_conversions.cc:128
depth_odometry_measurement.h
localization_measurements::MakeDepthCorrespondences
DepthCorrespondences MakeDepthCorrespondences(const std::vector< ff_msgs::DepthCorrespondence > &msgs)
depth_image_measurement.h
utilities.h
localization_measurements::MakeHandrailPointsMeasurement
HandrailPointsMeasurement MakeHandrailPointsMeasurement(const ff_msgs::DepthLandmarks &depth_landmarks, const TimestampedHandrailPose &world_T_handrail)
Definition: measurement_conversions.cc:72
localization_measurements::MakePointCloudMsg
sensor_msgs::PointCloud2 MakePointCloudMsg(const pcl::PointCloud< PointType > &cloud, const localization_common::Time timestamp, const std::string frame)
Definition: measurement_conversions.h:84
localization_measurements::MakeDepthOdometryMeasurement
DepthOdometryMeasurement MakeDepthOdometryMeasurement(const ff_msgs::DepthOdometry &depth_odometry_msg)
Definition: measurement_conversions.cc:255
matched_projections_measurement.h
plane.h
localization_measurements::MakeHandrailEndpoints
std::pair< gtsam::Point3, gtsam::Point3 > MakeHandrailEndpoints(const gtsam::Pose3 &world_T_handrail, const double length)
Definition: measurement_conversions.cc:60
localization_measurements::MakeFeaturePointsMeasurement
FeaturePointsMeasurement MakeFeaturePointsMeasurement(const ff_msgs::Feature2dArray &optical_flow_tracks)
Definition: measurement_conversions.cc:111
image_measurement.h
handrail_points_measurement.h
pcl::toROSMsg
void toROSMsg(const pcl::PointCloud< T > &pcl_cloud, sensor_msgs::PointCloud2 &cloud)
Definition: pcl_conversions.h:234
localization_measurements::FrameChangeMatchedProjectionsMeasurement
MatchedProjectionsMeasurement FrameChangeMatchedProjectionsMeasurement(const MatchedProjectionsMeasurement &matched_projections_measurement, const gtsam::Pose3 &new_frame_T_measurement_origin)
Definition: measurement_conversions.cc:100
localization_measurements
Definition: depth_correspondences.h:25
localization_common::PoseWithCovariance
Definition: pose_with_covariance.h:28
point_cloud_measurement.h
localization_measurements::MakeMatchedProjectionsMeasurement
MatchedProjectionsMeasurement MakeMatchedProjectionsMeasurement(const ff_msgs::VisualLandmarks &visual_landmarks)
Definition: measurement_conversions.cc:33
localization_measurements::MakeImageMeasurement
boost::optional< ImageMeasurement > MakeImageMeasurement(const sensor_msgs::ImageConstPtr &image_msg, const std::string &encoding)
Definition: measurement_conversions.cc:143
combined_nav_state_covariances.h
timestamped_handrail_pose.h
combined_nav_state.h
localization_measurements::MakeHandrailPlane
Plane MakeHandrailPlane(const gtsam::Pose3 &world_T_handrail, const double distance_to_wall)
Definition: measurement_conversions.cc:50
optimization_common::Affine3d
Eigen::Affine3d Affine3d(const Eigen::Matrix< double, 7, 1 > &affine_vector)
Definition: utilities.cc:43
localization_measurements::FanSpeedMode
FanSpeedMode
Definition: fan_speed_mode.h:23
localization_measurements::MakePointCloudMeasurement
PointCloudMeasurement MakePointCloudMeasurement(const sensor_msgs::PointCloud2ConstPtr &point_cloud_msg)
Definition: measurement_conversions.cc:156
feature_points_measurement.h
localization_measurements::MakePoseWithCovariance
localization_common::PoseWithCovariance MakePoseWithCovariance(const geometry_msgs::PoseWithCovariance &msg)
Definition: measurement_conversions.cc:208
localization_common::TimeToHeader
void TimeToHeader(const Time timestamp, std_msgs::Header &header)
Definition: utilities.cc:113
imu_measurement.h
localization_measurements::MakeOdometry
Odometry MakeOdometry(const ff_msgs::Odometry &msg)
Definition: measurement_conversions.cc:219
localization_common::Time
double Time
Definition: time.h:23
localization_measurements::MakeDepthImageMeasurement
boost::optional< DepthImageMeasurement > MakeDepthImageMeasurement(const sensor_msgs::PointCloud2ConstPtr &depth_cloud_msg, const sensor_msgs::ImageConstPtr &image_msg, const Eigen::Affine3d image_A_depth_cam=Eigen::Affine3d::Identity())
Definition: measurement_conversions.cc:163
fan_speed_mode.h