navsat_transform.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014, 2015, 2016, Charles River Analytics, Inc.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above
12  * copyright notice, this list of conditions and the following
13  * disclaimer in the documentation and/or other materials provided
14  * with the distribution.
15  * 3. Neither the name of the copyright holder nor the names of its
16  * contributors may be used to endorse or promote products derived
17  * from this software without specific prior written permission.
18  *
19  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
23  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
24  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
25  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
26  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
29  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 #ifndef ROBOT_LOCALIZATION_NAVSAT_TRANSFORM_H
34 #define ROBOT_LOCALIZATION_NAVSAT_TRANSFORM_H
35 
36 #include <robot_localization/SetDatum.h>
37 
38 #include <ros/ros.h>
39 
40 #include <nav_msgs/Odometry.h>
41 #include <sensor_msgs/Imu.h>
42 #include <sensor_msgs/NavSatFix.h>
43 
46 #include <tf2_ros/buffer.h>
48 
49 #include <Eigen/Dense>
50 
51 #include <string>
52 
53 namespace RobotLocalization
54 {
55 
57 {
58  public:
62 
66 
69  void run();
70 
71  private:
74  void computeTransform();
75 
78  bool datumCallback(robot_localization::SetDatum::Request& request, robot_localization::SetDatum::Response&);
79 
83  void getRobotOriginUtmPose(const tf2::Transform &gps_utm_pose,
84  tf2::Transform &robot_utm_pose,
85  const ros::Time &transform_time);
86 
90  void getRobotOriginWorldPose(const tf2::Transform &gps_odom_pose,
91  tf2::Transform &robot_odom_pose,
92  const ros::Time &transform_time);
93 
97  void gpsFixCallback(const sensor_msgs::NavSatFixConstPtr& msg);
98 
102  void imuCallback(const sensor_msgs::ImuConstPtr& msg);
103 
107  void odomCallback(const nav_msgs::OdometryConstPtr& msg);
108 
112  bool prepareFilteredGps(sensor_msgs::NavSatFix &filtered_gps);
113 
117  bool prepareGpsOdometry(nav_msgs::Odometry &gps_odom);
118 
122  void setTransformGps(const sensor_msgs::NavSatFixConstPtr& msg);
123 
127  void setTransformOdometry(const nav_msgs::OdometryConstPtr& msg);
128 
133  std::string base_link_frame_id_;
134 
138 
142 
145  std::string gps_frame_id_;
146 
152 
158 
162 
166 
170 
173  Eigen::MatrixXd latest_odom_covariance_;
174 
177  Eigen::MatrixXd latest_utm_covariance_;
178 
182 
186 
190 
196 
202 
206 
210 
214 
218 
222 
226 
230 
235 
239 
243 
247 
251 
255 
258  std::string utm_zone_;
259 
264  std::string world_frame_id_;
265 
271  double yaw_offset_;
272 
280 
284 
290 
294 
298 };
299 
300 } // namespace RobotLocalization
301 
302 #endif // ROBOT_LOCALIZATION_NAVSAT_TRANSFORM_H
tf2_ros::Buffer tf_buffer_
Transform buffer for managing coordinate transforms.
tf2::Transform transform_world_pose_
Latest IMU orientation.
bool zero_altitude_
Whether or not to report 0 altitude.
msg
std::string world_frame_id_
Frame ID of the GPS odometry output.
tf2_ros::StaticTransformBroadcaster utm_broadcaster_
Used for publishing the static world_frame->utm transform.
void setTransformGps(const sensor_msgs::NavSatFixConstPtr &msg)
Used for setting the GPS data that will be used to compute the transform.
Eigen::MatrixXd latest_odom_covariance_
Covariance for most recent odometry data.
bool datumCallback(robot_localization::SetDatum::Request &request, robot_localization::SetDatum::Response &)
Callback for the datum service.
bool publish_gps_
Whether or not we publish filtered GPS messages.
void getRobotOriginUtmPose(const tf2::Transform &gps_utm_pose, tf2::Transform &robot_utm_pose, const ros::Time &transform_time)
Given the pose of the navsat sensor in the UTM frame, removes the offset from the vehicle&#39;s centroid ...
bool has_transform_gps_
Whether or not the GPS fix is usable.
ros::Duration transform_timeout_
Parameter that specifies the how long we wait for a transform to become available.
bool world_frame_param_loaded_
Whether world frame parameter was loaded.
double utm_meridian_convergence_
UTM&#39;s meridian convergence.
std::string base_link_frame_id_
Frame ID of the robot&#39;s body frame.
bool has_transform_imu_
Signifies that we have received a usable IMU message.
std::string utm_zone_
UTM zone as determined after transforming GPS message.
tf2::Transform utm_world_transform_
Holds the UTM->odom transform.
ros::Time gps_update_time_
Timestamp of the latest good GPS message.
tf2::Transform utm_world_trans_inverse_
Holds the odom->UTM transform for filtered GPS broadcast.
tf2::Transform latest_world_pose_
Latest odometry pose data.
bool prepareGpsOdometry(nav_msgs::Odometry &gps_odom)
Prepares the GPS odometry message before sending.
double utm_odom_tf_yaw_
Stores the yaw we need to compute the transform.
bool use_odometry_yaw_
Whether we get the transform&#39;s yaw from the odometry or IMU source.
void computeTransform()
Computes the transform from the UTM frame to the odom frame.
bool use_manual_datum_
Whether we get our datum from the first GPS message or from the set_datum service/parameter.
bool base_link_frame_param_loaded_
Whether base link frame parameter was loaded.
bool odom_updated_
Whether or not we have new odometry data.
tf2::Transform latest_utm_pose_
Latest GPS data, stored as UTM coords.
double yaw_offset_
IMU&#39;s yaw offset.
Eigen::MatrixXd latest_utm_covariance_
Covariance for most recent GPS/UTM data.
bool gps_updated_
Whether or not we have new GPS data.
void getRobotOriginWorldPose(const tf2::Transform &gps_odom_pose, tf2::Transform &robot_odom_pose, const ros::Time &transform_time)
Given the pose of the navsat sensor in the world frame, removes the offset from the vehicle&#39;s centroi...
void setTransformOdometry(const nav_msgs::OdometryConstPtr &msg)
Used for setting the odometry data that will be used to compute the transform.
bool has_transform_odom_
Signifies that we have received a usable odometry message.
tf2::Quaternion transform_orientation_
Latest IMU orientation.
void imuCallback(const sensor_msgs::ImuConstPtr &msg)
Callback for the IMU data.
double magnetic_declination_
Parameter that specifies the magnetic declination for the robot&#39;s environment.
bool transform_good_
Whether or not we&#39;ve computed a good heading.
bool prepareFilteredGps(sensor_msgs::NavSatFix &filtered_gps)
Converts the odometry data back to GPS and broadcasts it.
tf2_ros::TransformListener tf_listener_
Transform listener for receiving transforms.
void gpsFixCallback(const sensor_msgs::NavSatFixConstPtr &msg)
Callback for the GPS fix data.
tf2::Transform transform_utm_pose_
Holds the UTM pose that is used to compute the transform.
bool broadcast_utm_transform_as_parent_frame_
Whether to broadcast the UTM transform as parent frame, default as child.
void odomCallback(const nav_msgs::OdometryConstPtr &msg)
Callback for the odom data.
bool broadcast_utm_transform_
Whether or not we broadcast the UTM transform.
std::string gps_frame_id_
The frame_id of the GPS message (specifies mounting location)
ros::Time odom_update_time_
Timestamp of the latest good odometry message.


robot_localization
Author(s): Tom Moore
autogenerated on Wed Feb 3 2021 03:34:02